More Swapped ER fixes
This commit is contained in:
@@ -289,6 +289,7 @@ def do_main_shuffle(entrances, exits, avail, mode_def):
|
|||||||
bomb_shop_options = [x for x in bomb_shop_options if x not in ['Spectacle Rock Cave', 'Spectacle Rock Cave (Bottom)']]
|
bomb_shop_options = [x for x in bomb_shop_options if x not in ['Spectacle Rock Cave', 'Spectacle Rock Cave (Bottom)']]
|
||||||
if avail.swapped and len(bomb_shop_options) > 1:
|
if avail.swapped and len(bomb_shop_options) > 1:
|
||||||
bomb_shop_options = [x for x in bomb_shop_options if x != 'Big Bomb Shop']
|
bomb_shop_options = [x for x in bomb_shop_options if x != 'Big Bomb Shop']
|
||||||
|
|
||||||
bomb_shop_choice = random.choice(bomb_shop_options)
|
bomb_shop_choice = random.choice(bomb_shop_options)
|
||||||
connect_entrance(bomb_shop_choice, bomb_shop, avail)
|
connect_entrance(bomb_shop_choice, bomb_shop, avail)
|
||||||
rem_entrances.remove(bomb_shop_choice)
|
rem_entrances.remove(bomb_shop_choice)
|
||||||
@@ -433,6 +434,8 @@ def do_blacksmith(entrances, exits, avail):
|
|||||||
if avail.swapped:
|
if avail.swapped:
|
||||||
blacksmith_options = [e for e in blacksmith_options if e not in Forbidden_Swap_Entrances]
|
blacksmith_options = [e for e in blacksmith_options if e not in Forbidden_Swap_Entrances]
|
||||||
blacksmith_options = [x for x in blacksmith_options if x in entrances]
|
blacksmith_options = [x for x in blacksmith_options if x in entrances]
|
||||||
|
|
||||||
|
assert len(blacksmith_options), 'No available entrances left to place Blacksmith'
|
||||||
blacksmith_choice = random.choice(blacksmith_options)
|
blacksmith_choice = random.choice(blacksmith_options)
|
||||||
connect_entrance(blacksmith_choice, 'Blacksmiths Hut', avail)
|
connect_entrance(blacksmith_choice, 'Blacksmiths Hut', avail)
|
||||||
entrances.remove(blacksmith_choice)
|
entrances.remove(blacksmith_choice)
|
||||||
@@ -563,6 +566,7 @@ def do_dark_sanc(entrances, exits, avail):
|
|||||||
choices = [e for e in avail.world.districts[avail.player]['Northwest Dark World'].entrances if e not in forbidden and e in entrances]
|
choices = [e for e in avail.world.districts[avail.player]['Northwest Dark World'].entrances if e not in forbidden and e in entrances]
|
||||||
else:
|
else:
|
||||||
choices = [e for e in get_starting_entrances(avail) if e not in forbidden and e in entrances]
|
choices = [e for e in get_starting_entrances(avail) if e not in forbidden and e in entrances]
|
||||||
|
|
||||||
choice = random.choice(choices)
|
choice = random.choice(choices)
|
||||||
entrances.remove(choice)
|
entrances.remove(choice)
|
||||||
exits.remove('Dark Sanctuary Hint')
|
exits.remove('Dark Sanctuary Hint')
|
||||||
@@ -596,6 +600,10 @@ def do_links_house(entrances, exits, avail, cross_world):
|
|||||||
if avail.inverted:
|
if avail.inverted:
|
||||||
dark_sanc_region = avail.world.get_entrance('Dark Sanctuary Hint Exit', avail.player).connected_region.name
|
dark_sanc_region = avail.world.get_entrance('Dark Sanctuary Hint Exit', avail.player).connected_region.name
|
||||||
forbidden.extend(get_nearby_entrances(avail, dark_sanc_region))
|
forbidden.extend(get_nearby_entrances(avail, dark_sanc_region))
|
||||||
|
else:
|
||||||
|
if (avail.world.doorShuffle[avail.player] != 'vanilla' and avail.world.intensity[avail.player] > 2
|
||||||
|
and not avail.world.is_tile_swapped(0x1b, avail.player)):
|
||||||
|
forbidden.append('Hyrule Castle Entrance (South)')
|
||||||
if avail.swapped:
|
if avail.swapped:
|
||||||
forbidden.append(links_house_vanilla)
|
forbidden.append(links_house_vanilla)
|
||||||
forbidden.extend(Forbidden_Swap_Entrances)
|
forbidden.extend(Forbidden_Swap_Entrances)
|
||||||
@@ -1381,13 +1389,17 @@ def do_mandatory_connections(avail, entrances, cave_options, must_exit):
|
|||||||
elif cave[-1] == 'Spectacle Rock Cave Exit': # Spectacle rock only has one exit
|
elif cave[-1] == 'Spectacle Rock Cave Exit': # Spectacle rock only has one exit
|
||||||
cave_entrances = []
|
cave_entrances = []
|
||||||
for cave_exit in rnd_cave[:-1]:
|
for cave_exit in rnd_cave[:-1]:
|
||||||
entrance = next(e for e in entrances[::-1] if e not in invalid_connections[exit] and e not in must_exit)
|
if avail.swapped and cave_exit not in avail.exits:
|
||||||
cave_entrances.append(entrance)
|
entrance = avail.world.get_entrance(cave_exit, avail.player).parent_region.entrances[0].name
|
||||||
entrances.remove(entrance)
|
cave_entrances.append(entrance)
|
||||||
connect_two_way(entrance, cave_exit, avail)
|
else:
|
||||||
if avail.swapped and combine_map[entrance] != cave_exit:
|
entrance = next(e for e in entrances[::-1] if e not in invalid_connections[exit] and e not in must_exit)
|
||||||
swap_ent, _ = connect_cave_swap(entrance, cave_exit, cave)
|
cave_entrances.append(entrance)
|
||||||
entrances.remove(swap_ent)
|
entrances.remove(entrance)
|
||||||
|
connect_two_way(entrance, cave_exit, avail)
|
||||||
|
if avail.swapped and combine_map[entrance] != cave_exit:
|
||||||
|
swap_ent, _ = connect_cave_swap(entrance, cave_exit, cave)
|
||||||
|
entrances.remove(swap_ent)
|
||||||
if entrance not in invalid_connections:
|
if entrance not in invalid_connections:
|
||||||
invalid_connections[exit] = set()
|
invalid_connections[exit] = set()
|
||||||
if all(entrance in invalid_connections for entrance in cave_entrances):
|
if all(entrance in invalid_connections for entrance in cave_entrances):
|
||||||
@@ -1408,13 +1420,16 @@ def do_mandatory_connections(avail, entrances, cave_options, must_exit):
|
|||||||
for cave in used_caves:
|
for cave in used_caves:
|
||||||
if cave in cave_options: # check if we placed multiple entrances from this 3 or 4 exit
|
if cave in cave_options: # check if we placed multiple entrances from this 3 or 4 exit
|
||||||
for cave_exit in cave:
|
for cave_exit in cave:
|
||||||
entrance = next(e for e in entrances[::-1] if e not in invalid_cave_connections[tuple(cave)])
|
if avail.swapped and cave_exit not in avail.exits:
|
||||||
invalid_cave_connections[tuple(cave)] = set()
|
continue
|
||||||
entrances.remove(entrance)
|
else:
|
||||||
connect_two_way(entrance, cave_exit, avail)
|
entrance = next(e for e in entrances[::-1] if e not in invalid_cave_connections[tuple(cave)])
|
||||||
if avail.swapped and combine_map[entrance] != cave_exit:
|
invalid_cave_connections[tuple(cave)] = set()
|
||||||
swap_ent, _ = connect_cave_swap(entrance, cave_exit, cave)
|
entrances.remove(entrance)
|
||||||
entrances.remove(swap_ent)
|
connect_two_way(entrance, cave_exit, avail)
|
||||||
|
if avail.swapped and combine_map[entrance] != cave_exit:
|
||||||
|
swap_ent, _ = connect_cave_swap(entrance, cave_exit, cave)
|
||||||
|
entrances.remove(swap_ent)
|
||||||
cave_options.remove(cave)
|
cave_options.remove(cave)
|
||||||
if avail.swapped:
|
if avail.swapped:
|
||||||
entrances.extend(swap_forbidden)
|
entrances.extend(swap_forbidden)
|
||||||
|
|||||||
Reference in New Issue
Block a user