fix: moon pearl paths respect blocked doors
This commit is contained in:
9
Rules.py
9
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:
|
# for each such entrance a new option is added that consist of:
|
||||||
# a) being able to reach it, and
|
# a) being able to reach it, and
|
||||||
# b) being able to access all entrances from there to `region`
|
# 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})])
|
seen_sets = set([frozenset({region})])
|
||||||
while queue:
|
while queue:
|
||||||
(current, path, seen) = queue.popleft()
|
(current, path, seen, region_path) = queue.popleft()
|
||||||
for entrance in current.entrances:
|
for entrance in current.entrances:
|
||||||
|
if entrance.door and entrance.door.blocked:
|
||||||
|
continue
|
||||||
new_region = entrance.parent_region
|
new_region = entrance.parent_region
|
||||||
new_seen = seen.union({new_region})
|
new_seen = seen.union({new_region})
|
||||||
if new_region.type in (RegionType.Cave, RegionType.Dungeon) and new_seen in seen_sets:
|
if new_region.type in (RegionType.Cave, RegionType.Dungeon) and new_seen in seen_sets:
|
||||||
continue
|
continue
|
||||||
new_path = path + [entrance.access_rule]
|
new_path = path + [entrance.access_rule]
|
||||||
|
new_region_path = region_path + [new_region]
|
||||||
seen_sets.add(frozenset(new_seen))
|
seen_sets.add(frozenset(new_seen))
|
||||||
if not is_link(new_region):
|
if not is_link(new_region):
|
||||||
if world.logic[player] in ['owglitches', 'hybridglitches']:
|
if world.logic[player] in ['owglitches', 'hybridglitches']:
|
||||||
@@ -1796,7 +1799,7 @@ def set_bunny_rules(world, player, inverted):
|
|||||||
continue
|
continue
|
||||||
if is_bunny(new_region):
|
if is_bunny(new_region):
|
||||||
# todo: if not owg or hmg and entrance is in bunny_impassible_doors, then skip this nonsense?
|
# 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:
|
else:
|
||||||
# we have reached pure light world, so we have a new possible option
|
# we have reached pure light world, so we have a new possible option
|
||||||
possible_options.append(path_to_access_rule(new_path, entrance))
|
possible_options.append(path_to_access_rule(new_path, entrance))
|
||||||
|
|||||||
Reference in New Issue
Block a user