From 49276d565c1893bdac053cce544cf882091b6a77 Mon Sep 17 00:00:00 2001 From: Erilea Date: Mon, 4 Dec 2023 17:34:02 +0100 Subject: [PATCH 1/2] Recurse entrances to mark banned islands When placing a banned entrance inside a secret cave inner isle or a dungeon, the top-level island wouldn't be marked as banned if the outer entrance was already randomized. Recurse through the entrances in that case to ensure the banned island list is maintained --- randomizers/entrances.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/randomizers/entrances.py b/randomizers/entrances.py index 1b473044..cc212ab3 100644 --- a/randomizers/entrances.py +++ b/randomizers/entrances.py @@ -700,12 +700,19 @@ def randomize_one_set_of_exits(self, relevant_entrances: list[ZoneEntrance], rel self.done_entrances_to_exits[zone_entrance] = zone_exit self.done_exits_to_entrances[zone_exit] = zone_entrance - if zone_exit in self.banned_exits and zone_entrance.island_name is not None: + if zone_exit in self.banned_exits: # Keep track of which islands have a required bosses mode banned dungeon to avoid marker overlap. if zone_exit in DUNGEON_EXITS + BOSS_EXITS: # We only keep track of dungeon exits and boss exits, not miniboss exits. # Banned miniboss exits can share an island with required dungeons/bosses. - self.islands_with_a_banned_dungeon.add(zone_entrance.island_name) + outer_entrance = self.get_outermost_entrance_for_entrance(zone_entrance) + # Because we filter above so that we always assign entrances from the sea inwards, + # we can assume when we assign an entrance that it has a path back to the sea. + # If we're assigning a nonterminal entrance, any nested entrances will get assigned after this one + # and we'll run through this code again (so we can reason based on zone_exit only, + # instead of having to recurse through the nested exits to find banned dungeons/bosses) + assert outer_entrance + self.islands_with_a_banned_dungeon.add(outer_entrance.island_name) def finalize_all_randomized_sets_of_entrances(self): non_terminal_exits = [] From f75c59eaaa6898403655b4b979904e214f419bbd Mon Sep 17 00:00:00 2001 From: Erilea Date: Mon, 17 Jun 2024 10:03:24 +0200 Subject: [PATCH 2/2] Prevent required and unrequired dungeons on the same island In required bosses mode, when dungeon entrances are randomized, but not nested boss entrances, we could end up placing a required boss on the same island as a banned one, as we never randomize the boss entrance itself (which is checked for co-location between banned and required bosses), only the dungeon one. Also ban required dungeons from appearing on islands with banned dungeons. This additionally prevent confusion where a player might not be able to tell which entrance can lead to progression if they don't already know their bosses --- randomizers/entrances.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/randomizers/entrances.py b/randomizers/entrances.py index cc212ab3..509184d1 100644 --- a/randomizers/entrances.py +++ b/randomizers/entrances.py @@ -665,7 +665,8 @@ def randomize_one_set_of_exits(self, relevant_entrances: list[ZoneEntrance], rel if zone_entrance.island_name in self.islands_with_a_banned_dungeon: possible_remaining_exits = [ ex for ex in possible_remaining_exits - if not (ex in BOSS_EXITS or ex not in terminal_exits) + if ex in terminal_exits and + not ex in (DUNGEON_EXITS + BOSS_EXITS) ] if not possible_remaining_exits: