fixing bunny revival and other bunny things

This commit is contained in:
qadan 2020-02-18 20:28:33 -04:00
parent 43801e8110
commit 2b2b97d18a
2 changed files with 58 additions and 36 deletions

View File

@ -167,3 +167,13 @@ def get_mirror_clip_spots_lw():
'Death Mountain Bunny Descent Mirror Spot', 'Death Mountain Bunny Descent Mirror Spot',
'Death Mountain Offset Mirror', 'Death Mountain Offset Mirror',
] ]
def get_invalid_bunny_revival_dungeons():
'''
Dungeon regions that can't be bunny revived from.
'''
return [
'Tower of Hera (Bottom)',
'Swamp Palace (Entrance)',
]

View File

@ -1339,15 +1339,14 @@ def set_bunny_rules(world, player):
def options_to_access_rule(options): def options_to_access_rule(options):
return lambda state: any(rule(state) for rule in options) return lambda state: any(rule(state) for rule in options)
def get_rule_to_add(region, location = None): def get_rule_to_add(region, location = None, connecting_entrance = None):
if world.logic[player] == 'owglitches': if world.logic[player] == 'owglitches' and connecting_entrance != None:
if region.name == 'Tower of Hera (Bottom)' and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_dw(): if region.name == 'Tower of Hera (Bottom)' and connecting_entrance.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) 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(): if region.name == 'Turtle Rock (Entrance)' and connecting_entrance.name not in OWGSets.get_invalid_mirror_bunny_entrances_dw():
return lambda state: state.has_Mirror(player) or state.has_Pearl(player) return lambda state: state.has_Mirror(player) or state.has_Pearl(player)
if not any([ if not any([
location in OWGSets.get_superbunny_accessible_locations() and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_dw(), location != None and location.name in OWGSets.get_superbunny_accessible_locations() and connecting_entrance.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]): not region.is_dark_world]):
return lambda state: state.has_Pearl(player) return lambda state: state.has_Pearl(player)
else: else:
@ -1405,16 +1404,24 @@ def set_bunny_rules(world, player):
add_rule(paradox_shop.entrances[0], get_rule_to_add(paradox_shop)) add_rule(paradox_shop.entrances[0], get_rule_to_add(paradox_shop))
# Add requirements for all locations that are actually in the dark world, except those available to the bunny, including dungeon revival # Add requirements for all locations that are actually in the dark world, except those available to the bunny, including dungeon revival
for location in world.get_locations(): for entrance in world.get_entrances():
if location.player == player and location.parent_region.is_dark_world: if entrance.player == player and entrance.parent_region.is_dark_world:
if world.logic[player] == 'owglitches':
if location.name in bunny_accessible_locations: if entrance.connected_region.type == RegionType.Dungeon:
continue if entrance.connected_region.name in OWGSets.get_invalid_bunny_revival_dungeons():
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(entrance, get_rule_to_add(entrance.connected_region, None, entrance))
add_rule(location, get_rule_to_add(location.parent_region, location.name)) continue
continue if entrance.connected_region.name == 'Turtle Rock (Entrance)':
add_rule(world.get_entrance('Turtle Rock Entrance Gap', player), get_rule_to_add(entrance.connected_region, None, entrance))
add_rule(location, get_rule_to_add(location.parent_region, location.name)) if entrance.name in OWGSets.get_invalid_mirror_bunny_entrances_dw():
continue
for location in entrance.connected_region.locations:
if world.logic[player] == 'owglitches' and entrance.name in OWGSets.get_invalid_mirror_bunny_entrances_dw():
add_rule(location, get_rule_to_add(entrance.connected_region, location, entrance))
continue
if location.name in bunny_accessible_locations:
continue
add_rule(location, get_rule_to_add(entrance.connected_region, location))
def set_inverted_bunny_rules(world, player): def set_inverted_bunny_rules(world, player):
# regions for the exits of multi-entrace caves/drops that bunny cannot pass # regions for the exits of multi-entrace caves/drops that bunny cannot pass
@ -1429,19 +1436,18 @@ def set_inverted_bunny_rules(world, player):
def options_to_access_rule(options): def options_to_access_rule(options):
return lambda state: any(rule(state) for rule in options) return lambda state: any(rule(state) for rule in options)
def get_rule_to_add(region, location = None): def get_rule_to_add(region, location = None, connecting_entrance = None):
if world.logic[player] == 'owglitches': if world.logic[player] == 'owglitches' and connecting_entrance != None:
if region.name == 'Tower of Hera (Bottom)' and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_lw(): if region.name == 'Tower of Hera (Bottom)' and connecting_entrance.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) 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(): if region.name == 'Turtle Rock (Entrance)' and connecting_entrance.name not in OWGSets.get_invalid_mirror_bunny_entrances_lw():
return lambda state: state.has_Mirror(player) or state.has_Pearl(player) return lambda state: state.has_Mirror(player) or state.has_Pearl(player)
if not any([ if not any([
location in OWGSets.get_superbunny_accessible_locations() and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_lw(), location != None and location.name in OWGSets.get_superbunny_accessible_locations() and connecting_entrance.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]):
not region.is_dark_world]):
return lambda state: state.has_Pearl(player) return lambda state: state.has_Pearl(player)
else: else:
if not region.is_dark_world: if not region.is_light_world:
return lambda state: state.has_Pearl(player) return lambda state: state.has_Pearl(player)
# in this case we are mixed region. # in this case we are mixed region.
# we collect possible options. # we collect possible options.
@ -1494,15 +1500,21 @@ def set_inverted_bunny_rules(world, player):
add_rule(paradox_shop.entrances[0], get_rule_to_add(paradox_shop)) add_rule(paradox_shop.entrances[0], get_rule_to_add(paradox_shop))
# Add requirements for all locations that are actually in the light world, except those available to the bunny, including dungeon revival # Add requirements for all locations that are actually in the light world, except those available to the bunny, including dungeon revival
for location in world.get_locations(): for entrance in world.get_entrances():
if location.player == player and location.parent_region.is_light_world: if entrance.player == player and entrance.parent_region.is_light_world:
if world.logic[player] == 'owglitches':
if location.name in bunny_accessible_locations: if entrance.connected_region.type == RegionType.Dungeon:
continue if entrance.connected_region.name in OWGSets.get_invalid_bunny_revival_dungeons():
if world.logic[player] == 'owglitches' and location.parent_region.name not in OWGSets.get_invalid_mirror_bunny_entrances_lw() and location.name in OWGSets.get_superbunny_accessible_locations(): add_rule(entrance, get_rule_to_add(entrance.connected_region, None, entrance))
add_rule(location, get_rule_to_add(location.parent_region, location.name)) continue
continue if entrance.connected_region.name == 'Turtle Rock (Entrance)':
add_rule(world.get_entrance('Turtle Rock Entrance Gap', player), get_rule_to_add(entrance.connected_region, None, entrance))
add_rule(location, get_rule_to_add(location.parent_region, location.name)) if entrance.name in OWGSets.get_invalid_mirror_bunny_entrances_lw():
continue
for location in entrance.connected_region.locations:
if world.logic[player] == 'owglitches' and entrance.name in OWGSets.get_invalid_mirror_bunny_entrances_lw():
add_rule(location, get_rule_to_add(entrance.connected_region, location, entrance))
continue
if location.name in bunny_accessible_locations:
continue
add_rule(location, get_rule_to_add(entrance.connected_region, location))