Skip to content

Commit

Permalink
Continuing on ladder rules
Browse files Browse the repository at this point in the history
  • Loading branch information
ScipioWright committed Feb 25, 2024
1 parent ff342fb commit d9e3350
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 94 deletions.
25 changes: 11 additions & 14 deletions worlds/tunic/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,19 @@ class TunicItemData(NamedTuple):
"Pages 52-53 (Icebolt)": TunicItemData(ItemClassification.progression, 1, 128, "pages"),
"Pages 54-55": TunicItemData(ItemClassification.useful, 1, 129, "pages"),


"Hourglass Cave Ladders": TunicItemData(ItemClassification.progression, 0, 130, "ladders"),
"Ladders next to Dark Tomb": TunicItemData(ItemClassification.progression, 0, 131, "ladders"),
"Ladder to Quarry": TunicItemData(ItemClassification.progression, 0, 132, "ladders"),
"Ladders next to Ruined Passage Exit": TunicItemData(ItemClassification.progression, 0, 130, "ladders"),
"Overworld Shortcut Ladders": TunicItemData(ItemClassification.progression, 0, 130, "ladders"),
"Ladders next to Patrol Cave": TunicItemData(ItemClassification.progression, 0, 130, "ladders"),
"Ladder by Temple Rafters Exit": TunicItemData(ItemClassification.progression, 0, 130, "ladders"),
"Ladder to Ruined Atoll": TunicItemData(ItemClassification.progression, 0, 130, "ladders"),
"Ladder to Swamp": TunicItemData(ItemClassification.progression, 0, 130, "ladders"),
"Ladders next to Western Belltower": TunicItemData(ItemClassification.progression, 0, 130, "ladders"),

# probably the one in the well so it isn't weird in ER?
"Well Ladder": TunicItemData(ItemClassification.progression, 0, 130, "ladders"),

"Ladder Drop to East Forest": TunicItemData(ItemClassification.progression, 0, 130, "ladders"),

"Ladders next to Ruined Passage Exit": TunicItemData(ItemClassification.progression, 0, 133, "ladders"),
"Overworld East Forest Shortcut Ladder": TunicItemData(ItemClassification.progression, 0, 134, "ladders"),
"Overworld Fortress Shortcut Ladder": TunicItemData(ItemClassification.progression, 0, 135, "ladders"),
"Ladder by Temple Rafters Exit": TunicItemData(ItemClassification.progression, 0, 136, "ladders"),
"Ladder to Ruined Atoll": TunicItemData(ItemClassification.progression, 0, 137, "ladders"),
"Ladder to Swamp": TunicItemData(ItemClassification.progression, 0, 138, "ladders"),
"Ladders next to Western Belltower": TunicItemData(ItemClassification.progression, 0, 139, "ladders"),
"Well Ladder": TunicItemData(ItemClassification.progression, 0, 140, "ladders"),
"Ladder Drop to East Forest": TunicItemData(ItemClassification.progression, 0, 141, "ladders"),
"Ladders next to Patrol Cave": TunicItemData(ItemClassification.progression, 0, 142, "ladders"),
}

fool_tiers: List[List[str]] = [
Expand Down
41 changes: 23 additions & 18 deletions worlds/tunic/ladder_rules.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from typing import Dict, TYPE_CHECKING
from BaseClasses import CollectionState
from worlds.generic.Rules import set_rule, forbid_item
from .rules import has_ability, has_sword, has_stick, has_ice_grapple_logic, has_lantern, has_mask, can_ladder_storage
from .options import TunicOptions
if TYPE_CHECKING:
from . import TunicWorld

Expand All @@ -26,39 +24,46 @@
gold_hexagon = "Gold Questagon"


def has_ladder(ladder: str, state: CollectionState, player: int, options: TunicOptions) -> bool:
if options.ladder_rando:
return state.has(ladder, player)
else:
return True


def set_ladder_region_rules(world: "TunicWorld", ability_unlocks: Dict[str, int]) -> None:
multiworld = world.multiworld
player = world.player
options = world.options

multiworld.get_entrance("Overworld -> Overworld Holy Cross", player).access_rule = \
lambda state: has_ability(state, player, holy_cross, options, ability_unlocks)
multiworld.get_entrance("Overworld -> Well Ladder Region", player).access_rule = \
lambda state: state.has("Overworld Well Ladder", player)
multiworld.get_entrance("Overworld -> Swamp", player).access_rule = \
lambda state: state.has("Overworld Swamp Ladder", player)
multiworld.get_entrance("Overworld -> Back of Swamp", player).access_rule = \
lambda state: state.has(laurels, player)
multiworld.get_entrance("Overworld -> Dark Tomb", player).access_rule = \
lambda state: has_lantern(state, player, options)
multiworld.get_entrance("Overworld -> West Garden", player).access_rule = \
lambda state: state.has(laurels, player) \
lambda state: (state.has(laurels, player) and state.has("Ladders next to Western Belltower", player)) \
or can_ladder_storage(state, player, options)
multiworld.get_entrance("Beneath the Well -> Dark Tomb", player).access_rule = \
lambda state: has_lantern(state, player, options)
multiworld.get_entrance("West Garden -> Dark Tomb", player).access_rule = \
lambda state: has_lantern(state, player, options)
multiworld.get_entrance("Overworld -> Beneath the Well", player).access_rule = \
lambda state: state.has("Overworld Well Ladder", player)
multiworld.get_entrance("Beneath the Well -> Beneath the Well Back", player).access_rule = \
lambda state: state.has("Beneath the Well Back Ladder", player) \
or has_ice_grapple_logic(True, state, player, options, ability_unlocks)
# dash to the fuse and have the rear ladder, or dash through the well boss gate in nmg
multiworld.get_entrance("Overworld -> Beneath the Well Back", player).access_rule = \
lambda state: state.has(laurels, player) and (state.has("Beneath the Well Back Ladder", player)
or options.logic_rules)
multiworld.get_entrance("Beneath the Well Back -> Beneath the Well", player).access_rule = \
lambda state: state.has("Beneath the Well Back Ladder", player)
multiworld.get_entrance("Overworld -> Eastern Vault Fortress", player).access_rule = \
lambda state: state.has(laurels, player) \
or has_ice_grapple_logic(True, state, player, options, ability_unlocks) \
or can_ladder_storage(state, player, options)
# 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 = \
lambda state: has_lantern(state, player, options) and \
has_ability(state, player, prayer, options, ability_unlocks)
lambda state: has_lantern(state, player, options) \
and (can_ladder_storage(state, player, options) or (
(has_ability(state, player, prayer, options, ability_unlocks) or state.has(laurels, player))
and (state.has_any({"Overworld East Forest Shortcut Ladder", "Overworld Fortress Shortcut Ladder"}, player)
or state.has("Ladders next to Patrol Cave") and
(state.has_all({"Ladders next to Dark Tomb", laurels}, player) or state.has_all({grapple, laurels}, player))
or has_ice_grapple_logic(True, state, player, options, ability_unlocks))))
multiworld.get_entrance("Ruined Atoll -> Library", player).access_rule = \
lambda state: state.has_any({grapple, laurels}, player) and \
has_ability(state, player, prayer, options, ability_unlocks)
Expand Down
Loading

0 comments on commit d9e3350

Please sign in to comment.