Skip to content

Commit

Permalink
Several patches for Sanctuary Fortress - Minigyro Chamber
Browse files Browse the repository at this point in the history
Added Cannon Ball fix for Sanctuary Fortress - Minigyro Chamber
Added no backward traversal QoL patch for Sanctuary Fortress - Minigyro Chamber
  • Loading branch information
UltiNaruto committed Mar 13, 2024
1 parent 513b20f commit 6114382
Showing 1 changed file with 77 additions and 1 deletion.
78 changes: 77 additions & 1 deletion src/open_prime_rando/echoes/specific_area_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
import struct

from construct import Container
from retro_data_structures.enums.echoes import Message, State
from retro_data_structures.enums.echoes import Function, Message, State
from retro_data_structures.formats.script_object import ScriptInstance
from retro_data_structures.game_check import Game
from retro_data_structures.properties.echoes.archetypes.EditorProperties import EditorProperties
from retro_data_structures.properties.echoes.archetypes.LayerSwitch import LayerSwitch
from retro_data_structures.properties.echoes.objects.Counter import Counter
from retro_data_structures.properties.echoes.objects.Relay import Relay
from retro_data_structures.properties.echoes.objects.ScriptLayerController import ScriptLayerController
from retro_data_structures.properties.echoes.objects.Trigger import Trigger

from open_prime_rando.echoes.asset_ids.agon_wastes import (
COMMAND_CENTER_MREA,
MINING_STATION_B_MREA,
PORTAL_TERMINAL_MREA,
)
from open_prime_rando.echoes.asset_ids.sanctuary_fortress import MINIGYRO_CHAMBER_MREA
from open_prime_rando.echoes.asset_ids.torvus_bog import TORVUS_ENERGY_CONTROLLER_MREA, TORVUS_TEMPLE_MREA
from open_prime_rando.echoes.asset_ids.world import AGON_WASTES_MLVL, TORVUS_BOG_MLVL
from open_prime_rando.patcher_editor import PatcherEditor
Expand Down Expand Up @@ -165,3 +167,77 @@ def command_center_door(editor: PatcherEditor):
Message.Activate,
default.get_instance(instance),
)


def sanctuary_fortress_minigyro_chamber_cannon_ball_fix(editor: PatcherEditor):
"""
Patches Sanctuary Fortress - Minigyro Chamber to prevent Cannon Ball from
going through the gyroscope damage force field
"""
area = editor.get_mrea(MINIGYRO_CHAMBER_MREA)

Check warning on line 177 in src/open_prime_rando/echoes/specific_area_patches.py

View check run for this annotation

Codecov / codecov/patch

src/open_prime_rando/echoes/specific_area_patches.py#L177

Added line #L177 was not covered by tests

"""

Check warning on line 179 in src/open_prime_rando/echoes/specific_area_patches.py

View check run for this annotation

Codecov / codecov/patch

src/open_prime_rando/echoes/specific_area_patches.py#L179

Added line #L179 was not covered by tests
Add special function to send player away from gyroscope
"""
special_function = area.get_layer("Gyroscope puzzle").add_instance_with(SpecialFunction(

Check warning on line 182 in src/open_prime_rando/echoes/specific_area_patches.py

View check run for this annotation

Codecov / codecov/patch

src/open_prime_rando/echoes/specific_area_patches.py#L182

Added line #L182 was not covered by tests
editor_properties=EditorProperties(
name="SpecialFunction - keep off gyroscope (Front)",
active=True
),
function=Function.LaunchPlayer,
value_parm=-10.0,
))

"""

Check warning on line 191 in src/open_prime_rando/echoes/specific_area_patches.py

View check run for this annotation

Codecov / codecov/patch

src/open_prime_rando/echoes/specific_area_patches.py#L191

Added line #L191 was not covered by tests
Link triggers that damages you to our special function
"""
trigger_ids = [0x0C070005, 0x0C070009, 0x0C070034, 0x0C07003D]
for trigger_id in trigger_ids:
trigger = area.get_instance(trigger_id)

Check warning on line 196 in src/open_prime_rando/echoes/specific_area_patches.py

