From 3d021356b8fb3b437064fa01d203c4955624fe8a Mon Sep 17 00:00:00 2001 From: qadan Date: Wed, 12 Feb 2020 19:48:36 -0400 Subject: [PATCH] hera and tr superbunny logic --- BaseClasses.py | 3 +++ Rules.py | 43 +++++++++++++++++++++++++++---------------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index 4d80b0ed..2f8ff5ba 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -552,6 +552,9 @@ class CollectionState(object): rules.append(self.has_Pearl(player)) return all(rules) + def can_superbunny_mirror_with_sword(self, player): + return self.has_Mirror(player) and self.has_sword(player) + def can_get_glitched_speed_dw(self, player): rules = [self.has_Boots(player), any([self.has('Hookshot', player), self.has_sword(player)])] if self.world.mode[player] != 'inverted': diff --git a/Rules.py b/Rules.py index 7fc6199f..197cb3e4 100644 --- a/Rules.py +++ b/Rules.py @@ -767,13 +767,12 @@ def overworld_glitches_rules(world, player): set_rule(world.get_entrance(clip_spot, player), lambda state: state.has_Mirror(player)) # Locations that you can superbunny mirror into, but need a sword to clear. - superbunny_mirror_weapon = lambda state: state.has_Mirror(player) and state.has_sword(player) mini_moldorm_cave = world.get_region('Mini Moldorm Cave', player) for superbunny_mirror_weapon_region in OWGSets.get_sword_required_superbunny_mirror_regions(): region = world.get_region(superbunny_mirror_weapon_region, player) if check_is_dark_world(region): for spot in region.locations: - add_rule(world.get_location(spot, player), superbunny_mirror_weapon, 'or') + add_rule(world.get_location(spot, player), lambda state: state.can_superbunny_mirror_with_sword(player), 'or') # Regions that require the boots and some other stuff. if world.mode[player] != 'inverted': @@ -1341,13 +1340,19 @@ 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 world.logic[player] == 'owglitches' and not any([ - location in OWGSets.get_superbunny_accessible_locations() and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_dw(), - region.type == RegionType.Dungeon and region.name != 'Swamp Palace (Entrance)', - not region.is_light_world]): - return lambda state: state.has_Pearl(player) - elif world.logic[player] != 'owglitches' and not region.is_light_world: - return lambda state: state.has_Pearl(player) + if world.logic['player'] == 'owglitches': + if region.name == 'Tower of Hera (Bottom)' and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_dw(): + return lambda state: state.can_superbunny_mirror_with_sword(player) or state.has_Pearl(player) + if region.name == 'Turtle Rock (Entrance)' and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_dw(): + return lambda state: state.has_Mirror(player) or state.has_Pearl(player) + if not any([ + location in OWGSets.get_superbunny_accessible_locations() and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_dw(), + region.type == RegionType.Dungeon and region.name != 'Swamp Palace (Entrance)', + not region.is_dark_world]): + return lambda state: state.has_Pearl(player) + else: + if not region.is_dark_world: + return lambda state: state.has_Pearl(player) # in this case we are mixed region. # we collect possible options. @@ -1425,13 +1430,19 @@ def set_inverted_bunny_rules(world, player): return lambda state: any(rule(state) for rule in options) def get_rule_to_add(region, location = None): - if world.logic[player] == 'owglitches' and not any([ - location in OWGSets.get_superbunny_accessible_locations() and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_dw(), - region.type == RegionType.Dungeon and region.name != 'Swamp Palace (Entrance)', - not region.is_dark_world]): - return lambda state: state.has_Pearl(player) - elif world.logic[player] != 'owglitches' and not region.is_dark_world: - return lambda state: state.has_Pearl(player) + if world.logic['player'] == 'owglitches': + if region.name == 'Tower of Hera (Bottom)' and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_lw(): + return lambda state: state.can_superbunny_mirror_with_sword(player) or state.has_Pearl(player) + if region.name == 'Turtle Rock (Entrance)' and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_lw(): + return lambda state: state.has_Mirror(player) or state.has_Pearl(player) + if not any([ + location in OWGSets.get_superbunny_accessible_locations() and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_lw(), + region.type == RegionType.Dungeon and region.name != 'Swamp Palace (Entrance)', + not region.is_dark_world]): + return lambda state: state.has_Pearl(player) + else: + if not region.is_dark_world: + return lambda state: state.has_Pearl(player) # in this case we are mixed region. # we collect possible options.