Completionist mode

100% Locations logic fixes
This commit is contained in:
cassidoxa
2023-06-09 19:22:42 -04:00
parent b24c118572
commit 6d19f6c8d1
7 changed files with 63 additions and 12 deletions

View File

@@ -290,8 +290,9 @@ def global_rules(world, player):
set_defeat_dungeon_boss_rule(world.get_location('Tower of Hera - Prize', player))
for location in ['Tower of Hera - Boss', 'Tower of Hera - Big Chest', 'Tower of Hera - Compass Chest']:
forbid_item(world.get_location(location, player), 'Big Key (Tower of Hera)', player)
# for location in ['Tower of Hera - Big Key Chest']:
# forbid_item(world.get_location(location, player), 'Small Key (Tower of Hera)', player)
if world.accessibility == 'locations':
for location in ['Tower of Hera - Big Key Chest']:
forbid_item(world.get_location(location, player), 'Small Key (Tower of Hera)', player)
set_rule(world.get_entrance('Swamp Palace Moat', player), lambda state: state.has('Flippers', player) and state.has('Open Floodgate', player))
add_rule(world.get_location('Sunken Treasure', player), lambda state: state.has('Open Floodgate', player))
@@ -306,6 +307,9 @@ def global_rules(world, player):
set_defeat_dungeon_boss_rule(world.get_location('Swamp Palace - Prize', player))
for location in ['Swamp Palace - Entrance']:
forbid_item(world.get_location(location, player), 'Big Key (Swamp Palace)', player)
if world.accessibility == 'locations':
for location in ['Swamp Palace - Big Chest']:
forbid_item(world.get_location(location, player), 'Big Key (Swamp Palace)', player)
set_rule(world.get_entrance('Thieves Town Big Key Door', player), lambda state: state.has('Big Key (Thieves Town)', player))
set_rule(world.get_entrance('Blind Fight', player), lambda state: state.has_key('Small Key (Thieves Town)', player))
@@ -319,6 +323,9 @@ def global_rules(world, player):
forbid_item(world.get_location(location, player), 'Big Key (Thieves Town)', player)
for location in ['Thieves\' Town - Attic', 'Thieves\' Town - Boss']:
forbid_item(world.get_location(location, player), 'Small Key (Thieves Town)', player)
if world.accessibility == 'locations':
for location in ['Thieves\' Town - Big Chest']:
forbid_item(world.get_location(location, player), 'Small Key (Thieves Town)', player)
set_rule(world.get_entrance('Skull Woods First Section South Door', player), lambda state: state.has_key('Small Key (Skull Woods)', player))
set_rule(world.get_entrance('Skull Woods First Section (Right) North Door', player), lambda state: state.has_key('Small Key (Skull Woods)', player))
@@ -332,6 +339,9 @@ def global_rules(world, player):
set_defeat_dungeon_boss_rule(world.get_location('Skull Woods - Prize', player))
for location in ['Skull Woods - Boss']:
forbid_item(world.get_location(location, player), 'Small Key (Skull Woods)', player)
if world.accessibility == 'locations':
for location in ['Skull Woods - Big Chest']:
forbid_item(world.get_location(location, player), 'Big Key (Skull Woods)', player)
set_rule(world.get_entrance('Ice Palace Entrance Room', player), lambda state: state.can_melt_things(player))
set_rule(world.get_location('Ice Palace - Big Chest', player), lambda state: state.has('Big Key (Ice Palace)', player))
@@ -403,6 +413,9 @@ def global_rules(world, player):
set_rule(world.get_entrance('Palace of Darkness Maze Door', player), lambda state: state.has_key('Small Key (Palace of Darkness)', player, 6))
set_defeat_dungeon_boss_rule(world.get_location('Palace of Darkness - Boss', player))
set_defeat_dungeon_boss_rule(world.get_location('Palace of Darkness - Prize', player))
if world.accessibility == 'locations':
for location in ['Palace of Darkness - Big Key Chest', 'Palace of Darkness - Harmless Hellway']:
forbid_item(world.get_location(location, player), 'Small Key (Palace of Darkness)', player)
# these key rules are conservative, you might be able to get away with more lenient rules
randomizer_room_chests = ['Ganons Tower - Randomizer Room - Top Left', 'Ganons Tower - Randomizer Room - Top Right', 'Ganons Tower - Randomizer Room - Bottom Left', 'Ganons Tower - Randomizer Room - Bottom Right']
@@ -415,7 +428,7 @@ def global_rules(world, player):
set_rule(world.get_entrance('Ganons Tower (Map Room)', player), lambda state: state.has_key('Small Key (Ganons Tower)', player, 4) or (item_name(state, 'Ganons Tower - Map Chest', player) in [('Big Key (Ganons Tower)', player), ('Small Key (Ganons Tower)', player)] and state.has_key('Small Key (Ganons Tower)', player, 3)))
if world.accessibility != 'locations':
set_always_allow(world.get_location('Ganons Tower - Map Chest', player), lambda state, item: item.name == 'Small Key (Ganons Tower)' and item.player == player and state.has_key('Small Key (Ganons Tower)', player, 3))
else:
elif world.accessibility == 'locations':
forbid_item(world.get_location('Ganons Tower - Map Chest', player), 'Small Key (Ganons Tower)', player)
# It is possible to need more than 2 keys to get through this entrance if you spend keys elsewhere. We reflect this in the chest requirements.
@@ -685,8 +698,9 @@ def inverted_rules(world, player):
set_defeat_dungeon_boss_rule(world.get_location('Tower of Hera - Prize', player))
for location in ['Tower of Hera - Boss', 'Tower of Hera - Big Chest', 'Tower of Hera - Compass Chest']:
forbid_item(world.get_location(location, player), 'Big Key (Tower of Hera)', player)
# for location in ['Tower of Hera - Big Key Chest']:
# forbid_item(world.get_location(location, player), 'Small Key (Tower of Hera)', player)
if world.accessibility == 'locations':
for location in ['Tower of Hera - Big Key Chest']:
forbid_item(world.get_location(location, player), 'Small Key (Tower of Hera)', player)
set_rule(world.get_entrance('Swamp Palace Moat', player), lambda state: state.has('Flippers', player) and state.has('Open Floodgate', player))
add_rule(world.get_location('Sunken Treasure', player), lambda state: state.has('Open Floodgate', player))
@@ -701,6 +715,9 @@ def inverted_rules(world, player):
set_defeat_dungeon_boss_rule(world.get_location('Swamp Palace - Prize', player))
for location in ['Swamp Palace - Entrance']:
forbid_item(world.get_location(location, player), 'Big Key (Swamp Palace)', player)
if world.accessibility == 'locations':
for location in ['Swamp Palace - Big Chest']:
forbid_item(world.get_location(location, player), 'Big Key (Swamp Palace)', player)
set_rule(world.get_entrance('Thieves Town Big Key Door', player), lambda state: state.has('Big Key (Thieves Town)', player))
set_rule(world.get_entrance('Blind Fight', player), lambda state: state.has_key('Small Key (Thieves Town)', player))
@@ -714,6 +731,9 @@ def inverted_rules(world, player):
forbid_item(world.get_location(location, player), 'Big Key (Thieves Town)', player)
for location in ['Thieves\' Town - Attic', 'Thieves\' Town - Boss']:
forbid_item(world.get_location(location, player), 'Small Key (Thieves Town)', player)
if world.accessibility == 'locations':
for location in ['Thieves\' Town - Big Chest']:
forbid_item(world.get_location(location, player), 'Small Key (Thieves Town)', player)
set_rule(world.get_entrance('Skull Woods First Section South Door', player), lambda state: state.has_key('Small Key (Skull Woods)', player))
set_rule(world.get_entrance('Skull Woods First Section (Right) North Door', player), lambda state: state.has_key('Small Key (Skull Woods)', player))
@@ -728,6 +748,9 @@ def inverted_rules(world, player):
set_defeat_dungeon_boss_rule(world.get_location('Skull Woods - Prize', player))
for location in ['Skull Woods - Boss']:
forbid_item(world.get_location(location, player), 'Small Key (Skull Woods)', player)
if world.accessibility == 'locations':
for location in ['Skull Woods - Big Chest']:
forbid_item(world.get_location(location, player), 'Big Key (Skull Woods)', player)
set_rule(world.get_entrance('Ice Palace Entrance Room', player), lambda state: state.can_melt_things(player))
set_rule(world.get_location('Ice Palace - Big Chest', player), lambda state: state.has('Big Key (Ice Palace)', player))
@@ -800,6 +823,9 @@ def inverted_rules(world, player):
set_rule(world.get_entrance('Palace of Darkness Maze Door', player), lambda state: state.has_key('Small Key (Palace of Darkness)', player, 6))
set_defeat_dungeon_boss_rule(world.get_location('Palace of Darkness - Boss', player))
set_defeat_dungeon_boss_rule(world.get_location('Palace of Darkness - Prize', player))
if world.accessibility == 'locations':
for location in ['Palace of Darkness - Big Key Chest', 'Palace of Darkness - Harmless Hellway']:
forbid_item(world.get_location(location, player), 'Small Key (Palace of Darkness)', player)
# these key rules are conservative, you might be able to get away with more lenient rules
randomizer_room_chests = ['Ganons Tower - Randomizer Room - Top Left', 'Ganons Tower - Randomizer Room - Top Right', 'Ganons Tower - Randomizer Room - Bottom Left', 'Ganons Tower - Randomizer Room - Bottom Right']
@@ -812,7 +838,7 @@ def inverted_rules(world, player):
set_rule(world.get_entrance('Ganons Tower (Map Room)', player), lambda state: state.has_key('Small Key (Ganons Tower)', player, 4) or (item_name(state, 'Ganons Tower - Map Chest', player) in [('Big Key (Ganons Tower)', player), ('Small Key (Ganons Tower)', player)] and state.has_key('Small Key (Ganons Tower)', player, 3)))
if world.accessibility != 'locations':
set_always_allow(world.get_location('Ganons Tower - Map Chest', player), lambda state, item: item.name == 'Small Key (Ganons Tower)' and item.player == player and state.has_key('Small Key (Ganons Tower)', player, 3))
else:
elif world.accessibility == 'locations':
forbid_item(world.get_location('Ganons Tower - Map Chest', player), 'Small Key (Ganons Tower)', player)
# It is possible to need more than 2 keys to get through this entance if you spend keys elsewhere. We reflect this in the chest requirements.
@@ -998,7 +1024,9 @@ def standard_rules(world, player):
def set_trock_key_rules(world, player):
if world.accessibility == 'locations':
for location in ['Turtle Rock - Big Key Chest']:
forbid_item(world.get_location(location, player), 'Small Key (Turtle Rock)', player)
# First set all relevant locked doors to impassible.
for entrance in ['Turtle Rock Dark Room Staircase', 'Turtle Rock (Chain Chomp Room) (North)', 'Turtle Rock (Chain Chomp Room) (South)', 'Turtle Rock Pokey Room']:
@@ -1027,7 +1055,7 @@ def set_trock_key_rules(world, player):
# No matter what, the Big Key cannot be in the Big Chest or held by Trinexx.
non_big_key_locations = ['Turtle Rock - Big Chest', 'Turtle Rock - Boss']
def tr_big_key_chest_keys_needed(state):
def tr_big_key_chest_keys_needed(world, state):
# This function handles the key requirements for the TR Big Chest in the situations it having the Big Key should logically require 2 keys, small key
# should logically require no keys, and anything else should logically require 4 keys.
item = item_name(state, 'Turtle Rock - Big Key Chest', player)