From ce5f58ec3c4e7bb18750752edd5ca379c5ba3429 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sat, 7 Jan 2023 16:58:43 -0600 Subject: [PATCH] Added Lite/Lean support for Fixed Take-Any caves --- EntranceShuffle.py | 40 +++++++++++++++++++--------- source/overworld/EntranceShuffle2.py | 39 +++++++++++++++++---------- 2 files changed, 53 insertions(+), 26 deletions(-) diff --git a/EntranceShuffle.py b/EntranceShuffle.py index 34e04037..b6eb3bf6 100644 --- a/EntranceShuffle.py +++ b/EntranceShuffle.py @@ -62,7 +62,8 @@ def link_entrances(world, player): # if we do not shuffle, set default connections if world.shuffle[player] in ['vanilla', 'dungeonssimple', 'dungeonsfull']: - for entrancename, exitname in default_connections + default_pot_connections + drop_connections + default_item_connections + default_shop_connections: + for entrancename, exitname in (default_connections + default_pot_connections + + default_takeany_connections + drop_connections + default_item_connections + default_shop_connections): connect_logical(world, entrancename, exitname, player, exitname.endswith(' Exit')) for entrancename, exitname in default_connector_connections + dropexit_connections: connect_logical(world, entrancename, exitname, player, True) @@ -330,7 +331,10 @@ def link_entrances(world, player): # place remaining doors connect_doors(world, list(entrance_pool), list(exit_pool), player) elif world.shuffle[player] == 'lite': - for entrancename, exitname in default_connections + ([] if world.shopsanity[player] else default_shop_connections) + ([] if world.pottery[player] not in ['none', 'keys', 'dungeon'] else default_pot_connections): + for entrancename, exitname in (default_connections + + ([] if world.shopsanity[player] else default_shop_connections) + + ([] if world.pottery[player] not in ['none', 'keys', 'dungeon'] else default_pot_connections) + + ([] if world.take_any[player] == 'fixed' else default_takeany_connections)): connect_logical(world, entrancename, exitname, player, False) if invFlag: world.get_entrance('Dark Sanctuary Hint Exit', player).connect(world.get_entrance('Dark Sanctuary Hint', player).parent_region) @@ -420,7 +424,10 @@ def link_entrances(world, player): # place remaining doors connect_doors(world, list(entrance_pool), list(exit_pool), player) elif world.shuffle[player] == 'lean': - for entrancename, exitname in default_connections + ([] if world.shopsanity[player] else default_shop_connections) + ([] if world.pottery[player] not in ['none', 'keys', 'dungeon'] else default_pot_connections): + for entrancename, exitname in (default_connections + + ([] if world.shopsanity[player] else default_shop_connections) + + ([] if world.pottery[player] not in ['none', 'keys', 'dungeon'] else default_pot_connections) + + ([] if world.take_any[player] == 'fixed' else default_takeany_connections)): connect_logical(world, entrancename, exitname, player, False) if invFlag: world.get_entrance('Dark Sanctuary Hint Exit', player).connect(world.get_entrance('Dark Sanctuary Hint', player).parent_region) @@ -1342,7 +1349,10 @@ def place_links_house(world, player, ignore_list=[]): else: links_house_doors = [i for i in get_starting_entrances(world, player, world.shuffle[player] != 'insanity') if i in entrance_pool] if world.shuffle[player] in ['lite', 'lean']: - links_house_doors = [e for e in links_house_doors if e in list(zip(*(default_item_connections + (default_shop_connections if world.shopsanity[player] else []) + (default_pot_connections if world.pottery[player] not in ['none', 'keys', 'dungeon'] else []))))[0]] + links_house_doors = [e for e in links_house_doors if e in list(zip(*(default_item_connections + + (default_shop_connections if world.shopsanity[player] else []) + + (default_pot_connections if world.pottery[player] not in ['none', 'keys', 'dungeon'] else []) + + (default_takeany_connections if world.take_any[player] == 'fixed' else []))))[0]] #TODO: Need to improve Links House placement to choose a better sector or eliminate entrances that are after ledge drops links_house_doors = [e for e in links_house_doors if e not in ignore_list] @@ -1390,7 +1400,10 @@ def place_blacksmith(world, links_house, player): sanc_region = world.get_entrance('Sanctuary Exit', player).connected_region.name blacksmith_doors = list(OrderedDict.fromkeys(blacksmith_doors + list(build_accessible_entrance_list(world, sanc_region, player, assumed_inventory, False, True, True)))) if world.shuffle[player] in ['lite', 'lean']: - blacksmith_doors = [e for e in blacksmith_doors if e in list(zip(*(default_item_connections + (default_shop_connections if world.shopsanity[player] else []) + (default_pot_connections if world.pottery[player] not in ['none', 'keys', 'dungeon'] else []))))[0]] + blacksmith_doors = [e for e in blacksmith_doors if e in list(zip(*(default_item_connections + + (default_shop_connections if world.shopsanity[player] else []) + + (default_pot_connections if world.pottery[player] not in ['none', 'keys', 'dungeon'] else []) + + (default_takeany_connections if world.take_any[player] == 'fixed' else []))))[0]] assert len(blacksmith_doors), 'No valid candidates to place Blacksmiths Hut' blacksmith_hut = random.choice(blacksmith_doors) @@ -1457,7 +1470,8 @@ def junk_fill_inaccessible(world, player): if not exit.connected_region and exit.name in entrance_pool: inaccessible_entrances.append(exit.name) - junk_locations = [e for e in list(zip(*(default_connections + ([] if world.pottery[player] not in ['none', 'keys', 'dungeon'] else default_pot_connections))))[1] if e in exit_pool] + junk_locations = [e for e in list(zip(*(default_connections + + ([] if world.pottery[player] not in ['none', 'keys', 'dungeon'] else default_pot_connections))))[1] if e in exit_pool] random.shuffle(junk_locations) for entrance in inaccessible_entrances: connect_entrance(world, entrance, junk_locations.pop(), player) @@ -2070,8 +2084,6 @@ mandatory_connections = [('Lost Woods Hideout (top to bottom)', 'Lost Woods Hide default_connections = [('Bonk Fairy (Light)', 'Bonk Fairy (Light)'), ('Lake Hylia Fairy', 'Lake Hylia Healer Fairy'), ('Lake Hylia Fortune Teller', 'Lake Hylia Fortune Teller'), - ('Light Hype Fairy', 'Swamp Healer Fairy'), - ('Desert Fairy', 'Desert Healer Fairy'), ('Lost Woods Gamble', 'Lost Woods Gamble'), ('Fortune Teller (Light)', 'Fortune Teller (Light)'), ('Bush Covered House', 'Bush Covered House'), @@ -2081,16 +2093,20 @@ default_connections = [('Bonk Fairy (Light)', 'Bonk Fairy (Light)'), ('East Dark World Hint', 'East Dark World Hint'), ('Dark Lake Hylia Fairy', 'Dark Lake Hylia Healer Fairy'), - ('Dark Lake Hylia Ledge Fairy', 'Dark Lake Hylia Ledge Healer Fairy'), ('Dark Lake Hylia Ledge Hint', 'Dark Lake Hylia Ledge Hint'), - ('Bonk Fairy (Dark)', 'Bonk Fairy (Dark)'), ('Dark Sanctuary Hint', 'Dark Sanctuary Hint'), ('Fortune Teller (Dark)', 'Fortune Teller (Dark)'), ('Archery Game', 'Archery Game'), - ('Dark Desert Fairy', 'Dark Desert Healer Fairy'), - ('Dark Death Mountain Fairy', 'Dark Death Mountain Healer Fairy'), + ('Dark Desert Fairy', 'Dark Desert Healer Fairy') ] +default_takeany_connections = [('Light Hype Fairy', 'Swamp Healer Fairy'), + ('Desert Fairy', 'Desert Healer Fairy'), + ('Dark Lake Hylia Ledge Fairy', 'Dark Lake Hylia Ledge Healer Fairy'), + ('Bonk Fairy (Dark)', 'Bonk Fairy (Dark)'), + ('Dark Death Mountain Fairy', 'Dark Death Mountain Healer Fairy') + ] + default_pot_connections = [('Lumberjack House', 'Lumberjack House'), ('Snitch Lady (East)', 'Snitch Lady (East)'), ('Snitch Lady (West)', 'Snitch Lady (West)'), diff --git a/source/overworld/EntranceShuffle2.py b/source/overworld/EntranceShuffle2.py index 8fc505e1..abcd9da8 100644 --- a/source/overworld/EntranceShuffle2.py +++ b/source/overworld/EntranceShuffle2.py @@ -775,6 +775,9 @@ def do_vanilla_connect(pool_def, avail): elif pool_def['condition'] == 'pottery': # this condition involves whether caves with pots are shuffled or not if avail.world.pottery[avail.player] not in ['none', 'keys', 'dungeon']: return + elif pool_def['condition'] == 'takeany': + if avail.world.take_any[avail.player] == 'fixed': + return defaults = inverted_default_connections if avail.inverted else default_connections if avail.inverted: if 'Dark Death Mountain Fairy' in pool_def['entrances']: @@ -1200,13 +1203,11 @@ modes = { 'fixed_non_items': { 'special': 'vanilla', 'condition': '', - 'entrances': ['Dark Death Mountain Fairy', 'Dark Desert Fairy', 'Archery Game', - 'Fortune Teller (Dark)', 'Dark Sanctuary Hint', 'Bonk Fairy (Dark)', - 'Dark Lake Hylia Ledge Hint', 'Dark Lake Hylia Ledge Fairy', 'Dark Lake Hylia Fairy', - 'Dark Lake Hylia Shop', 'East Dark World Hint', 'Kakariko Gamble Game', 'Good Bee Cave', - 'Long Fairy Cave', 'Bush Covered House', 'Fortune Teller (Light)', 'Lost Woods Gamble', - 'Desert Fairy', 'Light Hype Fairy', 'Lake Hylia Fortune Teller', 'Lake Hylia Fairy', - 'Bonk Fairy (Light)', 'Inverted Dark Sanctuary'], + 'entrances': ['Dark Desert Fairy', 'Archery Game', 'Fortune Teller (Dark)', 'Dark Sanctuary Hint', + 'Dark Lake Hylia Ledge Hint', 'Dark Lake Hylia Fairy', 'Dark Lake Hylia Shop', + 'East Dark World Hint', 'Kakariko Gamble Game', 'Good Bee Cave', 'Long Fairy Cave', + 'Bush Covered House', 'Fortune Teller (Light)', 'Lost Woods Gamble', + 'Lake Hylia Fortune Teller', 'Lake Hylia Fairy', 'Bonk Fairy (Light)', 'Inverted Dark Sanctuary'], }, 'fixed_shops': { 'special': 'vanilla', @@ -1215,6 +1216,12 @@ modes = { 'Dark World Shop', 'Red Shield Shop', 'Kakariko Shop', 'Capacity Upgrade', 'Cave Shop (Lake Hylia)'], }, + 'fixed_takeanys': { + 'special': 'vanilla', + 'condition': 'takeany', + 'entrances': ['Desert Fairy', 'Light Hype Fairy', 'Dark Death Mountain Fairy', + 'Dark Lake Hylia Ledge Fairy', 'Bonk Fairy (Dark)'], + }, 'fixed_pottery': { 'special': 'vanilla', 'condition': 'pottery', @@ -1276,13 +1283,11 @@ modes = { 'fixed_non_items': { 'special': 'vanilla', 'condition': '', - 'entrances': ['Dark Death Mountain Fairy', 'Dark Desert Fairy', 'Archery Game', - 'Fortune Teller (Dark)', 'Dark Sanctuary Hint', 'Bonk Fairy (Dark)', - 'Dark Lake Hylia Ledge Hint', 'Dark Lake Hylia Ledge Fairy', 'Dark Lake Hylia Fairy', - 'Dark Lake Hylia Shop', 'East Dark World Hint', 'Kakariko Gamble Game', 'Good Bee Cave', - 'Long Fairy Cave', 'Bush Covered House', 'Fortune Teller (Light)', 'Lost Woods Gamble', - 'Desert Fairy', 'Light Hype Fairy', 'Lake Hylia Fortune Teller', 'Lake Hylia Fairy', - 'Bonk Fairy (Light)', 'Inverted Dark Sanctuary'], + 'entrances': ['Dark Desert Fairy', 'Archery Game', 'Fortune Teller (Dark)', 'Dark Sanctuary Hint', + 'Dark Lake Hylia Ledge Hint', 'Dark Lake Hylia Fairy', 'Dark Lake Hylia Shop', + 'East Dark World Hint', 'Kakariko Gamble Game', 'Good Bee Cave', 'Long Fairy Cave', + 'Bush Covered House', 'Fortune Teller (Light)', 'Lost Woods Gamble', + 'Lake Hylia Fortune Teller', 'Lake Hylia Fairy', 'Bonk Fairy (Light)', 'Inverted Dark Sanctuary'], }, 'fixed_shops': { 'special': 'vanilla', @@ -1291,6 +1296,12 @@ modes = { 'Dark World Shop', 'Red Shield Shop', 'Kakariko Shop', 'Capacity Upgrade', 'Cave Shop (Lake Hylia)'], }, + 'fixed_takeanys': { + 'special': 'vanilla', + 'condition': 'takeany', + 'entrances': ['Desert Fairy', 'Light Hype Fairy', 'Dark Death Mountain Fairy', + 'Dark Lake Hylia Ledge Fairy', 'Bonk Fairy (Dark)'], + }, 'fixed_pottery': { 'special': 'vanilla', 'condition': 'pottery',