Fix for incorrect keylock situation

Fix for spoiler playthrough (makes things pretty slow though)
This commit is contained in:
aerinon
2022-11-29 13:18:34 -07:00
parent 1134eb23e7
commit 56ee20c4d2
2 changed files with 7 additions and 7 deletions

View File

@@ -796,7 +796,8 @@ class CollectionState(object):
rule = key_logic.door_rules[door.name]
key = KeyRuleType.AllowSmall
if (key in rule.new_rules and key_total >= rule.new_rules[key] and door.name not in skip
and door.name in state.reached_doors[player] and door.name not in state.opened_doors[player]):
and door.name in state.reached_doors[player] and door.name not in state.opened_doors[player]
and rule.small_location.item is None):
if paired:
door_candidates.append((door.name, paired.name))
skip.add(paired.name)

11
Main.py
View File

@@ -308,6 +308,7 @@ def main(args, seed=None, fish=None):
balance_multiworld_progression(world)
# if we only check for beatable, we can do this sanity check first before creating the rom
world.clear_exp_cache()
if not world.can_beat_game(log_error=True):
raise RuntimeError(world.fish.translate("cli", "cli", "cannot.beat.game"))
@@ -546,10 +547,8 @@ def copy_world(world):
new_location.item = item
item.location = new_location
item.world = ret
if location.event:
new_location.event = True
if location.locked:
new_location.locked = True
new_location.event = location.event
new_location.locked = location.locked
# these need to be modified properly by set_rules
new_location.access_rule = lambda state: True
new_location.item_rule = lambda state: True
@@ -660,8 +659,8 @@ def create_playthrough(world):
old_item = location.item
location.item = None
# todo: this is not very efficient, but I'm not sure how else to do it for this backwards logic
# world.clear_exp_cache()
if world.can_beat_game(state_cache[num]):
world.clear_exp_cache()
if world.can_beat_game(state_cache[max(num-1, 0)]):
logging.getLogger('').debug(f'{old_item.name} (Player {old_item.player}) is not required')
to_delete.add(location)
else: