Skip to content

Commit

Permalink
implement a shuffle_sol_seals option
Browse files Browse the repository at this point in the history
  • Loading branch information
Ixrec committed Mar 1, 2025
1 parent 1bff698 commit ac73861
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
4 changes: 1 addition & 3 deletions worlds/nine_sols/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ def set_rules(self) -> None:
self.multiworld.completion_condition[self.player] = lambda state: state.has(goal_item, self.player)

def fill_slot_data(self):
slot_data = self.options.as_dict(
"death_link", # a client/mod feature
)
slot_data = dict() # self.options.as_dict() # no options to put here yet
# Archipelago does not yet have apworld versions (data_version is deprecated),
# so we have to roll our own with slot_data for the time being
slot_data["apworld_version"] = "0.1.0"
Expand Down
17 changes: 17 additions & 0 deletions worlds/nine_sols/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class NineSolsItem(Item):


class NineSolsItemData(NamedTuple):
name: str = None
code: Optional[int] = None
type: ItemClassification = ItemClassification.filler
category: Optional[str] = None
Expand All @@ -33,6 +34,7 @@ class NineSolsItemData(NamedTuple):
item_data_table: Dict[str, NineSolsItemData] = {}
for items_data_entry in items_data:
item_data_table[items_data_entry["name"]] = NineSolsItemData(
name=items_data_entry["name"],
code=(items_data_entry["code"] if "code" in items_data_entry else None),
type=item_types_map[items_data_entry["type"]],
category=(items_data_entry["category"] if "category" in items_data_entry else None),
Expand Down Expand Up @@ -103,6 +105,8 @@ def create_items(world: "NineSolsWorld") -> None:
if item.code is None:
# here we rely on our event items and event locations having identical names
multiworld.get_location(name, player).place_locked_item(create_item(player, name))
elif item.name.startswith("Seal of ") and not options.shuffle_sol_seals:
continue # we'll place these as a group later
elif item.type == ItemClassification.filler:
if name not in repeatable_filler_weights:
unique_filler.append(create_item(player, name))
Expand Down Expand Up @@ -168,3 +172,16 @@ def create_items(world: "NineSolsWorld") -> None:

itempool = prog_and_useful_items + unique_filler + repeatable_filler_items
multiworld.itempool += itempool

if not options.shuffle_sol_seals:
for (location, item) in [
["Kuafu's Vital Sanctum", "Seal of Kuafu"],
["Goumang's Vital Sanctum", "Seal of Goumang"],
["Yanlao's Vital Sanctum", "Seal of Yanlao"],
["Jiequan's Vital Sanctum", "Seal of Jiequan"],
["Cortex Center: Defeat Lady Ethereal", "Seal of Lady Ethereal"],
["Ji's Vital Sanctum", "Seal of Ji"],
["ED (Living Area): Fuxi's Vital Sanctum", "Seal of Fuxi"],
["Nuwa's Vital Sanctum", "Seal of Nuwa"],
]:
multiworld.get_location(location, player).place_locked_item(create_item(player, item))
9 changes: 7 additions & 2 deletions worlds/nine_sols/options.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
from dataclasses import dataclass

from Options import PerGameCommonOptions, StartInventoryPool, DeathLink
from Options import DefaultOnToggle, PerGameCommonOptions, StartInventoryPool, DeathLink


class ShuffleSolSeals(DefaultOnToggle):
"""Allows the Sol Seal items to be placed on any location in the multiworld, instead of their vanilla locations."""
display_name = "Shuffle Sol Seals"


@dataclass
class NineSolsGameOptions(PerGameCommonOptions):
start_inventory_from_pool: StartInventoryPool
death_link: DeathLink
shuffle_sol_seals: ShuffleSolSeals

12 changes: 12 additions & 0 deletions worlds/nine_sols/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,15 @@ class TestDefaultWorld(NineSolsTestBase):

def test_default_world(self):
self.assertEqual(self.getLocationCount(), 322) # 317 default locations + 5 events


class TestShuffleSolSealsOff(NineSolsTestBase):
options = {
"shuffle_sol_seals": False
}

def test_default_world(self):
self.assertEqual(
self.multiworld.get_location("Kuafu's Vital Sanctum", self.player).item.name,
"Seal of Kuafu"
)

0 comments on commit ac73861

Please sign in to comment.