View check run for this annotation

Codecov / codecov/patch

src/open_prime_rando/echoes/specific_area_patches.py#L194-L196

Added lines #L194 - L196 were not covered by tests

with trigger.edit_properties(Trigger) as props:
props.trigger.damage.di_damage = 0.0
props.trigger.damage.di_radius = 0.0
props.trigger.damage.di_knock_back_power = 0.0

Check warning on line 201 in src/open_prime_rando/echoes/specific_area_patches.py

View check run for this annotation

Codecov / codecov/patch

src/open_prime_rando/echoes/specific_area_patches.py#L198-L201

Added lines #L198 - L201 were not covered by tests

trigger.add_connection(State.Entered, Message.Action, special_function)

Check warning on line 203 in src/open_prime_rando/echoes/specific_area_patches.py

View check run for this annotation

Codecov / codecov/patch

src/open_prime_rando/echoes/specific_area_patches.py#L203

Added line #L203 was not covered by tests


def sanctuary_fortress_minigyro_chamber_prevent_backward_traversal_patch(editor: PatcherEditor):
"""
Patches Sanctuary Fortress - Minigyro Chamber to prevent coming from the back of the room
until the puzzle is solved
"""
area = editor.get_mrea(MINIGYRO_CHAMBER_MREA)

Check warning on line 211 in src/open_prime_rando/echoes/specific_area_patches.py

View check run for this annotation

Codecov / codecov/patch

src/open_prime_rando/echoes/specific_area_patches.py#L211

Added line #L211 was not covered by tests

"""

Check warning on line 213 in src/open_prime_rando/echoes/specific_area_patches.py

View check run for this annotation

Codecov / codecov/patch

src/open_prime_rando/echoes/specific_area_patches.py#L213

Added line #L213 was not covered by tests
Add special function to send player away from gyroscope
"""
special_function = area.get_layer("Gyroscope puzzle").add_instance_with(SpecialFunction(

Check warning on line 216 in src/open_prime_rando/echoes/specific_area_patches.py

View check run for this annotation

Codecov / codecov/patch

src/open_prime_rando/echoes/specific_area_patches.py#L216

Added line #L216 was not covered by tests
editor_properties=EditorProperties(
name="SpecialFunction - keep off gyroscope (Back)",
active=True
),
function=Function.LaunchPlayer,
value_parm=10.0,
))

"""

Check warning on line 225 in src/open_prime_rando/echoes/specific_area_patches.py

View check run for this annotation

Codecov / codecov/patch

src/open_prime_rando/echoes/specific_area_patches.py#L225

Added line #L225 was not covered by tests
Link triggers that damages you to our special function
"""
trigger = area.get_layer("Gyroscope puzzle").add_instance_with(Trigger(

Check warning on line 228 in src/open_prime_rando/echoes/specific_area_patches.py

View check run for this annotation

Codecov / codecov/patch

src/open_prime_rando/echoes/specific_area_patches.py#L228

Added line #L228 was not covered by tests
editor_properties=EditorProperties(
name="Trigger - keep off gyroscope (Back)",
active=True
),
))

with trigger.edit_properties(Trigger) as props:
props.editor_properties.position.x = 150.726303
props.editor_properties.position.y = 129.589584
props.editor_properties.position.z = -115.434067
props.editor_properties.scale.x = 2.6
props.editor_properties.scale.y = 1.0
props.editor_properties.scale.z = 2.0

Check warning on line 241 in src/open_prime_rando/echoes/specific_area_patches.py

View check run for this annotation

Codecov / codecov/patch

src/open_prime_rando/echoes/specific_area_patches.py#L235-L241

Added lines #L235 - L241 were not covered by tests

trigger.add_connection(State.Entered, Message.Action, special_function)

Check warning on line 243 in src/open_prime_rando/echoes/specific_area_patches.py

View check run for this annotation

Codecov / codecov/patch

src/open_prime_rando/echoes/specific_area_patches.py#L243

Added line #L243 was not covered by tests

0 comments on commit 6114382

Please sign in to comment.