Handle turtle rock big key chest key-for-a-key
This commit is contained in:
parent
596ba13781
commit
ee61f7b3ac
27
Rules.py
27
Rules.py
|
@ -506,18 +506,21 @@ def set_trock_key_rules(world):
|
|||
set_rule(world.get_entrance('Turtle Rock (Chain Chomp Room) (North)'), lambda state: state.has('Small Key (Turtle Rock)', 3))
|
||||
|
||||
# the most complicated one
|
||||
# if we have back entrance access, we could waste all keys before touching this
|
||||
# if we don't, we have access to all chests by the time we can waste a key on trinexx door
|
||||
# in that case, if it contains the big key, we can also not waste a key on the roller switch door
|
||||
# however in keysanity being able to reach all other chests while only having three keys does not imply this contains
|
||||
# a key, so we again need all four keys unless it contains the big key
|
||||
if can_reach_back:
|
||||
set_rule(world.get_location('Turtle Rock - Big Key Chest'), lambda state: state.has('Small Key (Turtle Rock)', 4) or (item_name(state.world.get_location('Turtle Rock - Big Key Chest')) in ['Small Key (Turtle Rock)']))
|
||||
elif world.keysanity:
|
||||
set_rule(world.get_location('Turtle Rock - Big Key Chest'), lambda state: state.has('Small Key (Turtle Rock)', 2) if (item_name(state.world.get_location('Turtle Rock - Big Key Chest')) in ['Big Key (Turtle Rock)']) else state.has('Small Key (Turtle Rock)', 4) or (item_name(state.world.get_location('Turtle Rock - Big Key Chest')) in ['Small Key (Turtle Rock)']))
|
||||
else:
|
||||
set_rule(world.get_location('Turtle Rock - Big Key Chest'), lambda state: state.has('Small Key (Turtle Rock)', 2) if (item_name(state.world.get_location('Turtle Rock - Big Key Chest')) in ['Big Key (Turtle Rock)']) else state.has('Small Key (Turtle Rock)', 3) or (item_name(state.world.get_location('Turtle Rock - Big Key Chest')) in ['Small Key (Turtle Rock)']))
|
||||
# TODO add key-for-key logic to the above mess via always_allow rules. Ugh!
|
||||
def tr_big_key_chest_keys_needed(state):
|
||||
item = item_name(state.world.get_location('Turtle Rock - Big Key Chest'))
|
||||
# handle key for a key situation in the usual way (by letting us logically open the door using the key locked inside it)
|
||||
if item in ['Small Key (Turtle Rock)']:
|
||||
return 3
|
||||
# if we lack backdoor access and cannot reach the back before opening this chest because it contains the big key
|
||||
# then that means there are two doors left that we cannot have spent a key on, (crystalroller and trinexx) so we only need
|
||||
# two keys
|
||||
if item in ['Big Key (Turtle Rock)'] and not can_reach_back:
|
||||
return 2
|
||||
# otherwise we could potentially have opened every other door already, so we need all 4 keys.
|
||||
return 4
|
||||
|
||||
set_rule(world.get_location('Turtle Rock - Big Key Chest'), lambda state: state.has('Small Key (Turtle Rock)', tr_big_key_chest_keys_needed(state)))
|
||||
set_always_allow(world.get_location('Turtle Rock - Big Key Chest'), lambda state, item: item.name == 'Small Key (Turtle Rock)' and state.has('Small Key (Turtle Rock)', 3))
|
||||
|
||||
# set big key restrictions
|
||||
non_big_key_locations = ['Turtle Rock - Big Chest', 'Turtle Rock - Trinexx']
|
||||
|
|
Loading…
Reference in New Issue