From d6050eb0e15b58ac6bfa6aecd95c41f26f035e3c Mon Sep 17 00:00:00 2001 From: LLCoolDave Date: Sat, 20 May 2017 15:47:28 +0200 Subject: [PATCH] Fix lightcone rules for standard, where cones depend on where a region IS, not where it WOULD BE in vanilla. --- EntranceShuffle.py | 2 +- Regions.py | 3 +- Rules.py | 81 +++++++++++++++++++++++++++++++++++----------- 3 files changed, 65 insertions(+), 21 deletions(-) diff --git a/EntranceShuffle.py b/EntranceShuffle.py index c3340d02..8a5e46c1 100644 --- a/EntranceShuffle.py +++ b/EntranceShuffle.py @@ -848,7 +848,7 @@ default_connections = [('Waterfall of Wishing', 'Waterfall of Wishing'), ('Old Man Cave Exit (East)', 'Light World'), ('Old Man House (Bottom)', 'Old Man House'), ('Old Man House Exit (Bottom)', 'Death Mountain'), - ('Old Man House (Top)', 'Old Man House'), + ('Old Man House (Top)', 'Old Man House Back'), ('Old Man House Exit (Top)', 'Death Mountain'), ('Death Mountain Return Cave (East)', 'Death Mountain Return Cave'), ('Death Mountain Return Cave (West)', 'Death Mountain Return Cave'), diff --git a/Regions.py b/Regions.py index e0bd7077..45020c45 100644 --- a/Regions.py +++ b/Regions.py @@ -88,7 +88,8 @@ def create_regions(world): create_region('Aghanims Tower', ['[dungeon-A1-2F] Hyrule Castle Tower - 2 Knife Guys Room', '[dungeon-A1-3F] Hyrule Castle Tower - Maze Room'], ['Aghanim 1', 'Aghanims Tower Exit']), create_region('Aghanim 1', None, ['Top of Pyramid']), create_region('Old Man Cave', ['Old Mountain Man'], ['Old Man Cave Exit (East)', 'Old Man Cave Exit (West)']), - create_region('Old Man House', None, ['Old Man House Exit (Bottom)', 'Old Man House Exit (Top)']), + create_region('Old Man House', None, ['Old Man House Exit (Bottom)', 'Old Man House Front to Back']), + create_region('Old Man House Back', None, ['Old Man House Exit (Top)', 'Old Man House Back to Front']), create_region('Death Mountain', None, ['Old Man Cave (East)', 'Old Man House (Bottom)', 'Old Man House (Top)', 'Death Mountain Return Cave (East)', 'Spectacle Rock Cave', 'Spectacle Rock Cave Peak', 'Spectacle Rock Cave (Bottom)', 'Broken Bridge (West)', 'Death Mountain Teleporter']), create_region('Death Mountain Return Cave', None, ['Death Mountain Return Cave Exit (West)', 'Death Mountain Return Cave Exit (East)']), create_region('Death Mountain Return Ledge', None, ['Death Mountain Return Ledge Drop', 'Death Mountain Return Cave (West)']), diff --git a/Rules.py b/Rules.py index a0bf5370..eb2f0e3c 100644 --- a/Rules.py +++ b/Rules.py @@ -44,6 +44,10 @@ def add_rule(spot, rule, combine='and'): spot.access_rule = lambda state: rule(state) and old_rule(state) +def add_lamp_requirement(spot): + add_rule(spot, lambda state: state.has('Lamp')) + + def forbid_item(location, item): old_rule = location.item_rule location.item_rule = lambda i: i.name != item and old_rule(i) @@ -57,6 +61,10 @@ def global_rules(world): world.get_region('Links House').can_reach = lambda state: True world.get_region('Sanctuary').can_reach = lambda state: True + # we can s&q to the old man house after we rescue him. This may be somewhere completely different if caves are shuffled! + old_rule = world.get_region('Old Man House').can_reach + world.get_region('Old Man House').can_reach = lambda state: state.can_reach('Old Mountain Man', 'Location') or old_rule(state) + # overworld requirements set_rule(world.get_entrance('Kings Grave'), lambda state: state.has_Boots() and (state.can_lift_heavy_rocks() or (state.has_Mirror() and state.can_reach('West Dark World')))) set_rule(world.get_entrance('Bonk Fairy (Light)'), lambda state: state.has_Boots()) @@ -299,28 +307,63 @@ def no_glitches_rules(world): set_rule(world.get_entrance('Dark Lake Hylia Drop (East)'), lambda state: state.has_Pearl() and state.has('Flippers')) set_rule(world.get_entrance('Dark Lake Hylia Teleporter'), lambda state: state.has_Pearl() and state.has('Flippers') and (state.has('Hammer') or state.can_lift_rocks())) set_rule(world.get_entrance('Dark Lake Hylia Ledge Drop'), lambda state: state.has('Flippers')) - add_rule(world.get_entrance('Misery Mire (Vitreous)'), lambda state: state.has('Lamp')) - add_rule(world.get_entrance('Turtle Rock (Dark Room) (North)'), lambda state: state.has('Lamp')) - add_rule(world.get_entrance('Turtle Rock (Dark Room) (South)'), lambda state: state.has('Lamp')) - add_rule(world.get_entrance('Dark Palace Big Key Door'), lambda state: state.has('Lamp')) - add_rule(world.get_entrance('Dark Palace Maze Door'), lambda state: state.has('Lamp')) - set_rule(world.get_location('[dungeon-D1-B1] Dark Palace - Dark Room [left chest]'), lambda state: state.has('Lamp')) - set_rule(world.get_location('[dungeon-D1-B1] Dark Palace - Dark Room [right chest]'), lambda state: state.has('Lamp')) add_rule(world.get_entrance('Ganons Tower (Hookshot Room)'), lambda state: state.has('Hookshot')) set_rule(world.get_entrance('Death Mountain Climb Push Block Reverse'), lambda state: False) # no glitches does not require block override set_rule(world.get_entrance('Death Mountain Climb Bomb Jump'), lambda state: False) - if world.mode == 'open': - add_rule(world.get_entrance('Aghanim 1'), lambda state: state.has('Lamp')) - set_rule(world.get_location('Old Mountain Man'), lambda state: state.has('Lamp')) - set_rule(world.get_entrance('Old Man Cave Exit (East)'), lambda state: state.has('Lamp')) - set_rule(world.get_entrance('Old Man House Exit (Bottom)'), lambda state: state.has('Lamp')) - set_rule(world.get_entrance('Old Man House Exit (Top)'), lambda state: state.has('Lamp')) - set_rule(world.get_entrance('Death Mountain Return Cave Exit (East)'), lambda state: state.has('Lamp')) - set_rule(world.get_entrance('Death Mountain Return Cave Exit (West)'), lambda state: state.has('Lamp')) - set_rule(world.get_location('[dungeon-L1-1F] Eastern Palace - Big Key Room'), lambda state: state.has('Lamp')) - add_rule(world.get_location('Armos - Heart Container'), lambda state: state.has('Lamp')) - add_rule(world.get_location('Armos - Pendant'), lambda state: state.has('Lamp')) + # Light cones in standard depend on which world we actually are in, not which one the location would normally be + # We add Lamp requirements only to those locations which lie in the dark world (or everything if open + DW_Entrances = ['Bumper Cave (Bottom)', + 'Dark Death Mountain Climb (Top)', + 'Dark Death Mountain Climb (Bottom)', + 'Hookshot Cave', + 'Bumper Cave (Top)', + 'Hookshot Cave Back Entrance', + 'Dark Death Mountain Ledge (East)', + 'Turtle Rock Isolated Ledge Entrance', + 'Thieves Town', + 'Skull Woods Final Section', + 'Ice Palace', + 'Misery Mire', + 'Palace of Darkness', + 'Swamp Palace', + 'Turtle Rock', + 'Dark Death Mountain Ledge (West)'] + + def check_is_dark_world(region): + for entrance in region.entrances: + if entrance.name in DW_Entrances: + return True + return False + + def add_conditional_lamp(spot, region, spottype='Location'): + if spottype == 'Location': + spot = world.get_location(spot) + else: + spot = world.get_entrance(spot) + if world.state == 'open' or check_is_dark_world(world.get_region(region)): + add_lamp_requirement(spot) + + add_conditional_lamp('Misery Mire (Vitreous)', 'Misery Mire (Entrance)', 'Entrance') + add_conditional_lamp('Turtle Rock (Dark Room) (North)', 'Turtle Rock (Entrance)', 'Entrance') + add_conditional_lamp('Turtle Rock (Dark Room) (South)', 'Turtle Rock (Entrance)', 'Entrance') + add_conditional_lamp('Dark Palace Big Key Door', 'Dark Palace (Entrance)', 'Entrance') + add_conditional_lamp('Dark Palace Maze Door', 'Dark Palace (Entrance)', 'Entrance') + add_conditional_lamp('[dungeon-D1-B1] Dark Palace - Dark Room [left chest]', 'Dark Palace (Entrance)', 'Location') + add_conditional_lamp('[dungeon-D1-B1] Dark Palace - Dark Room [right chest]', 'Dark Palace (Entrance)', 'Location') + add_conditional_lamp('Aghanim 1', 'Aghanims Tower', 'Entrance') + add_conditional_lamp('Old Mountain Man', 'Old Man Cave', 'Location') + add_conditional_lamp('Old Man Cave Exit (East)', 'Old Man Cave', 'Entrance') + add_conditional_lamp('Death Mountain Return Cave Exit (East)', 'Death Mountain Return Cave', 'Entrance') + add_conditional_lamp('Death Mountain Return Cave Exit (West)', 'Death Mountain Return Cave', 'Entrance') + add_conditional_lamp('Old Man House Front to Back', 'Old Man House', 'Entrance') + add_conditional_lamp('Old Man House Back to Front', 'Old Man House', 'Entrance') + add_conditional_lamp('[dungeon-L1-1F] Eastern Palace - Big Key Room', 'Eastern Palace', 'Location') + add_conditional_lamp('Armos - Heart Container', 'Eastern Palace', 'Location') + add_conditional_lamp('Armos - Pendant', 'Eastern Palace', 'Location') + + if world.state == 'open': + # standard mode always has light cone in sewers and Hyrule Castle in Light world add_rule(world.get_location('[dungeon-C-B1] Escape - First B1 Room'), lambda state: state.has('Lamp')) @@ -342,7 +385,7 @@ def standard_rules(world): def set_blacksmith_rules(world): blacksmith_entrance = world.get_region('Blacksmiths Hut').entrances[0] - # some special handling if shuffled + # some special handling if shuffled as we cannot use connected caves to take the smith up to death mountain if blacksmith_entrance.name == 'Hookshot Fairy': add_rule(world.get_location('Blacksmiths'), lambda state: state.has('Ocarina') and (state.has('Hammer') or state.has('Hookshot')))