Efficiency improvement of ER

This commit is contained in:
codemann8
2021-10-26 13:52:32 -05:00
parent 84793d784a
commit 92e272e617

View File

@@ -1662,20 +1662,21 @@ def build_accessible_region_list(world, start_region, player, build_copy_world=F
from Main import copy_world from Main import copy_world
from Items import ItemFactory from Items import ItemFactory
def explore_region(region_name): def explore_region(region_name, region=None):
explored_regions.add(region_name) explored_regions.add(region_name)
region = base_world.get_region(region_name, player) if not region:
region = base_world.get_region(region_name, player)
for exit in region.exits: for exit in region.exits:
if exit.connected_region is not None: if exit.connected_region is not None:
if any(map(lambda i: i.name == 'Ocarina', base_world.precollected_items)) and exit.spot_type == 'Flute': if any(map(lambda i: i.name == 'Ocarina', base_world.precollected_items)) and exit.spot_type == 'Flute':
fluteregion = exit.connected_region fluteregion = exit.connected_region
for flutespot in fluteregion.exits: for flutespot in fluteregion.exits:
if flutespot.connected_region and flutespot.connected_region.name not in explored_regions: if flutespot.connected_region and flutespot.connected_region.name not in explored_regions:
explore_region(flutespot.connected_region.name) explore_region(flutespot.connected_region.name, flutespot.connected_region)
elif exit.connected_region.name not in explored_regions \ elif exit.connected_region.name not in explored_regions \
and (exit.connected_region.type == region.type or (cross_world and exit.connected_region.type in [RegionType.LightWorld, RegionType.DarkWorld])) \ and (exit.connected_region.type == region.type or (cross_world and exit.connected_region.type in [RegionType.LightWorld, RegionType.DarkWorld])) \
and (not region_rules or exit.access_rule(blank_state)) and (not ignore_ledges or exit.spot_type != 'Ledge'): and (not region_rules or exit.access_rule(blank_state)) and (not ignore_ledges or exit.spot_type != 'Ledge'):
explore_region(exit.connected_region.name) explore_region(exit.connected_region.name, exit.connected_region)
if build_copy_world: if build_copy_world:
for player in range(1, world.players + 1): for player in range(1, world.players + 1):