TUNIC: Use fewer parameters in helper functions (#3356)

* Clean these functions up, get the hell out of here 5 parameter function

* Clean up a bunch of rules that no longer need to be multi-lined since the functions are shorter

* Clean up some range functions

* Update to use world instead of player like Vi recommended

* Fix merge conflict

* Fix after merge
This commit is contained in:
Scipio Wright 2024-07-05 16:50:12 -04:00 committed by GitHub
parent 4054a9f15f
commit e7a8e195e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 316 additions and 337 deletions

View File

@ -200,7 +200,7 @@ class TunicWorld(World):
# Remove filler to make room for other items # Remove filler to make room for other items
def remove_filler(amount: int) -> None: def remove_filler(amount: int) -> None:
for _ in range(0, amount): for _ in range(amount):
if not available_filler: if not available_filler:
fill = "Fool Trap" fill = "Fool Trap"
else: else:
@ -258,7 +258,7 @@ class TunicWorld(World):
items_to_create["Lantern"] = 0 items_to_create["Lantern"] = 0
for item, quantity in items_to_create.items(): for item, quantity in items_to_create.items():
for i in range(0, quantity): for _ in range(quantity):
tunic_item: TunicItem = self.create_item(item) tunic_item: TunicItem = self.create_item(item)
if item in slot_data_item_names: if item in slot_data_item_names:
self.slot_data_items.append(tunic_item) self.slot_data_items.append(tunic_item)
@ -309,10 +309,10 @@ class TunicWorld(World):
def set_rules(self) -> None: def set_rules(self) -> None:
if self.options.entrance_rando or self.options.shuffle_ladders: if self.options.entrance_rando or self.options.shuffle_ladders:
set_er_location_rules(self, self.ability_unlocks) set_er_location_rules(self)
else: else:
set_region_rules(self, self.ability_unlocks) set_region_rules(self)
set_location_rules(self, self.ability_unlocks) set_location_rules(self)
def get_filler_item_name(self) -> str: def get_filler_item_name(self) -> str:
return self.random.choice(filler_items) return self.random.choice(filler_items)
@ -387,7 +387,7 @@ class TunicWorld(World):
if start_item in slot_data_item_names: if start_item in slot_data_item_names:
if start_item not in slot_data: if start_item not in slot_data:
slot_data[start_item] = [] slot_data[start_item] = []
for i in range(0, self.options.start_inventory_from_pool[start_item]): for _ in range(self.options.start_inventory_from_pool[start_item]):
slot_data[start_item].extend(["Your Pocket", self.player]) slot_data[start_item].extend(["Your Pocket", self.player])
for plando_item in self.multiworld.plando_items[self.player]: for plando_item in self.multiworld.plando_items[self.player]:

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ def create_er_regions(world: "TunicWorld") -> Dict[Portal, Portal]:
for region_name, region_data in tunic_er_regions.items(): for region_name, region_data in tunic_er_regions.items():
regions[region_name] = Region(region_name, world.player, world.multiworld) regions[region_name] = Region(region_name, world.player, world.multiworld)
set_er_region_rules(world, world.ability_unlocks, regions, portal_pairs) set_er_region_rules(world, regions, portal_pairs)
for location_name, location_id in world.location_name_to_id.items(): for location_name, location_id in world.location_name_to_id.items():
region = regions[location_table[location_name].er_region] region = regions[location_table[location_name].er_region]

View File

@ -38,102 +38,98 @@ def randomize_ability_unlocks(random: Random, options: TunicOptions) -> Dict[str
return dict(zip(abilities, ability_requirement)) return dict(zip(abilities, ability_requirement))
def has_ability(state: CollectionState, player: int, ability: str, options: TunicOptions, def has_ability(ability: str, state: CollectionState, world: "TunicWorld") -> bool:
ability_unlocks: Dict[str, int]) -> bool: options = world.options
ability_unlocks = world.ability_unlocks
if not options.ability_shuffling: if not options.ability_shuffling:
return True return True
if options.hexagon_quest: if options.hexagon_quest:
return state.has(gold_hexagon, player, ability_unlocks[ability]) return state.has(gold_hexagon, world.player, ability_unlocks[ability])
return state.has(ability, player) return state.has(ability, world.player)
# a check to see if you can whack things in melee at all # a check to see if you can whack things in melee at all
def has_stick(state: CollectionState, player: int) -> bool: def has_stick(state: CollectionState, player: int) -> bool:
return state.has("Stick", player) or state.has("Sword Upgrade", player, 1) or state.has("Sword", player) return (state.has("Stick", player) or state.has("Sword Upgrade", player, 1)
or state.has("Sword", player))
def has_sword(state: CollectionState, player: int) -> bool: def has_sword(state: CollectionState, player: int) -> bool:
return state.has("Sword", player) or state.has("Sword Upgrade", player, 2) return state.has("Sword", player) or state.has("Sword Upgrade", player, 2)
def has_ice_grapple_logic(long_range: bool, state: CollectionState, player: int, options: TunicOptions, def has_ice_grapple_logic(long_range: bool, state: CollectionState, world: "TunicWorld") -> bool:
ability_unlocks: Dict[str, int]) -> bool: player = world.player
if not options.logic_rules: if not world.options.logic_rules:
return False return False
if not long_range: if not long_range:
return state.has_all({ice_dagger, grapple}, player) return state.has_all({ice_dagger, grapple}, player)
else: else:
return state.has_all({ice_dagger, fire_wand, grapple}, player) and \ return state.has_all({ice_dagger, fire_wand, grapple}, player) and has_ability(icebolt, state, world)
has_ability(state, player, icebolt, options, ability_unlocks)
def can_ladder_storage(state: CollectionState, player: int, options: TunicOptions) -> bool: def can_ladder_storage(state: CollectionState, world: "TunicWorld") -> bool:
if options.logic_rules == "unrestricted" and has_stick(state, player): return world.options.logic_rules == "unrestricted" and has_stick(state, world.player)
def has_mask(state: CollectionState, world: "TunicWorld") -> bool:
if world.options.maskless:
return True return True
else: else:
return False return state.has(mask, world.player)
def has_mask(state: CollectionState, player: int, options: TunicOptions) -> bool: def has_lantern(state: CollectionState, world: "TunicWorld") -> bool:
if options.maskless: if world.options.lanternless:
return True return True
else: else:
return state.has(mask, player) return state.has(lantern, world.player)
def has_lantern(state: CollectionState, player: int, options: TunicOptions) -> bool: def set_region_rules(world: "TunicWorld") -> None:
if options.lanternless:
return True
else:
return state.has(lantern, player)
def set_region_rules(world: "TunicWorld", ability_unlocks: Dict[str, int]) -> None:
multiworld = world.multiworld multiworld = world.multiworld
player = world.player player = world.player
options = world.options options = world.options
multiworld.get_entrance("Overworld -> Overworld Holy Cross", player).access_rule = \ multiworld.get_entrance("Overworld -> Overworld Holy Cross", player).access_rule = \
lambda state: has_ability(state, player, holy_cross, options, ability_unlocks) lambda state: has_ability(holy_cross, state, world)
multiworld.get_entrance("Overworld -> Beneath the Well", player).access_rule = \ multiworld.get_entrance("Overworld -> Beneath the Well", player).access_rule = \
lambda state: has_stick(state, player) or state.has(fire_wand, player) lambda state: has_stick(state, player) or state.has(fire_wand, player)
multiworld.get_entrance("Overworld -> Dark Tomb", player).access_rule = \ multiworld.get_entrance("Overworld -> Dark Tomb", player).access_rule = \
lambda state: has_lantern(state, player, options) lambda state: has_lantern(state, world)
multiworld.get_entrance("Overworld -> West Garden", player).access_rule = \ multiworld.get_entrance("Overworld -> West Garden", player).access_rule = \
lambda state: state.has(laurels, player) \ lambda state: state.has(laurels, player) \
or can_ladder_storage(state, player, options) or can_ladder_storage(state, world)
multiworld.get_entrance("Overworld -> Eastern Vault Fortress", player).access_rule = \ multiworld.get_entrance("Overworld -> Eastern Vault Fortress", player).access_rule = \
lambda state: state.has(laurels, player) \ lambda state: state.has(laurels, player) \
or has_ice_grapple_logic(True, state, player, options, ability_unlocks) \ or has_ice_grapple_logic(True, state, world) \
or can_ladder_storage(state, player, options) or can_ladder_storage(state, world)
# using laurels or ls to get in is covered by the -> Eastern Vault Fortress rules # using laurels or ls to get in is covered by the -> Eastern Vault Fortress rules
multiworld.get_entrance("Overworld -> Beneath the Vault", player).access_rule = \ multiworld.get_entrance("Overworld -> Beneath the Vault", player).access_rule = \
lambda state: has_lantern(state, player, options) and \ lambda state: has_lantern(state, world) and has_ability(prayer, state, world)
has_ability(state, player, prayer, options, ability_unlocks)
multiworld.get_entrance("Ruined Atoll -> Library", player).access_rule = \ multiworld.get_entrance("Ruined Atoll -> Library", player).access_rule = \
lambda state: state.has_any({grapple, laurels}, player) and \ lambda state: state.has_any({grapple, laurels}, player) and has_ability(prayer, state, world)
has_ability(state, player, prayer, options, ability_unlocks)
multiworld.get_entrance("Overworld -> Quarry", player).access_rule = \ multiworld.get_entrance("Overworld -> Quarry", player).access_rule = \
lambda state: (has_sword(state, player) or state.has(fire_wand, player)) \ lambda state: (has_sword(state, player) or state.has(fire_wand, player)) \
and (state.has_any({grapple, laurels}, player) or can_ladder_storage(state, player, options)) and (state.has_any({grapple, laurels}, player) or can_ladder_storage(state, world))
multiworld.get_entrance("Quarry Back -> Quarry", player).access_rule = \ multiworld.get_entrance("Quarry Back -> Quarry", player).access_rule = \
lambda state: has_sword(state, player) or state.has(fire_wand, player) lambda state: has_sword(state, player) or state.has(fire_wand, player)
multiworld.get_entrance("Quarry -> Lower Quarry", player).access_rule = \ multiworld.get_entrance("Quarry -> Lower Quarry", player).access_rule = \
lambda state: has_mask(state, player, options) lambda state: has_mask(state, world)
multiworld.get_entrance("Lower Quarry -> Rooted Ziggurat", player).access_rule = \ multiworld.get_entrance("Lower Quarry -> Rooted Ziggurat", player).access_rule = \
lambda state: state.has(grapple, player) and has_ability(state, player, prayer, options, ability_unlocks) lambda state: state.has(grapple, player) and has_ability(prayer, state, world)
multiworld.get_entrance("Swamp -> Cathedral", player).access_rule = \ multiworld.get_entrance("Swamp -> Cathedral", player).access_rule = \
lambda state: state.has(laurels, player) and has_ability(state, player, prayer, options, ability_unlocks) \ lambda state: state.has(laurels, player) and has_ability(prayer, state, world) \
or has_ice_grapple_logic(False, state, player, options, ability_unlocks) or has_ice_grapple_logic(False, state, world)
multiworld.get_entrance("Overworld -> Spirit Arena", player).access_rule = \ multiworld.get_entrance("Overworld -> Spirit Arena", player).access_rule = \
lambda state: (state.has(gold_hexagon, player, options.hexagon_goal.value) if options.hexagon_quest.value lambda state: ((state.has(gold_hexagon, player, options.hexagon_goal.value) if options.hexagon_quest.value
else state.has_all({red_hexagon, green_hexagon, blue_hexagon}, player) and state.has_group_unique("Hero Relics", player, 6)) and \ else state.has_all({red_hexagon, green_hexagon, blue_hexagon}, player)
has_ability(state, player, prayer, options, ability_unlocks) and has_sword(state, player) and \ and state.has_group_unique("Hero Relics", player, 6))
state.has_any({lantern, laurels}, player) and has_ability(prayer, state, world) and has_sword(state, player)
and state.has_any({lantern, laurels}, player))
def set_location_rules(world: "TunicWorld", ability_unlocks: Dict[str, int]) -> None: def set_location_rules(world: "TunicWorld") -> None:
multiworld = world.multiworld multiworld = world.multiworld
player = world.player player = world.player
options = world.options options = world.options
@ -142,37 +138,36 @@ def set_location_rules(world: "TunicWorld", ability_unlocks: Dict[str, int]) ->
# Ability Shuffle Exclusive Rules # Ability Shuffle Exclusive Rules
set_rule(multiworld.get_location("Far Shore - Page Pickup", player), set_rule(multiworld.get_location("Far Shore - Page Pickup", player),
lambda state: has_ability(state, player, prayer, options, ability_unlocks)) lambda state: has_ability(prayer, state, world))
set_rule(multiworld.get_location("Fortress Courtyard - Chest Near Cave", player), set_rule(multiworld.get_location("Fortress Courtyard - Chest Near Cave", player),
lambda state: has_ability(state, player, prayer, options, ability_unlocks) or state.has(laurels, player) lambda state: has_ability(prayer, state, world)
or can_ladder_storage(state, player, options) or state.has(laurels, player)
or (has_ice_grapple_logic(True, state, player, options, ability_unlocks) or can_ladder_storage(state, world)
and has_lantern(state, player, options))) or (has_ice_grapple_logic(True, state, world) and has_lantern(state, world)))
set_rule(multiworld.get_location("Fortress Courtyard - Page Near Cave", player), set_rule(multiworld.get_location("Fortress Courtyard - Page Near Cave", player),
lambda state: has_ability(state, player, prayer, options, ability_unlocks) or state.has(laurels, player) lambda state: has_ability(prayer, state, world) or state.has(laurels, player)
or can_ladder_storage(state, player, options) or can_ladder_storage(state, world)
or (has_ice_grapple_logic(True, state, player, options, ability_unlocks) or (has_ice_grapple_logic(True, state, world) and has_lantern(state, world)))
and has_lantern(state, player, options)))
set_rule(multiworld.get_location("East Forest - Dancing Fox Spirit Holy Cross", player), set_rule(multiworld.get_location("East Forest - Dancing Fox Spirit Holy Cross", player),
lambda state: has_ability(state, player, holy_cross, options, ability_unlocks)) lambda state: has_ability(holy_cross, state, world))
set_rule(multiworld.get_location("Forest Grave Path - Holy Cross Code by Grave", player), set_rule(multiworld.get_location("Forest Grave Path - Holy Cross Code by Grave", player),
lambda state: has_ability(state, player, holy_cross, options, ability_unlocks)) lambda state: has_ability(holy_cross, state, world))
set_rule(multiworld.get_location("East Forest - Golden Obelisk Holy Cross", player), set_rule(multiworld.get_location("East Forest - Golden Obelisk Holy Cross", player),
lambda state: has_ability(state, player, holy_cross, options, ability_unlocks)) lambda state: has_ability(holy_cross, state, world))
set_rule(multiworld.get_location("Beneath the Well - [Powered Secret Room] Chest", player), set_rule(multiworld.get_location("Beneath the Well - [Powered Secret Room] Chest", player),
lambda state: has_ability(state, player, prayer, options, ability_unlocks)) lambda state: has_ability(prayer, state, world))
set_rule(multiworld.get_location("West Garden - [North] Behind Holy Cross Door", player), set_rule(multiworld.get_location("West Garden - [North] Behind Holy Cross Door", player),
lambda state: has_ability(state, player, holy_cross, options, ability_unlocks)) lambda state: has_ability(holy_cross, state, world))
set_rule(multiworld.get_location("Library Hall - Holy Cross Chest", player), set_rule(multiworld.get_location("Library Hall - Holy Cross Chest", player),
lambda state: has_ability(state, player, holy_cross, options, ability_unlocks)) lambda state: has_ability(holy_cross, state, world))
set_rule(multiworld.get_location("Eastern Vault Fortress - [West Wing] Candles Holy Cross", player), set_rule(multiworld.get_location("Eastern Vault Fortress - [West Wing] Candles Holy Cross", player),
lambda state: has_ability(state, player, holy_cross, options, ability_unlocks)) lambda state: has_ability(holy_cross, state, world))
set_rule(multiworld.get_location("West Garden - [Central Highlands] Holy Cross (Blue Lines)", player), set_rule(multiworld.get_location("West Garden - [Central Highlands] Holy Cross (Blue Lines)", player),
lambda state: has_ability(state, player, holy_cross, options, ability_unlocks)) lambda state: has_ability(holy_cross, state, world))
set_rule(multiworld.get_location("Quarry - [Back Entrance] Bushes Holy Cross", player), set_rule(multiworld.get_location("Quarry - [Back Entrance] Bushes Holy Cross", player),
lambda state: has_ability(state, player, holy_cross, options, ability_unlocks)) lambda state: has_ability(holy_cross, state, world))
set_rule(multiworld.get_location("Cathedral - Secret Legend Trophy Chest", player), set_rule(multiworld.get_location("Cathedral - Secret Legend Trophy Chest", player),
lambda state: has_ability(state, player, holy_cross, options, ability_unlocks)) lambda state: has_ability(holy_cross, state, world))
# Overworld # Overworld
set_rule(multiworld.get_location("Overworld - [Southwest] Fountain Page", player), set_rule(multiworld.get_location("Overworld - [Southwest] Fountain Page", player),
@ -182,21 +177,21 @@ def set_location_rules(world: "TunicWorld", ability_unlocks: Dict[str, int]) ->
set_rule(multiworld.get_location("Overworld - [Southwest] West Beach Guarded By Turret 2", player), set_rule(multiworld.get_location("Overworld - [Southwest] West Beach Guarded By Turret 2", player),
lambda state: state.has_any({grapple, laurels}, player)) lambda state: state.has_any({grapple, laurels}, player))
set_rule(multiworld.get_location("Far Shore - Secret Chest", player), set_rule(multiworld.get_location("Far Shore - Secret Chest", player),
lambda state: state.has(laurels, player) and has_ability(state, player, prayer, options, ability_unlocks)) lambda state: state.has(laurels, player) and has_ability(prayer, state, world))
set_rule(multiworld.get_location("Overworld - [Southeast] Page on Pillar by Swamp", player), set_rule(multiworld.get_location("Overworld - [Southeast] Page on Pillar by Swamp", player),
lambda state: state.has(laurels, player)) lambda state: state.has(laurels, player))
set_rule(multiworld.get_location("Old House - Normal Chest", player), set_rule(multiworld.get_location("Old House - Normal Chest", player),
lambda state: state.has(house_key, player) lambda state: state.has(house_key, player)
or has_ice_grapple_logic(False, state, player, options, ability_unlocks) or has_ice_grapple_logic(False, state, world)
or (state.has(laurels, player) and options.logic_rules)) or (state.has(laurels, player) and options.logic_rules))
set_rule(multiworld.get_location("Old House - Holy Cross Chest", player), set_rule(multiworld.get_location("Old House - Holy Cross Chest", player),
lambda state: has_ability(state, player, holy_cross, options, ability_unlocks) and lambda state: has_ability(holy_cross, state, world) and (
(state.has(house_key, player) state.has(house_key, player)
or has_ice_grapple_logic(False, state, player, options, ability_unlocks) or has_ice_grapple_logic(False, state, world)
or (state.has(laurels, player) and options.logic_rules))) or (state.has(laurels, player) and options.logic_rules)))
set_rule(multiworld.get_location("Old House - Shield Pickup", player), set_rule(multiworld.get_location("Old House - Shield Pickup", player),
lambda state: state.has(house_key, player) lambda state: state.has(house_key, player)
or has_ice_grapple_logic(False, state, player, options, ability_unlocks) or has_ice_grapple_logic(False, state, world)
or (state.has(laurels, player) and options.logic_rules)) or (state.has(laurels, player) and options.logic_rules))
set_rule(multiworld.get_location("Overworld - [Northwest] Page on Pillar by Dark Tomb", player), set_rule(multiworld.get_location("Overworld - [Northwest] Page on Pillar by Dark Tomb", player),
lambda state: state.has(laurels, player)) lambda state: state.has(laurels, player))
@ -204,8 +199,8 @@ def set_location_rules(world: "TunicWorld", ability_unlocks: Dict[str, int]) ->
lambda state: state.has(laurels, player)) lambda state: state.has(laurels, player))
set_rule(multiworld.get_location("Overworld - [West] Chest After Bell", player), set_rule(multiworld.get_location("Overworld - [West] Chest After Bell", player),
lambda state: state.has(laurels, player) lambda state: state.has(laurels, player)
or (has_lantern(state, player, options) and has_sword(state, player)) or (has_lantern(state, world) and has_sword(state, player))
or can_ladder_storage(state, player, options)) or can_ladder_storage(state, world))
set_rule(multiworld.get_location("Overworld - [Northwest] Chest Beneath Quarry Gate", player), set_rule(multiworld.get_location("Overworld - [Northwest] Chest Beneath Quarry Gate", player),
lambda state: state.has_any({grapple, laurels}, player) or options.logic_rules) lambda state: state.has_any({grapple, laurels}, player) or options.logic_rules)
set_rule(multiworld.get_location("Overworld - [East] Grapple Chest", player), set_rule(multiworld.get_location("Overworld - [East] Grapple Chest", player),
@ -213,15 +208,14 @@ def set_location_rules(world: "TunicWorld", ability_unlocks: Dict[str, int]) ->
set_rule(multiworld.get_location("Special Shop - Secret Page Pickup", player), set_rule(multiworld.get_location("Special Shop - Secret Page Pickup", player),
lambda state: state.has(laurels, player)) lambda state: state.has(laurels, player))
set_rule(multiworld.get_location("Sealed Temple - Holy Cross Chest", player), set_rule(multiworld.get_location("Sealed Temple - Holy Cross Chest", player),
lambda state: has_ability(state, player, holy_cross, options, ability_unlocks) and lambda state: has_ability(holy_cross, state, world)
(state.has(laurels, player) and (state.has(laurels, player) or (has_lantern(state, world) and (has_sword(state, player)
or (has_lantern(state, player, options) and or state.has(fire_wand, player)))
(has_sword(state, player) or state.has(fire_wand, player))) or has_ice_grapple_logic(False, state, world)))
or has_ice_grapple_logic(False, state, player, options, ability_unlocks)))
set_rule(multiworld.get_location("Sealed Temple - Page Pickup", player), set_rule(multiworld.get_location("Sealed Temple - Page Pickup", player),
lambda state: state.has(laurels, player) lambda state: state.has(laurels, player)
or (has_lantern(state, player, options) and (has_sword(state, player) or state.has(fire_wand, player))) or (has_lantern(state, world) and (has_sword(state, player) or state.has(fire_wand, player)))
or has_ice_grapple_logic(False, state, player, options, ability_unlocks)) or has_ice_grapple_logic(False, state, world))
set_rule(multiworld.get_location("West Furnace - Lantern Pickup", player), set_rule(multiworld.get_location("West Furnace - Lantern Pickup", player),
lambda state: has_stick(state, player) or state.has_any({fire_wand, laurels}, player)) lambda state: has_stick(state, player) or state.has_any({fire_wand, laurels}, player))
@ -245,7 +239,7 @@ def set_location_rules(world: "TunicWorld", ability_unlocks: Dict[str, int]) ->
lambda state: state.has_all({grapple, laurels}, player)) lambda state: state.has_all({grapple, laurels}, player))
set_rule(multiworld.get_location("East Forest - Ice Rod Grapple Chest", player), set_rule(multiworld.get_location("East Forest - Ice Rod Grapple Chest", player),
lambda state: state.has_all({grapple, ice_dagger, fire_wand}, player) lambda state: state.has_all({grapple, ice_dagger, fire_wand}, player)
and has_ability(state, player, icebolt, options, ability_unlocks)) and has_ability(icebolt, state, world))
# West Garden # West Garden
set_rule(multiworld.get_location("West Garden - [North] Across From Page Pickup", player), set_rule(multiworld.get_location("West Garden - [North] Across From Page Pickup", player),
@ -253,17 +247,16 @@ def set_location_rules(world: "TunicWorld", ability_unlocks: Dict[str, int]) ->
set_rule(multiworld.get_location("West Garden - [West] In Flooded Walkway", player), set_rule(multiworld.get_location("West Garden - [West] In Flooded Walkway", player),
lambda state: state.has(laurels, player)) lambda state: state.has(laurels, player))
set_rule(multiworld.get_location("West Garden - [West Lowlands] Tree Holy Cross Chest", player), set_rule(multiworld.get_location("West Garden - [West Lowlands] Tree Holy Cross Chest", player),
lambda state: state.has(laurels, player) lambda state: state.has(laurels, player) and has_ability(holy_cross, state, world))
and has_ability(state, player, holy_cross, options, ability_unlocks))
set_rule(multiworld.get_location("West Garden - [East Lowlands] Page Behind Ice Dagger House", player), set_rule(multiworld.get_location("West Garden - [East Lowlands] Page Behind Ice Dagger House", player),
lambda state: (state.has(laurels, player) and has_ability(state, player, prayer, options, ability_unlocks)) lambda state: (state.has(laurels, player) and has_ability(prayer, state, world))
or has_ice_grapple_logic(True, state, player, options, ability_unlocks)) or has_ice_grapple_logic(True, state, world))
set_rule(multiworld.get_location("West Garden - [Central Lowlands] Below Left Walkway", player), set_rule(multiworld.get_location("West Garden - [Central Lowlands] Below Left Walkway", player),
lambda state: state.has(laurels, player)) lambda state: state.has(laurels, player))
set_rule(multiworld.get_location("West Garden - [Central Highlands] After Garden Knight", player), set_rule(multiworld.get_location("West Garden - [Central Highlands] After Garden Knight", player),
lambda state: state.has(laurels, player) lambda state: state.has(laurels, player)
or (has_lantern(state, player, options) and has_sword(state, player)) or (has_lantern(state, world) and has_sword(state, player))
or can_ladder_storage(state, player, options)) or can_ladder_storage(state, world))
# Ruined Atoll # Ruined Atoll
set_rule(multiworld.get_location("Ruined Atoll - [West] Near Kevin Block", player), set_rule(multiworld.get_location("Ruined Atoll - [West] Near Kevin Block", player),
@ -287,19 +280,17 @@ def set_location_rules(world: "TunicWorld", ability_unlocks: Dict[str, int]) ->
set_rule(multiworld.get_location("Fortress Leaf Piles - Secret Chest", player), set_rule(multiworld.get_location("Fortress Leaf Piles - Secret Chest", player),
lambda state: state.has(laurels, player)) lambda state: state.has(laurels, player))
set_rule(multiworld.get_location("Fortress Arena - Siege Engine/Vault Key Pickup", player), set_rule(multiworld.get_location("Fortress Arena - Siege Engine/Vault Key Pickup", player),
lambda state: has_sword(state, player) and lambda state: has_sword(state, player)
(has_ability(state, player, prayer, options, ability_unlocks) and (has_ability(prayer, state, world) or has_ice_grapple_logic(False, state, world)))
or has_ice_grapple_logic(False, state, player, options, ability_unlocks)))
set_rule(multiworld.get_location("Fortress Arena - Hexagon Red", player), set_rule(multiworld.get_location("Fortress Arena - Hexagon Red", player),
lambda state: state.has(vault_key, player) and lambda state: state.has(vault_key, player)
(has_ability(state, player, prayer, options, ability_unlocks) and (has_ability(prayer, state, world) or has_ice_grapple_logic(False, state, world)))
or has_ice_grapple_logic(False, state, player, options, ability_unlocks)))
# Beneath the Vault # Beneath the Vault
set_rule(multiworld.get_location("Beneath the Fortress - Bridge", player), set_rule(multiworld.get_location("Beneath the Fortress - Bridge", player),
lambda state: has_stick(state, player) or state.has_any({laurels, fire_wand}, player)) lambda state: has_stick(state, player) or state.has_any({laurels, fire_wand}, player))
set_rule(multiworld.get_location("Beneath the Fortress - Obscured Behind Waterfall", player), set_rule(multiworld.get_location("Beneath the Fortress - Obscured Behind Waterfall", player),
lambda state: has_stick(state, player) and has_lantern(state, player, options)) lambda state: has_stick(state, player) and has_lantern(state, world))
# Quarry # Quarry
set_rule(multiworld.get_location("Quarry - [Central] Above Ladder Dash Chest", player), set_rule(multiworld.get_location("Quarry - [Central] Above Ladder Dash Chest", player),
@ -313,8 +304,7 @@ def set_location_rules(world: "TunicWorld", ability_unlocks: Dict[str, int]) ->
# Swamp # Swamp
set_rule(multiworld.get_location("Cathedral Gauntlet - Gauntlet Reward", player), set_rule(multiworld.get_location("Cathedral Gauntlet - Gauntlet Reward", player),
lambda state: (state.has(fire_wand, player) and has_sword(state, player)) lambda state: (state.has(fire_wand, player) and has_sword(state, player))
and (state.has(laurels, player) and (state.has(laurels, player) or has_ice_grapple_logic(False, state, world)))
or has_ice_grapple_logic(False, state, player, options, ability_unlocks)))
set_rule(multiworld.get_location("Swamp - [Entrance] Above Entryway", player), set_rule(multiworld.get_location("Swamp - [Entrance] Above Entryway", player),
lambda state: state.has(laurels, player)) lambda state: state.has(laurels, player))
set_rule(multiworld.get_location("Swamp - [South Graveyard] Upper Walkway Dash Chest", player), set_rule(multiworld.get_location("Swamp - [South Graveyard] Upper Walkway Dash Chest", player),
@ -326,17 +316,17 @@ def set_location_rules(world: "TunicWorld", ability_unlocks: Dict[str, int]) ->
# Hero's Grave # Hero's Grave
set_rule(multiworld.get_location("Hero's Grave - Tooth Relic", player), set_rule(multiworld.get_location("Hero's Grave - Tooth Relic", player),
lambda state: state.has(laurels, player) and has_ability(state, player, prayer, options, ability_unlocks)) lambda state: state.has(laurels, player) and has_ability(prayer, state, world))
set_rule(multiworld.get_location("Hero's Grave - Mushroom Relic", player), set_rule(multiworld.get_location("Hero's Grave - Mushroom Relic", player),
lambda state: state.has(laurels, player) and has_ability(state, player, prayer, options, ability_unlocks)) lambda state: state.has(laurels, player) and has_ability(prayer, state, world))
set_rule(multiworld.get_location("Hero's Grave - Ash Relic", player), set_rule(multiworld.get_location("Hero's Grave - Ash Relic", player),
lambda state: state.has(laurels, player) and has_ability(state, player, prayer, options, ability_unlocks)) lambda state: state.has(laurels, player) and has_ability(prayer, state, world))
set_rule(multiworld.get_location("Hero's Grave - Flowers Relic", player), set_rule(multiworld.get_location("Hero's Grave - Flowers Relic", player),
lambda state: state.has(laurels, player) and has_ability(state, player, prayer, options, ability_unlocks)) lambda state: state.has(laurels, player) and has_ability(prayer, state, world))
set_rule(multiworld.get_location("Hero's Grave - Effigy Relic", player), set_rule(multiworld.get_location("Hero's Grave - Effigy Relic", player),
lambda state: state.has(laurels, player) and has_ability(state, player, prayer, options, ability_unlocks)) lambda state: state.has(laurels, player) and has_ability(prayer, state, world))
set_rule(multiworld.get_location("Hero's Grave - Feathers Relic", player), set_rule(multiworld.get_location("Hero's Grave - Feathers Relic", player),
lambda state: state.has(laurels, player) and has_ability(state, player, prayer, options, ability_unlocks)) lambda state: state.has(laurels, player) and has_ability(prayer, state, world))
# Shop # Shop
set_rule(multiworld.get_location("Shop - Potion 1", player), set_rule(multiworld.get_location("Shop - Potion 1", player),