fix: key logic issue with decoupled doors

This commit is contained in:
aerinon
2025-01-07 14:45:02 -07:00
parent 897f248c25
commit f5a8b563d9
4 changed files with 26 additions and 19 deletions

View File

@@ -814,7 +814,12 @@ def key_wasted(new_door, old_door, old_counter, new_counter, key_layout, world,
def find_next_counter(new_door, old_counter, key_layout, prize_flag=None):
proposed_doors = {**old_counter.open_doors, **dict.fromkeys([new_door, new_door.dest])}
prop_doors = next((item_or_tuple for item_or_tuple in key_layout.proposal
if new_door == item_or_tuple or (isinstance(item_or_tuple, tuple) and new_door in item_or_tuple)), None)
if prop_doors:
proposed_doors = {**old_counter.open_doors, **dict.fromkeys([prop_doors])}
else:
proposed_doors = {**old_counter.open_doors}
bk_open = old_counter.big_key_opened or new_door.bigKey
prize_flag = prize_flag if prize_flag else old_counter.prize_doors_opened
return find_counter(proposed_doors, bk_open, key_layout, prize_flag)