From 61ffdff207da83019c2aae2389fd424d76752a7a Mon Sep 17 00:00:00 2001 From: espeon65536 Date: Sun, 14 Nov 2021 07:06:09 -0600 Subject: [PATCH] OoT: implement mixed entrance pools --- worlds/oot/EntranceShuffle.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/worlds/oot/EntranceShuffle.py b/worlds/oot/EntranceShuffle.py index 1a8b4f2d..f0313141 100644 --- a/worlds/oot/EntranceShuffle.py +++ b/worlds/oot/EntranceShuffle.py @@ -31,10 +31,11 @@ def assume_entrance_pool(entrance_pool, ootworld): assumed_forward = entrance.assume_reachable() if entrance.reverse != None: assumed_return = entrance.reverse.assume_reachable() - if (entrance.type in ('Dungeon', 'Grotto', 'Grave') and entrance.reverse.name != 'Spirit Temple Lobby -> Desert Colossus From Spirit Lobby') or \ - (entrance.type == 'Interior' and ootworld.shuffle_special_interior_entrances): - # In most cases, Dungeon, Grotto/Grave and Simple Interior exits shouldn't be assumed able to give access to their parent region - set_rule(assumed_return, lambda state, **kwargs: False) + if not (ootworld.mix_entrance_pools != 'off' and (ootworld.shuffle_overworld_entrances or ootworld.shuffle_special_interior_entrances)): + if (entrance.type in ('Dungeon', 'Grotto', 'Grave') and entrance.reverse.name != 'Spirit Temple Lobby -> Desert Colossus From Spirit Lobby') or \ + (entrance.type == 'Interior' and ootworld.shuffle_special_interior_entrances): + # In most cases, Dungeon, Grotto/Grave and Simple Interior exits shouldn't be assumed able to give access to their parent region + set_rule(assumed_return, lambda state, **kwargs: False) assumed_forward.bind_two_way(assumed_return) assumed_pool.append(assumed_forward) return assumed_pool @@ -384,7 +385,8 @@ def shuffle_random_entrances(ootworld): entrance_pools['GrottoGrave'] = ootworld.get_shufflable_entrances(type='Grotto', only_primary=True) entrance_pools['GrottoGrave'] += ootworld.get_shufflable_entrances(type='Grave', only_primary=True) if ootworld.shuffle_overworld_entrances: - entrance_pools['Overworld'] = ootworld.get_shufflable_entrances(type='Overworld') + exclude_overworld_reverse = ootworld.mix_entrance_pools == 'all' and not ootworld.decouple_entrances + entrance_pools['Overworld'] = ootworld.get_shufflable_entrances(type='Overworld', only_primary=exclude_overworld_reverse) # Mark shuffled entrances for entrance in chain(chain.from_iterable(one_way_entrance_pools.values()), chain.from_iterable(entrance_pools.values())): @@ -392,6 +394,16 @@ def shuffle_random_entrances(ootworld): if entrance.reverse: entrance.reverse.shuffled = True + # Combine all entrance pools if mixing + if ootworld.mix_entrance_pools == 'all': + entrance_pools = {'Mixed': list(chain.from_iterable(entrance_pools.values()))} + elif ootworld.mix_entrance_pools == 'indoor': + if ootworld.shuffle_overworld_entrances: + ow_pool = entrance_pools['Overworld'] + entrance_pools = {'Mixed': list(filter(lambda entrance: entrance.type != 'Overworld', chain.from_iterable(entrance_pools.values())))} + if ootworld.shuffle_overworld_entrances: + entrance_pools['Overworld'] = ow_pool + # Build target entrance pools one_way_target_entrance_pools = {} for pool_type, entrance_pool in one_way_entrance_pools.items():