From a77d3faf7848347cbbdb4791d8afa49d00320a10 Mon Sep 17 00:00:00 2001 From: aerinon Date: Fri, 5 Jan 2024 17:15:48 -0700 Subject: [PATCH] fix: moon pearl paths respect blocked doors --- Rules.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Rules.py b/Rules.py index ca69aa3b..e3e83ab9 100644 --- a/Rules.py +++ b/Rules.py @@ -1742,16 +1742,19 @@ def set_bunny_rules(world, player, inverted): # for each such entrance a new option is added that consist of: # a) being able to reach it, and # b) being able to access all entrances from there to `region` - queue = deque([(region, [], {region})]) + queue = deque([(region, [], {region}, [region])]) seen_sets = set([frozenset({region})]) while queue: - (current, path, seen) = queue.popleft() + (current, path, seen, region_path) = queue.popleft() for entrance in current.entrances: + if entrance.door and entrance.door.blocked: + continue new_region = entrance.parent_region new_seen = seen.union({new_region}) if new_region.type in (RegionType.Cave, RegionType.Dungeon) and new_seen in seen_sets: continue new_path = path + [entrance.access_rule] + new_region_path = region_path + [new_region] seen_sets.add(frozenset(new_seen)) if not is_link(new_region): if world.logic[player] in ['owglitches', 'hybridglitches']: @@ -1796,7 +1799,7 @@ def set_bunny_rules(world, player, inverted): continue if is_bunny(new_region): # todo: if not owg or hmg and entrance is in bunny_impassible_doors, then skip this nonsense? - queue.append((new_region, new_path, new_seen)) + queue.append((new_region, new_path, new_seen, new_region_path)) else: # we have reached pure light world, so we have a new possible option possible_options.append(path_to_access_rule(new_path, entrance))