fixing bunny revival, and other bunny stuff

This commit is contained in:
qadan
2020-02-18 20:22:33 -04:00
parent f8b6af472b
commit 0ed41f6b13
2 changed files with 58 additions and 35 deletions

View File

@@ -165,3 +165,13 @@ def get_mirror_clip_spots_lw():
'Death Mountain Bunny Descent Mirror Spot',
'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

@@ -1572,17 +1572,16 @@ def set_bunny_rules(world, player):
def options_to_access_rule(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):
# In OWG, a location can potentially be superbunny-mirror accessible or
# bunny revival accessible.
if world.logic == 'owglitches':
if region.name == 'Tower of Hera (Bottom)' and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_dw():
if world.logic == 'owglitches' and connecting_entrance != None:
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)
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)
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)',
location != None and location.name in OWGSets.get_superbunny_accessible_locations() and connecting_entrance.name not in OWGSets.get_invalid_mirror_bunny_entrances_dw(),
not region.is_dark_world]):
return lambda state: state.has_Pearl(player)
else:
@@ -1638,17 +1637,24 @@ def set_bunny_rules(world, player):
if paradox_shop.is_dark_world:
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
for location in world.get_locations():
if location.player == player and location.parent_region.is_dark_world:
if location.name in bunny_accessible_locations:
continue
if world.logic == '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))
for entrance in world.get_entrances():
if entrance.player == player and entrance.parent_region.is_dark_world:
if world.logic == 'owglitches':
if entrance.connected_region.type == RegionType.Dungeon:
if entrance.connected_region.name in OWGSets.get_invalid_bunny_revival_dungeons():
add_rule(entrance, get_rule_to_add(entrance.connected_region, None, entrance))
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))
if entrance.name in OWGSets.get_invalid_mirror_bunny_entrances_dw():
continue
for location in entrance.connected_region.locations:
if world.logic == '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):
@@ -1666,21 +1672,20 @@ def set_inverted_bunny_rules(world, player):
def options_to_access_rule(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):
# In OWG, a location can potentially be superbunny-mirror accessible or
# bunny revival accessible.
if world.logic == 'owglitches':
if region.name == 'Tower of Hera (Bottom)' and region.name not in OWGSets.get_invalid_mirror_bunny_entrances_lw():
if world.logic == 'owglitches' and connecting_entrance != None:
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)
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)
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]):
location != None and location.name in OWGSets.get_superbunny_accessible_locations() and connecting_entrance.name not in OWGSets.get_invalid_mirror_bunny_entrances_dw(),
not region.is_light_world]):
return lambda state: state.has_Pearl(player)
else:
if not region.is_dark_world:
if not region.is_light_world:
return lambda state: state.has_Pearl(player)
# in this case we are mixed region.
# we collect possible options.
@@ -1733,15 +1738,23 @@ def set_inverted_bunny_rules(world, player):
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
for location in world.get_locations():
if location.player == player and location.parent_region.is_light_world:
if location.name in bunny_accessible_locations:
continue
if world.logic == '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(location, get_rule_to_add(location.parent_region, location.name))
continue
add_rule(location, get_rule_to_add(location.parent_region, location.name))
for entrance in world.get_entrances():
if entrance.player == player and entrance.parent_region.is_light_world:
if world.logic == 'owglitches':
if entrance.connected_region.type == RegionType.Dungeon:
if entrance.connected_region.name in OWGSets.get_invalid_bunny_revival_dungeons():
add_rule(entrance, get_rule_to_add(entrance.connected_region, None, entrance))
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))
if entrance.name in OWGSets.get_invalid_mirror_bunny_entrances_lw():
continue
for location in entrance.connected_region.locations:
if world.logic == '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))