Skip to content

Commit

Permalink
Shivers: Add events and fix require puzzle hints logic (#4018)
Browse files Browse the repository at this point in the history
* Adds some events, renames things, fails for many players.

* Adds entrance rules for requires hints.

* Cleanup and add goal item.

* Cleanup.

* Add additional rule.

* Event and regions additions.

* Updates from merge.

* Adds collect behavior option.

* Fix missing generator location.

* Fix whitespace and optimize imports.

* Switch location order back.

* Add name replacement for storage.

* Fix test failure.

* Improve puzzle hints required.

* Add missing locations and cleanup indirect conditions.

* Fix naming.

* PR feedback.

* Missed comment.

* Cleanup imports, use strings for option equivalence, and update option description.

* Fix rule.

* Create rolling buffer goal items and remove goal items and location from default options.

* Cleanup.

* Removes dateutil.

* Fixes Subterranean World information plaque.
  • Loading branch information
korydondzila authored Dec 27, 2024
1 parent 218f289 commit 3bcc86f
Show file tree
Hide file tree
Showing 10 changed files with 783 additions and 461 deletions.
2 changes: 1 addition & 1 deletion docs/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
/worlds/saving_princess/ @LeonarthCG

# Shivers
/worlds/shivers/ @GodlFire
/worlds/shivers/ @GodlFire @korydondzila

# A Short Hike
/worlds/shorthike/ @chandler05 @BrandenEK
Expand Down
20 changes: 14 additions & 6 deletions worlds/shivers/Constants.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import os
import json
import os
import pkgutil
from datetime import datetime


def load_data_file(*args) -> dict:
fname = "/".join(["data", *args])
return json.loads(pkgutil.get_data(__name__, fname).decode())

location_id_offset: int = 27000

location_info = load_data_file("locations.json")
location_name_to_id = {name: location_id_offset + index \
for index, name in enumerate(location_info["all_locations"])}
def relative_years_from_today(dt2: datetime) -> int:
today = datetime.now()
years = today.year - dt2.year
if today.month < dt2.month or (today.month == dt2.month and today.day < dt2.day):
years -= 1
return years

exclusion_info = load_data_file("excluded_locations.json")

location_id_offset: int = 27000
location_info = load_data_file("locations.json")
location_name_to_id = {name: location_id_offset + index for index, name in enumerate(location_info["all_locations"])}
exclusion_info = load_data_file("excluded_locations.json")
region_info = load_data_file("regions.json")
years_since_sep_30_1980 = relative_years_from_today(datetime.fromisoformat("1980-09-30"))
306 changes: 186 additions & 120 deletions worlds/shivers/Items.py

Large diffs are not rendered by default.

100 changes: 96 additions & 4 deletions worlds/shivers/Options.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
from Options import Choice, DefaultOnToggle, Toggle, PerGameCommonOptions, Range
from dataclasses import dataclass

from Options import (
Choice, DefaultOnToggle, ItemDict, ItemSet, LocationSet, OptionGroup, PerGameCommonOptions, Range, Toggle,
)
from . import ItemType, item_table
from .Constants import location_info


class IxupiCapturesNeeded(Range):
"""
Expand All @@ -11,62 +16,72 @@ class IxupiCapturesNeeded(Range):
range_end = 10
default = 10


class LobbyAccess(Choice):
"""
Chooses how keys needed to reach the lobby are placed.
- Normal: Keys are placed anywhere
- Early: Keys are placed early
- Local: Keys are placed locally
- Local: Keys are placed locally and early
"""
display_name = "Lobby Access"
option_normal = 0
option_early = 1
option_local = 2
default = 1


class PuzzleHintsRequired(DefaultOnToggle):
"""
If turned on puzzle hints/solutions will be available before the corresponding puzzle is required.
For example: The Red Door puzzle will be logically required only after access to the Beth's Address Book which gives you the solution.
For example: The Red Door puzzle will be logically required only after obtaining access to Beth's Address Book
which gives you the solution.
Turning this off allows for greater randomization.
"""
display_name = "Puzzle Hints Required"


class InformationPlaques(Toggle):
"""
Adds Information Plaques as checks.
(40 Locations)
"""
display_name = "Include Information Plaques"


class FrontDoorUsable(Toggle):
"""
Adds a key to unlock the front door of the museum.
"""
display_name = "Front Door Usable"


class ElevatorsStaySolved(DefaultOnToggle):
"""
Adds elevators as checks and will remain open upon solving them.
(3 Locations)
"""
display_name = "Elevators Stay Solved"


class EarlyBeth(DefaultOnToggle):
"""
Beth's body is open at the start of the game. This allows any pot piece to be placed in the slide and early checks on the second half of the final riddle.
Beth's body is open at the start of the game.
This allows any pot piece to be placed in the slide and early checks on the second half of the final riddle.
"""
display_name = "Early Beth"


class EarlyLightning(Toggle):
"""
Allows lightning to be captured at any point in the game. You will still need to capture all ten Ixupi for victory.
(1 Location)
"""
display_name = "Early Lightning"


class LocationPotPieces(Choice):
"""
Chooses where pot pieces will be located within the multiworld.
Expand All @@ -78,6 +93,8 @@ class LocationPotPieces(Choice):
option_own_world = 0
option_different_world = 1
option_any_world = 2
default = 2


class FullPots(Choice):
"""
Expand Down Expand Up @@ -107,6 +124,61 @@ class PuzzleCollectBehavior(Choice):
default = 1


# Need to override the default options to remove the goal items and goal locations so that they do not show on web.
valid_item_keys = [name for name, data in item_table.items() if data.type != ItemType.GOAL and data.code is not None]
valid_location_keys = [name for name in location_info["all_locations"] if name != "Mystery Solved"]


class LocalItems(ItemSet):
"""Forces these items to be in their native world."""
display_name = "Local Items"
rich_text_doc = True
valid_keys = valid_item_keys


class NonLocalItems(ItemSet):
"""Forces these items to be outside their native world."""
display_name = "Non-local Items"
rich_text_doc = True
valid_keys = valid_item_keys


class StartInventory(ItemDict):
"""Start with these items."""
verify_item_name = True
display_name = "Start Inventory"
rich_text_doc = True
valid_keys = valid_item_keys


class StartHints(ItemSet):
"""Start with these item's locations prefilled into the ``!hint`` command."""
display_name = "Start Hints"
rich_text_doc = True
valid_keys = valid_item_keys


class StartLocationHints(LocationSet):
"""Start with these locations and their item prefilled into the ``!hint`` command."""
display_name = "Start Location Hints"
rich_text_doc = True
valid_keys = valid_location_keys


class ExcludeLocations(LocationSet):
"""Prevent these locations from having an important item."""
display_name = "Excluded Locations"
rich_text_doc = True
valid_keys = valid_location_keys


class PriorityLocations(LocationSet):
"""Prevent these locations from having an unimportant item."""
display_name = "Priority Locations"
rich_text_doc = True
valid_keys = valid_location_keys


@dataclass
class ShiversOptions(PerGameCommonOptions):
ixupi_captures_needed: IxupiCapturesNeeded
Expand All @@ -120,3 +192,23 @@ class ShiversOptions(PerGameCommonOptions):
location_pot_pieces: LocationPotPieces
full_pots: FullPots
puzzle_collect_behavior: PuzzleCollectBehavior
local_items: LocalItems
non_local_items: NonLocalItems
start_inventory: StartInventory
start_hints: StartHints
start_location_hints: StartLocationHints
exclude_locations: ExcludeLocations
priority_locations: PriorityLocations


shivers_option_groups = [
OptionGroup("Item & Location Options", [
LocalItems,
NonLocalItems,
StartInventory,
StartHints,
StartLocationHints,
ExcludeLocations,
PriorityLocations
], True),
]
Loading

0 comments on commit 3bcc86f

Please sign in to comment.