Skip to content

Commit

Permalink
TUNIC: Update victory condition (ArchipelagoMW#3579)
Browse files Browse the repository at this point in the history
* Add hero relics to victory condition

* Update __init__.py

* Remove unneeded local variables for options

* Use has_group_unique

* fix spacing
  • Loading branch information
silent-destroyer authored Jun 29, 2024
1 parent 2424fb0 commit 55cb81d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
23 changes: 16 additions & 7 deletions worlds/tunic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ def create_item(self, name: str) -> TunicItem:
return TunicItem(name, item_data.classification, self.item_name_to_id[name], self.player)

def create_items(self) -> None:
keys_behind_bosses = self.options.keys_behind_bosses
hexagon_quest = self.options.hexagon_quest
sword_progression = self.options.sword_progression

tunic_items: List[TunicItem] = []
self.slot_data_items = []
Expand All @@ -172,7 +169,7 @@ def create_items(self) -> None:
if self.options.start_with_sword:
self.multiworld.push_precollected(self.create_item("Sword"))

if sword_progression:
if self.options.sword_progression:
items_to_create["Stick"] = 0
items_to_create["Sword"] = 0
else:
Expand All @@ -189,9 +186,9 @@ def create_items(self) -> None:
self.slot_data_items.append(laurels)
items_to_create["Hero's Laurels"] = 0

if keys_behind_bosses:
if self.options.keys_behind_bosses:
for rgb_hexagon, location in hexagon_locations.items():
hex_item = self.create_item(gold_hexagon if hexagon_quest else rgb_hexagon)
hex_item = self.create_item(gold_hexagon if self.options.hexagon_quest else rgb_hexagon)
self.multiworld.get_location(location, self.player).place_locked_item(hex_item)
self.slot_data_items.append(hex_item)
items_to_create[rgb_hexagon] = 0
Expand Down Expand Up @@ -222,7 +219,7 @@ def remove_filler(amount: int) -> None:
ladder_count += 1
remove_filler(ladder_count)

if hexagon_quest:
if self.options.hexagon_quest:
# Calculate number of hexagons in item pool
hexagon_goal = self.options.hexagon_goal
extra_hexagons = self.options.extra_hexagon_percentage
Expand All @@ -238,6 +235,18 @@ def remove_filler(amount: int) -> None:

remove_filler(items_to_create[gold_hexagon])

for hero_relic in item_name_groups["Hero Relics"]:
relic_item = TunicItem(hero_relic, ItemClassification.useful, self.item_name_to_id[hero_relic], self.player)
tunic_items.append(relic_item)
items_to_create[hero_relic] = 0

if not self.options.ability_shuffling:
for page in item_name_groups["Abilities"]:
if items_to_create[page] > 0:
page_item = TunicItem(page, ItemClassification.useful, self.item_name_to_id[page], self.player)
tunic_items.append(page_item)
items_to_create[page] = 0

if self.options.maskless:
mask_item = TunicItem("Scavenger Mask", ItemClassification.useful, self.item_name_to_id["Scavenger Mask"], self.player)
tunic_items.append(mask_item)
Expand Down
3 changes: 2 additions & 1 deletion worlds/tunic/er_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,8 @@ def set_er_region_rules(world: "TunicWorld", ability_unlocks: Dict[str, int], re
connecting_region=regions["Spirit Arena Victory"],
rule=lambda state: (state.has(gold_hexagon, player, world.options.hexagon_goal.value) if
world.options.hexagon_quest else
state.has_all({red_hexagon, green_hexagon, blue_hexagon, "Unseal the Heir"}, player)))
(state.has_all({red_hexagon, green_hexagon, blue_hexagon, "Unseal the Heir"}, player)
and state.has_group_unique("Hero Relics", player, 6))))

# connecting the regions portals are in to other portals you can access via ladder storage
# using has_stick instead of can_ladder_storage since it's already checking the logic rules
Expand Down
13 changes: 6 additions & 7 deletions worlds/tunic/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ class TunicItemData(NamedTuple):
"HP Offering": TunicItemData(ItemClassification.useful, 6, 48, "Offerings"),
"MP Offering": TunicItemData(ItemClassification.useful, 3, 49, "Offerings"),
"SP Offering": TunicItemData(ItemClassification.useful, 2, 50, "Offerings"),
"Hero Relic - ATT": TunicItemData(ItemClassification.useful, 1, 51, "Hero Relics"),
"Hero Relic - DEF": TunicItemData(ItemClassification.useful, 1, 52, "Hero Relics"),
"Hero Relic - HP": TunicItemData(ItemClassification.useful, 1, 53, "Hero Relics"),
"Hero Relic - MP": TunicItemData(ItemClassification.useful, 1, 54, "Hero Relics"),
"Hero Relic - POTION": TunicItemData(ItemClassification.useful, 1, 55, "Hero Relics"),
"Hero Relic - SP": TunicItemData(ItemClassification.useful, 1, 56, "Hero Relics"),
"Hero Relic - ATT": TunicItemData(ItemClassification.progression_skip_balancing, 1, 51, "Hero Relics"),
"Hero Relic - DEF": TunicItemData(ItemClassification.progression_skip_balancing, 1, 52, "Hero Relics"),
"Hero Relic - HP": TunicItemData(ItemClassification.progression_skip_balancing, 1, 53, "Hero Relics"),
"Hero Relic - MP": TunicItemData(ItemClassification.progression_skip_balancing, 1, 54, "Hero Relics"),
"Hero Relic - POTION": TunicItemData(ItemClassification.progression_skip_balancing, 1, 55, "Hero Relics"),
"Hero Relic - SP": TunicItemData(ItemClassification.progression_skip_balancing, 1, 56, "Hero Relics"),
"Orange Peril Ring": TunicItemData(ItemClassification.useful, 1, 57, "Cards"),
"Tincture": TunicItemData(ItemClassification.useful, 1, 58, "Cards"),
"Scavenger Mask": TunicItemData(ItemClassification.progression, 1, 59, "Cards"),
Expand Down Expand Up @@ -143,7 +143,6 @@ class TunicItemData(NamedTuple):
"Pages 50-51": TunicItemData(ItemClassification.useful, 1, 127, "Pages"),
"Pages 52-53 (Icebolt)": TunicItemData(ItemClassification.progression, 1, 128, "Pages"),
"Pages 54-55": TunicItemData(ItemClassification.useful, 1, 129, "Pages"),

"Ladders near Weathervane": TunicItemData(ItemClassification.progression, 0, 130, "Ladders"),
"Ladders near Overworld Checkpoint": TunicItemData(ItemClassification.progression, 0, 131, "Ladders"),
"Ladders near Patrol Cave": TunicItemData(ItemClassification.progression, 0, 132, "Ladders"),
Expand Down
2 changes: 1 addition & 1 deletion worlds/tunic/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def set_region_rules(world: "TunicWorld", ability_unlocks: Dict[str, int]) -> No
or has_ice_grapple_logic(False, state, player, options, ability_unlocks)
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
else state.has_all({red_hexagon, green_hexagon, blue_hexagon}, player)) and \
else state.has_all({red_hexagon, green_hexagon, blue_hexagon}, player) and state.has_group_unique("Hero Relics", player, 6)) and \
has_ability(state, player, prayer, options, ability_unlocks) and has_sword(state, player) and \
state.has_any({lantern, laurels}, player)

Expand Down

0 comments on commit 55cb81d

Please sign in to comment.