diff --git a/DoorShuffle.py b/DoorShuffle.py index ca60be21..91ac070b 100644 --- a/DoorShuffle.py +++ b/DoorShuffle.py @@ -1833,8 +1833,8 @@ def find_inaccessible_regions(world, player): queue.append(connect) world.inaccessible_regions[player].extend([r.name for r in all_regions.difference(visited_regions) if valid_inaccessible_region(r)]) if (world.mode[player] == 'inverted') != (0x1b in world.owswaps[player][0] and world.owMixed[player]): - ledge = world.get_region('Hyrule Castle Ledge', 1) - if any(x for x in ledge.exits if x.connected_region.name == 'Agahnims Tower Portal'): + ledge = world.get_region('Hyrule Castle Ledge', player) + if any(x for x in ledge.exits if x.connected_region and x.connected_region.name == 'Agahnims Tower Portal'): world.inaccessible_regions[player].append('Hyrule Castle Ledge') logger = logging.getLogger('') logger.debug('Inaccessible Regions:') diff --git a/OverworldShuffle.py b/OverworldShuffle.py index 2ccab7aa..75679891 100644 --- a/OverworldShuffle.py +++ b/OverworldShuffle.py @@ -279,7 +279,7 @@ def link_overworld(world, player): region = world.get_region(regionname, player) for exit in region.exits: if exit.connected_region is not None and exit.connected_region.type in [RegionType.LightWorld, RegionType.DarkWorld] and exit.connected_region.name not in new_ignored: - if OWTileRegions[exit.connected_region.name] in [base_owid, owid] or OWTileRegions[regionname] == base_owid: + if exit.connected_region.name in OWTileRegions and (OWTileRegions[exit.connected_region.name] in [base_owid, owid] or OWTileRegions[regionname] == base_owid): new_ignored.add(exit.connected_region.name) getIgnored(exit.connected_region.name, base_owid, OWTileRegions[exit.connected_region.name]) diff --git a/Regions.py b/Regions.py index 556971f8..26b3aeb7 100644 --- a/Regions.py +++ b/Regions.py @@ -82,7 +82,7 @@ def create_regions(world, player): create_lw_region(player, 'Links House Area', None, ['Links House', 'Big Bomb Shop Mirror Spot', 'Links House NE', 'Links House WN', 'Links House WC', 'Links House WS', 'Links House SC', 'Links House ES']), create_lw_region(player, 'Stone Bridge Area', None, ['Hammer Bridge North Mirror Spot', 'Hammer Bridge South Mirror Spot', 'Stone Bridge NC', 'Stone Bridge EN', 'Stone Bridge WS', 'Stone Bridge SC']), create_lw_region(player, 'Stone Bridge Water', None, ['Dark Hobo Mirror Spot', 'Stone Bridge WC', 'Stone Bridge EC'], Terrain.Water), - create_lw_region(player, 'Hobo Bridge', ['Hobo'], ['Hobo EC']), + create_lw_region(player, 'Hobo Bridge', ['Hobo'], ['Hobo EC'], Terrain.Water), create_lw_region(player, 'Central Cliffs', None, ['Central Bonk Rocks Cliff Ledge Drop', 'Links House Cliff Ledge Drop', 'Stone Bridge Cliff Ledge Drop', 'Lake Hylia Area Cliff Ledge Drop', 'Lake Hylia Island FAWT Ledge Drop', 'Stone Bridge EC Cliff Water Drop', 'Tree Line WC Cliff Water Drop', 'C Whirlpool Outer Cliff Ledge Drop', 'C Whirlpool Cliff Ledge Drop', 'South Teleporter Cliff Ledge Drop', 'Statues Cliff Ledge Drop']), create_lw_region(player, 'Tree Line Area', None, ['Lake Hylia Fairy', 'Dark Tree Line Mirror Spot', 'Tree Line WN', 'Tree Line NW', 'Tree Line SE']), create_lw_region(player, 'Tree Line Water', None, ['Tree Line WC', 'Tree Line SC'], Terrain.Water), diff --git a/Rom.py b/Rom.py index e494d8c4..074ec8fc 100644 --- a/Rom.py +++ b/Rom.py @@ -2500,7 +2500,7 @@ def set_inverted_mode(world, player, rom, inverted_buffer): write_int16(rom, snes_to_pc(0x02D9B0), 0x0007) rom.write_byte(snes_to_pc(0x02D9B8), 0x12) - rom.write_bytes(0x180247, [0x00, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00]) #indicates the overworld door being used for the single entrance spawn point + rom.write_bytes(0x180247, [0x00, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00]) # indicates the overworld door being used for the single entrance spawn point if (world.mode[player] == 'inverted') != (0x05 in world.owswaps[player][0] and world.owMixed[player]): rom.write_bytes(snes_to_pc(0x1BC655), [0x4A, 0x1D, 0x82]) # add warp under rock if (world.mode[player] == 'inverted') != (0x07 in world.owswaps[player][0] and world.owMixed[player]): diff --git a/Rules.py b/Rules.py index 2dc4df99..a99fc196 100644 --- a/Rules.py +++ b/Rules.py @@ -106,14 +106,15 @@ def mirrorless_path_to_castle_courtyard(world, player): queue = collections.deque([(start.connected_region, [])]) while queue: (current, path) = queue.popleft() - for entrance in current.exits: - if entrance.connected_region not in seen: - new_path = path + [entrance.access_rule] - if entrance.connected_region == target: - return new_path - else: - queue.append((entrance.connected_region, new_path)) - seen.add(entrance.connected_region) + if current: + for entrance in current.exits: + if entrance.connected_region not in seen: + new_path = path + [entrance.access_rule] + if entrance.connected_region == target: + return new_path + else: + queue.append((entrance.connected_region, new_path)) + seen.add(entrance.connected_region) def set_rule(spot, rule): spot.access_rule = rule @@ -1863,7 +1864,7 @@ def set_big_bomb_rules(world, player): add_rule(world.get_entrance('Pyramid Fairy', player), lambda state: (state.has('Flippers', player) or state.can_flute(player))) #TODO: Fix red bomb rules, artifically adding a bunch of rules to help reduce unbeatable seeds in OW shuffle - add_rule(world.get_entrance('Pyramid Fairy', player), lambda state: False) + set_rule(world.get_entrance('Pyramid Fairy', player), lambda state: False) #add_rule(world.get_entrance('Pyramid Fairy', player), lambda state: state.can_reach('Pyramid Area', 'Region', player)) #add_rule(world.get_entrance('Pyramid Fairy', player), lambda state: (state.can_lift_heavy_rocks(player) and state.has('Flippers', player) and state.can_flute(player) and state.has('Hammer', player) and state.has('Hookshot', player) and state.has_Pearl(player) and state.has_Mirror(player))) @@ -2061,7 +2062,7 @@ def set_inverted_big_bomb_rules(world, player): raise Exception('No logic found for routing from %s to the pyramid.' % bombshop_entrance.name) if world.owShuffle[player] != 'vanilla' or world.owMixed[player] or world.owCrossed[player] != 'none': - add_rule(world.get_entrance('Pyramid Fairy', player), lambda state: False) #temp disable progression until routing to Pyramid get be guaranteed + set_rule(world.get_entrance('Pyramid Fairy', player), lambda state: False) #temp disable progression until routing to Pyramid get be guaranteed def set_bunny_rules(world, player, inverted): @@ -2200,7 +2201,7 @@ def set_bunny_rules(world, player, inverted): for ent_name in bunny_impassible_doors: bunny_exit = world.get_entrance(ent_name, player) - if is_bunny(bunny_exit.parent_region): + if bunny_exit.connected_region and is_bunny(bunny_exit.parent_region): add_rule(bunny_exit, get_rule_to_add(bunny_exit.parent_region)) doors_to_check = [x for x in world.doors if x.player == player and x not in bunny_impassible_doors]