Skip to content

Commit

Permalink
Merge pull request #434 from randovania/custom-suit-reductions
Browse files Browse the repository at this point in the history
Add support for custom damage reduction per suit
  • Loading branch information
ThanatosGit authored Jul 29, 2024
2 parents 13d014f + fbe11d9 commit 1569542
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
15 changes: 15 additions & 0 deletions src/open_samus_returns_rando/files/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,21 @@
},
"default": {}
},
"suit_reductions": {
"description": "Set the damage reduction per suit.",
"type": "object",
"properties": {
"varia_suit_reduction": {
"type": "number",
"default": 0.75
},
"gravity_suit_reduction": {
"type": "number",
"default": 0.5
}
},
"default": {}
},
"reveal_map_on_start": {
"type": "boolean",
"default": false,
Expand Down
5 changes: 3 additions & 2 deletions src/open_samus_returns_rando/samus_returns_patcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
from open_samus_returns_rando.patcher_editor import PatcherEditor
from open_samus_returns_rando.pickups.custom_pickups import patch_custom_pickups
from open_samus_returns_rando.pickups.pickup import patch_pickups
from open_samus_returns_rando.specific_patches import cosmetic_patches, game_patches, tunable_patches
from open_samus_returns_rando.specific_patches import cosmetic_patches, game_patches
from open_samus_returns_rando.specific_patches.chozo_seal_patches import patch_chozo_seals
from open_samus_returns_rando.specific_patches.door_patches import patch_doors
from open_samus_returns_rando.specific_patches.environmental_damage import apply_constant_damage
from open_samus_returns_rando.specific_patches.heat_room_patches import patch_heat_rooms
from open_samus_returns_rando.specific_patches.hint_patches import patch_hints
from open_samus_returns_rando.specific_patches.metroid_patches import patch_metroids
from open_samus_returns_rando.specific_patches.static_fixes import apply_static_fixes
from open_samus_returns_rando.specific_patches.tunable_patches import patch_tunables
from open_samus_returns_rando.validator_with_default import DefaultValidatingDraft7Validator

T = typing.TypeVar("T")
Expand Down Expand Up @@ -102,7 +103,7 @@ def patch_extracted(input_path: Path, input_exheader: Path | None, output_path:
patch_doors(editor, configuration["door_patches"], configuration["custom_doors"])

# Patch tunables
tunable_patches.patch_tunables(editor, configuration.get("reserves_per_tank", {}))
patch_tunables(editor, configuration)

# Patch cosmetics
cosmetic_patches.patch_cosmetics(editor, configuration.get("cosmetic_patches", {}))
Expand Down
13 changes: 9 additions & 4 deletions src/open_samus_returns_rando/specific_patches/tunable_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
def patch_tunables(editor: PatcherEditor, configuration: dict) -> None:
tunables = editor.get_file("system/tunables/tunables.bmtun", Bmtun)
_patch_scan_pulse(tunables)
_reserves_per_tank(tunables, configuration)
_reserves_per_tank(tunables, configuration["reserves_per_tank"])
_suit_reductions(tunables, configuration["suit_reductions"])


def _patch_scan_pulse(tunables: Bmtun) -> None:
tunables.raw["classes"]["CTunableAbilityScanningPulse"]["tunables"][
"fConsumptionOnActivation"
]["value"] = 0.0
tunables.raw["classes"]["CTunableAbilityScanningPulse"]["tunables"]["fConsumptionOnActivation"]["value"] = 0.0


def _reserves_per_tank(tunables: Bmtun, configuration: dict) -> None:
Expand All @@ -20,3 +19,9 @@ def _reserves_per_tank(tunables: Bmtun, configuration: dict) -> None:
amiibo["fSETankSize"]["value"] = configuration["aeion_tank_size"]
amiibo["fMissileTankSize"]["value"] = configuration["missile_tank_size"]
amiibo["fSuperMissileTankSize"]["value"] = configuration["super_missile_tank_size"]


def _suit_reductions(tunables: Bmtun, configuration: dict) -> None:
life = tunables.raw["classes"]["Player|CTunablePlayerLifeComponent"]["tunables"]
life["fVariaSuitDamageMult"]["value"] = configuration["varia_suit_reduction"]
life["fGravitySuitDamageMult"]["value"] = configuration["gravity_suit_reduction"]

0 comments on commit 1569542

Please sign in to comment.