Skip to content

Commit

Permalink
Merge pull request #391 from Aelire/upstreamable/recurse-for-inner-en…
Browse files Browse the repository at this point in the history
…trances

Fix a randomization failure with nested entrances and required bosses mode
  • Loading branch information
LagoLunatic authored Jun 27, 2024
2 parents 5594bdc + f75c59e commit d2ed99d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions randomizers/entrances.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -700,12 +701,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 = []
Expand Down

0 comments on commit d2ed99d

Please sign in to comment.