From a5f585ce7cb02f798dba785108d1e2469c4dfe60 Mon Sep 17 00:00:00 2001 From: qadan Date: Sun, 9 Feb 2020 18:43:15 -0400 Subject: [PATCH] fix bunny logic --- OWGSets.py | 32 +++++++++++++++++++------------- Rules.py | 19 ++++++++++--------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/OWGSets.py b/OWGSets.py index 743c24a8..cda65592 100644 --- a/OWGSets.py +++ b/OWGSets.py @@ -13,8 +13,6 @@ def get_immediately_accessible_entrances(world, player): 'Zoras River', 'Capacity Upgrade', ] - if world.mode[player] != 'inverted': - entrances.append('Lake Hylia Island Mirror Spot') return entrances def get_lw_boots_accessible_entrances(world, player): @@ -54,20 +52,9 @@ def get_lw_boots_accessible_entrances(world, player): 'Floating Island Mirror Spot', ] if world.mode[player] != 'inverted': - entrances.append('Cave 45') - entrances.append('Graveyard Cave') entrances.append('Flute Spot 1') - entrances.append('Spectacle Rock Mirror Spot') entrances.append('Spectacle Rock Drop') entrances.append('Fairy Ascension Ledge') - entrances.append('Cave 45 Mirror Spot') - entrances.append('Graveyard Ledge Mirror Spot') - entrances.append('Desert Ledge (Northeast) Mirror Spot') - entrances.append('Desert Ledge Mirror Spot') - entrances.append('Desert Palace Entrance (North) Mirror Spot') - entrances.append('East Death Mountain (Top) Mirror Spot') - entrances.append('Spiral Cave Mirror Spot') - entrances.append('Fairy Ascension Mirror Spot') return entrances @@ -173,6 +160,23 @@ def get_dmd_non_bunny_regions(): ] +def get_boots_accessible_regions_lw(): + ''' + Light World regions that can be accessed using boots clips. + ''' + return [ + 'Desert Ledge (Northeast)', + 'Desert Ledge', + 'Desert Palace Entrance (North) Spot', + 'Cave 45 Ledge', + 'Graveyard Ledge', + 'Lake Hylia Island', + 'Death Mountain', + 'Death Mountain Return Ledge', + 'Bombos Tablet Ledge', + ] + + def get_mirror_hookshot_accessible_dw_locations(world, player): ''' Locations accessible potentially using weird mirror hookshot boots setups. @@ -261,4 +265,6 @@ def get_superbunny_accessible_locations(): 'Ice Rod Cave', 'Pyramid Fairy - Left', 'Pyramid Fairy - Right', + 'Superbunny Cave - Top', + 'Superbunny Cave - Bottom', ] diff --git a/Rules.py b/Rules.py index df35303b..2d38ba38 100644 --- a/Rules.py +++ b/Rules.py @@ -737,10 +737,13 @@ def overworld_glitches_rules(world, player): for location in OWGSets.get_dw_boots_accessible_locations(): add_rule(world.get_location(location, player), needs_boots_and_pearl if world.mode[player] != 'inverted' else needs_boots, 'or') - # Boots-accessible regions due to DMD. + # Boots-accessible regions. if world.mode[player] != 'inverted': + for boots_accessible_region in OWGSets.get_boots_accessible_regions_lw(): + region = world.get_region(boots_accessible_region, player) + region.can_reach_private = lambda state: region.can_reach(state) or needs_boots # DMD with and without bunny. - can_bunny_dmd = lambda state: world.get_region('Death Mountain').can_reach(state) and state.has_Mirror(player) + can_bunny_dmd = lambda state: world.get_region('Death Mountain', player).can_reach(state) and state.has_Mirror(player) for dmd_bunny_region in OWGSets.get_dmd_and_bunny_regions(): region = world.get_region(dmd_bunny_region, player) region.can_reach_private = lambda state: region.can_reach(state) or (needs_boots_and_pearl or can_bunny_dmd) @@ -778,14 +781,10 @@ def overworld_glitches_rules(world, player): # Regions that require the boots and some other stuff. if world.mode[player] != 'inverted': - set_rule(world.get_location('Bombos Tablet', player), lambda state: state.has('Book of Mudora', player) and state.has_beam_sword(player) and (state.has_Mirror(player) or state.has_Boots(player))) - set_rule(world.get_location('Ether Tablet', player), lambda state: state.has('Book of Mudora', player) and state.has_beam_sword(player) and (state.has_Mirror(player) or state.has_Boots(player))) set_rule(world.get_entrance('Dark Desert Teleporter', player), lambda state: state.has('Ocarina', player) or (state.has_Boots(player) and state.can_lift_heavy_rocks(player))) add_rule(world.get_entrance('Ganons Tower', player), lambda state: state.has_Boots(player) and state.has_Pearl(player), 'or') add_rule(world.get_entrance('East Death Mountain Teleporter', player), lambda state: state.can_lift_heavy_rocks(player) and state.has_Boots(player), 'or') add_rule(world.get_entrance('Turtle Rock Teleporter', player), lambda state: state.has_Boots(player) and state.has('Hammer', player), 'or') - add_rule(world.get_entrance('Checkerboard Cave', player), lambda state: state.has_Boots(player) and state.can_lift_rocks(player), 'or') - add_rule(world.get_entrance('South Hyrule Teleporter', player), lambda state: state.has_Boots(player) and state.can_lift_rocks(player), 'or') else: add_rule(world.get_entrance('South Dark World Teleporter', player), lambda state: state.has_Boots(player) and state.can_lift_rocks(player), 'or') @@ -1350,7 +1349,7 @@ def set_bunny_rules(world, player): return lambda state: any(rule(state) for rule in options) def get_rule_to_add(region, location = None): - if not region.is_light_world or not(world.logic[player] == 'owglitches' and location in OWGSets.get_superbunny_accessible_locations() and region.name not in invalid_mirror_bunny_entrances_dw): + if not region.is_light_world and not (world.logic[player] == 'owglitches' and location in OWGSets.get_superbunny_accessible_locations() and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_dw()): return lambda state: state.has_Pearl(player) # in this case we are mixed region. # we collect possible options. @@ -1378,8 +1377,7 @@ def set_bunny_rules(world, player): if world.logic[player] == 'owglitches' and entrance.name not in OWGSets.get_invalid_mirror_bunny_entrances_dw(): for location in entrance.connected_region.locations: if location.name in OWGSets.get_superbunny_accessible_locations(): - print(location.name) - possible_options.append(lambda state: state.can_reach(entrance) and all(rule(state) for rule in path) and state.has_Mirror(player)) + possible_options.append(lambda state: path_to_access_rule(new_path, entrance) and state.has_Mirror(player)) continue for exit in new_region.exits: if exit.name in dungeon_exits: @@ -1413,6 +1411,9 @@ def set_bunny_rules(world, player): if location.name in bunny_accessible_locations: continue + if world.logic[player] == 'owglitches' and location.parent_region.name not in OWGSets.get_invalid_mirror_bunny_entrances_dw() and location.name in OWGSets.get_superbunny_accessible_locations(): + add_rule(location, get_rule_to_add(location.parent_region, location.name)) + continue add_rule(location, get_rule_to_add(location.parent_region, location.name))