Merge remote-tracking branch 'origin/OverworldShuffle' into OverworldShuffle

This commit is contained in:
2021-07-17 12:31:35 -07:00
22 changed files with 689 additions and 566 deletions

View File

@@ -28,123 +28,124 @@ def link_entrances(world, player):
connect_custom(world, player)
# if we do not shuffle, set default connections
if world.shuffle[player] == 'vanilla':
if world.shuffle[player] in ['vanilla', 'dungeonssimple', 'dungeonsfull']:
for exitname, regionname in default_connections:
connect_simple(world, exitname, regionname, player)
for exitname, regionname in default_dungeon_connections:
connect_simple(world, exitname, regionname, player)
if world.shuffle[player] == 'vanilla':
for exitname, regionname in default_dungeon_connections:
connect_simple(world, exitname, regionname, player)
if not invFlag:
for exitname, regionname in open_default_connections:
connect_simple(world, exitname, regionname, player)
for exitname, regionname in open_default_dungeon_connections:
connect_simple(world, exitname, regionname, player)
if world.shuffle[player] == 'vanilla':
for exitname, regionname in open_default_dungeon_connections:
connect_simple(world, exitname, regionname, player)
else:
for exitname, regionname in inverted_default_connections:
connect_simple(world, exitname, regionname, player)
for exitname, regionname in inverted_default_dungeon_connections:
connect_simple(world, exitname, regionname, player)
elif world.shuffle[player] == 'dungeonssimple':
for exitname, regionname in default_connections:
connect_simple(world, exitname, regionname, player)
if world.shuffle[player] == 'vanilla':
for exitname, regionname in inverted_default_dungeon_connections:
connect_simple(world, exitname, regionname, player)
# inverted entrance mods
for owid in swapped_connections.keys():
if (world.mode[player] == 'inverted') != (owid in world.owswaps[player][0] and world.owSwap[player] == 'mixed'):
for (entrancename, exitname) in swapped_connections[owid]:
try:
connect_two_way(world, entrancename, exitname, player)
except RuntimeError:
connect_entrance(world, entrancename, exitname, player)
if not invFlag:
for exitname, regionname in open_default_connections:
connect_simple(world, exitname, regionname, player)
else:
for exitname, regionname in inverted_default_connections:
connect_simple(world, exitname, regionname, player)
simple_shuffle_dungeons(world, player)
elif world.shuffle[player] == 'dungeonsfull':
for exitname, regionname in default_connections:
connect_simple(world, exitname, regionname, player)
if not invFlag:
for exitname, regionname in open_default_connections:
connect_simple(world, exitname, regionname, player)
else:
for exitname, regionname in inverted_default_connections:
connect_simple(world, exitname, regionname, player)
if (world.mode[player] == 'inverted') != (0x03 in world.owswaps[player][0] and world.owSwap[player] == 'mixed') and \
(world.mode[player] == 'inverted') == (0x0a in world.owswaps[player][0] and world.owSwap[player] == 'mixed'):
connect_entrance(world, 'Death Mountain Return Cave (West)', 'Dark Death Mountain Healer Fairy', player)
elif (world.mode[player] == 'inverted') != (0x0a in world.owswaps[player][0] and world.owSwap[player] == 'mixed') and \
(world.mode[player] == 'inverted') == (0x03 in world.owswaps[player][0] and world.owSwap[player] == 'mixed'):
connect_two_way(world, 'Bumper Cave (Top)', 'Death Mountain Return Cave Exit (West)', player)
skull_woods_shuffle(world, player)
# dungeon entrance shuffle
if world.shuffle[player] == 'dungeonssimple':
simple_shuffle_dungeons(world, player)
elif world.shuffle[player] == 'dungeonsfull':
skull_woods_shuffle(world, player)
dungeon_exits = list(Dungeon_Exits)
lw_entrances = list(LW_Dungeon_Entrances) if not invFlag else list(Inverted_LW_Dungeon_Entrances_Must_Exit)
dw_entrances = list(DW_Dungeon_Entrances) if not invFlag else list(Inverted_DW_Dungeon_Entrances)
dungeon_exits = list(Dungeon_Exits)
lw_entrances = list(LW_Dungeon_Entrances) if not invFlag else list(Inverted_LW_Dungeon_Entrances_Must_Exit)
dw_entrances = list(DW_Dungeon_Entrances) if not invFlag else list(Inverted_DW_Dungeon_Entrances)
if world.mode[player] != 'standard':
lw_entrances.append('Hyrule Castle Entrance (South)')
if not invFlag:
if world.mode[player] == 'standard':
# must connect front of hyrule castle to do escape
connect_two_way(world, 'Hyrule Castle Entrance (South)', 'Hyrule Castle Exit (South)', player)
elif world.doorShuffle[player] == 'vanilla':
dungeon_exits.append(('Hyrule Castle Exit (South)', 'Hyrule Castle Exit (West)', 'Hyrule Castle Exit (East)'))
else:
lw_dungeon_entrances_must_exit = list(Inverted_LW_Dungeon_Entrances_Must_Exit)
# randomize which desert ledge door is a must-exit
if random.randint(0, 1) == 0:
lw_dungeon_entrances_must_exit.append('Desert Palace Entrance (North)')
lw_entrances.append('Desert Palace Entrance (West)')
else:
lw_dungeon_entrances_must_exit.append('Desert Palace Entrance (West)')
lw_entrances.append('Desert Palace Entrance (North)')
dungeon_exits.append(('Hyrule Castle Exit (South)', 'Hyrule Castle Exit (West)', 'Hyrule Castle Exit (East)'))
if not world.shuffle_ganon:
connect_two_way(world, 'Ganons Tower' if not invFlag else 'Agahnims Tower', 'Ganons Tower Exit', player)
hc_ledge_entrances = ['Hyrule Castle Entrance (West)', 'Hyrule Castle Entrance (East)']
else:
if not invFlag:
dw_entrances.append('Ganons Tower')
else:
lw_entrances.append('Agahnims Tower')
dungeon_exits.append('Ganons Tower Exit')
hc_ledge_entrances = ['Hyrule Castle Entrance (West)', 'Hyrule Castle Entrance (East)', 'Agahnims Tower']
if not invFlag:
if world.mode[player] == 'standard':
# rest of hyrule castle must be in light world, so it has to be the one connected to east exit of desert
hyrule_castle_exits = [('Hyrule Castle Exit (West)', 'Hyrule Castle Exit (East)')]
connect_mandatory_exits(world, lw_entrances, hyrule_castle_exits, list(LW_Dungeon_Entrances_Must_Exit), player)
connect_caves(world, lw_entrances, [], hyrule_castle_exits, player)
elif world.doorShuffle[player] != 'vanilla':
# sanc is in light world, so must all of HC if door shuffle is on
connect_mandatory_exits(world, lw_entrances,
[('Hyrule Castle Exit (West)', 'Hyrule Castle Exit (East)', 'Hyrule Castle Exit (South)')],
list(LW_Dungeon_Entrances_Must_Exit), player)
else:
connect_mandatory_exits(world, lw_entrances, dungeon_exits, list(LW_Dungeon_Entrances_Must_Exit), player)
connect_mandatory_exits(world, dw_entrances, dungeon_exits, list(DW_Dungeon_Entrances_Must_Exit), player)
else:
# shuffle aga door first. If it's on HC ledge, remaining HC ledge door must be must-exit
all_entrances_aga = lw_entrances + dw_entrances
aga_doors = [i for i in all_entrances_aga]
random.shuffle(aga_doors)
aga_door = aga_doors.pop()
if world.mode[player] != 'standard':
lw_entrances.append('Hyrule Castle Entrance (South)')
if aga_door in hc_ledge_entrances:
lw_entrances.remove(aga_door)
hc_ledge_entrances.remove(aga_door)
if not invFlag:
if world.mode[player] == 'standard':
# must connect front of hyrule castle to do escape
connect_two_way(world, 'Hyrule Castle Entrance (South)', 'Hyrule Castle Exit (South)', player)
elif world.doorShuffle[player] == 'vanilla':
dungeon_exits.append(('Hyrule Castle Exit (South)', 'Hyrule Castle Exit (West)', 'Hyrule Castle Exit (East)'))
else:
lw_dungeon_entrances_must_exit = list(Inverted_LW_Dungeon_Entrances_Must_Exit)
# randomize which desert ledge door is a must-exit
if random.randint(0, 1) == 0:
lw_dungeon_entrances_must_exit.append('Desert Palace Entrance (North)')
lw_entrances.append('Desert Palace Entrance (West)')
else:
lw_dungeon_entrances_must_exit.append('Desert Palace Entrance (West)')
lw_entrances.append('Desert Palace Entrance (North)')
dungeon_exits.append(('Hyrule Castle Exit (South)', 'Hyrule Castle Exit (West)', 'Hyrule Castle Exit (East)'))
if not world.shuffle_ganon:
connect_two_way(world, 'Ganons Tower' if not invFlag else 'Agahnims Tower', 'Ganons Tower Exit', player)
hc_ledge_entrances = ['Hyrule Castle Entrance (West)', 'Hyrule Castle Entrance (East)']
else:
if not invFlag:
dw_entrances.append('Ganons Tower')
else:
lw_entrances.append('Agahnims Tower')
dungeon_exits.append('Ganons Tower Exit')
hc_ledge_entrances = ['Hyrule Castle Entrance (West)', 'Hyrule Castle Entrance (East)', 'Agahnims Tower']
if not invFlag:
if world.mode[player] == 'standard':
# rest of hyrule castle must be in light world, so it has to be the one connected to east exit of desert
hyrule_castle_exits = [('Hyrule Castle Exit (West)', 'Hyrule Castle Exit (East)')]
connect_mandatory_exits(world, lw_entrances, hyrule_castle_exits, list(LW_Dungeon_Entrances_Must_Exit), player)
connect_caves(world, lw_entrances, [], hyrule_castle_exits, player)
elif world.doorShuffle[player] != 'vanilla':
# sanc is in light world, so must all of HC if door shuffle is on
connect_mandatory_exits(world, lw_entrances,
[('Hyrule Castle Exit (West)', 'Hyrule Castle Exit (East)', 'Hyrule Castle Exit (South)')],
list(LW_Dungeon_Entrances_Must_Exit), player)
else:
connect_mandatory_exits(world, lw_entrances, dungeon_exits, list(LW_Dungeon_Entrances_Must_Exit), player)
connect_mandatory_exits(world, dw_entrances, dungeon_exits, list(DW_Dungeon_Entrances_Must_Exit), player)
else:
# shuffle aga door first. If it's on HC ledge, remaining HC ledge door must be must-exit
all_entrances_aga = lw_entrances + dw_entrances
aga_doors = [i for i in all_entrances_aga]
random.shuffle(aga_doors)
aga_door = aga_doors.pop()
random.shuffle(hc_ledge_entrances)
hc_ledge_must_exit = hc_ledge_entrances.pop()
lw_entrances.remove(hc_ledge_must_exit)
lw_dungeon_entrances_must_exit.append(hc_ledge_must_exit)
if aga_door in hc_ledge_entrances:
lw_entrances.remove(aga_door)
hc_ledge_entrances.remove(aga_door)
random.shuffle(hc_ledge_entrances)
hc_ledge_must_exit = hc_ledge_entrances.pop()
lw_entrances.remove(hc_ledge_must_exit)
lw_dungeon_entrances_must_exit.append(hc_ledge_must_exit)
if aga_door in lw_entrances:
lw_entrances.remove(aga_door)
elif aga_door in dw_entrances:
dw_entrances.remove(aga_door)
if aga_door in lw_entrances:
lw_entrances.remove(aga_door)
elif aga_door in dw_entrances:
dw_entrances.remove(aga_door)
connect_two_way(world, aga_door, 'Agahnims Tower Exit', player)
dungeon_exits.remove('Agahnims Tower Exit')
connect_two_way(world, aga_door, 'Agahnims Tower Exit', player)
dungeon_exits.remove('Agahnims Tower Exit')
connect_mandatory_exits(world, lw_entrances, dungeon_exits, lw_dungeon_entrances_must_exit, player)
connect_caves(world, lw_entrances, dw_entrances, dungeon_exits, player)
connect_mandatory_exits(world, lw_entrances, dungeon_exits, lw_dungeon_entrances_must_exit, player)
connect_caves(world, lw_entrances, dw_entrances, dungeon_exits, player)
elif world.shuffle[player] == 'simple':
simple_shuffle_dungeons(world, player)
@@ -1549,7 +1550,9 @@ def connect_entrance(world, entrancename, exitname, player):
addresses = door_addresses[entrance.name][0]
entrance.connect(region, addresses, target)
world.spoiler.set_entrance(entrance.name, exit.name if exit is not None else region.name, 'entrance', player)
if world.shuffle[player] not in ['vanilla', 'dungeonssimple', 'dungeonsfull']:
world.spoiler.set_entrance(entrance.name, exit.name if exit is not None else region.name, 'entrance', player)
def connect_exit(world, exitname, entrancename, player):
entrance = world.get_entrance(entrancename, player)
@@ -1560,7 +1563,9 @@ def connect_exit(world, exitname, entrancename, player):
exit.connected_region.entrances.remove(exit)
exit.connect(entrance.parent_region, door_addresses[entrance.name][1], exit_ids[exit.name][1])
world.spoiler.set_entrance(entrance.name, exit.name, 'exit', player)
if world.shuffle[player] not in ['vanilla', 'dungeonssimple', 'dungeonsfull']:
world.spoiler.set_entrance(entrance.name, exit.name, 'exit', player)
def connect_two_way(world, entrancename, exitname, player):
@@ -1575,7 +1580,9 @@ def connect_two_way(world, entrancename, exitname, player):
entrance.connect(exit.parent_region, door_addresses[entrance.name][0], exit_ids[exit.name][0])
exit.connect(entrance.parent_region, door_addresses[entrance.name][1], exit_ids[exit.name][1])
world.spoiler.set_entrance(entrance.name, exit.name, 'both', player)
if world.shuffle[player] not in ['vanilla', 'dungeonssimple', 'dungeonsfull']:
world.spoiler.set_entrance(entrance.name, exit.name, 'both', player)
def scramble_holes(world, player):
@@ -2866,49 +2873,39 @@ default_connections = [('Waterfall of Wishing', 'Waterfall of Wishing'),
('Hookshot Cave Back Entrance', 'Hookshot Cave'),
('Mimic Cave', 'Mimic Cave'),
('Pyramid Hole', 'Pyramid'),
('Pyramid Entrance', 'Bottom of Pyramid'),
('Inverted Pyramid Hole', 'Pyramid'),
('Inverted Pyramid Entrance', 'Bottom of Pyramid')
('Pyramid Exit', 'Pyramid Exit Ledge')
]
open_default_connections = [('Old Man Cave (West)', 'Old Man Cave Ledge'),
('Old Man Cave (East)', 'Old Man Cave'),
('Old Man Cave Exit (West)', 'Mountain Entry Entrance'),
('Old Man Cave Exit (East)', 'West Death Mountain (Bottom)'),
('Death Mountain Return Cave (East)', 'Death Mountain Return Cave'),
('Death Mountain Return Cave (West)', 'Death Mountain Return Cave'),
('Death Mountain Return Cave Exit (West)', 'Mountain Entry Ledge'),
('Death Mountain Return Cave Exit (East)', 'West Death Mountain (Bottom)'),
('Bumper Cave (Bottom)', 'Bumper Cave'),
('Bumper Cave (Top)', 'Bumper Cave'),
('Bumper Cave Exit (Top)', 'Bumper Cave Ledge'),
('Bumper Cave Exit (Bottom)', 'Bumper Cave Entrance'),
('Dark Death Mountain Fairy', 'Dark Death Mountain Healer Fairy'),
swapped_connections = {
0x03: [
('Old Man Cave (East)', 'Death Mountain Return Cave Exit (West)'),
#('Death Mountain Return Cave (East)', 'Death Mountain Return Cave Exit (East)'),
('Dark Death Mountain Fairy', 'Old Man Cave Exit (East)')
],
0x0a: [
('Old Man Cave (West)', 'Bumper Cave Exit (Bottom)'),
('Death Mountain Return Cave (West)', 'Bumper Cave Exit (Top)'),
('Bumper Cave (Bottom)', 'Old Man Cave Exit (West)'),
('Bumper Cave (Top)', 'Dark Death Mountain Healer Fairy')
],
0x1b: [
('Inverted Pyramid Entrance', 'Pyramid Exit')
]
}
('Links House', 'Links House'),
open_default_connections = [('Links House', 'Links House'),
('Links House Exit', 'Links House Area'),
('Big Bomb Shop', 'Big Bomb Shop'),
('Pyramid Exit', 'Pyramid Exit Ledge')]
('Pyramid Hole', 'Pyramid'),
('Pyramid Entrance', 'Bottom of Pyramid')
]
inverted_default_connections = [('Old Man Cave (West)', 'Bumper Cave'),
('Old Man Cave (East)', 'Death Mountain Return Cave'),
('Old Man Cave Exit (West)', 'Bumper Cave Entrance'),
('Old Man Cave Exit (East)', 'West Dark Death Mountain (Bottom)'),
('Death Mountain Return Cave (West)', 'Bumper Cave'),
('Death Mountain Return Cave (East)', 'Death Mountain Return Cave'),
('Death Mountain Return Cave Exit (West)', 'West Death Mountain (Bottom)'),
('Death Mountain Return Cave Exit (East)', 'West Death Mountain (Bottom)'),
('Bumper Cave (Bottom)', 'Old Man Cave Ledge'),
('Bumper Cave (Top)', 'Dark Death Mountain Healer Fairy'),
('Bumper Cave Exit (Top)', 'Mountain Entry Ledge'),
('Bumper Cave Exit (Bottom)', 'Mountain Entry Entrance'),
('Dark Death Mountain Fairy', 'Old Man Cave'),
('Links House', 'Big Bomb Shop'),
inverted_default_connections = [('Links House', 'Big Bomb Shop'),
('Links House Exit', 'Big Bomb Shop Area'),
('Big Bomb Shop', 'Links House'),
('Pyramid Exit', 'Hyrule Castle Ledge')]
('Inverted Pyramid Hole', 'Pyramid'),
('Inverted Pyramid Entrance', 'Bottom of Pyramid')
]
# non shuffled dungeons
default_dungeon_connections = [('Desert Palace Entrance (South)', 'Desert South Portal'),