Files
Grinch-AP/worlds/stardew_valley/content/feature/booksanity.py
agilbert1412 9b22458f44 Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests

This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.

In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
2024-07-07 15:04:25 +02:00

73 lines
1.8 KiB
Python

from abc import ABC, abstractmethod
from typing import ClassVar, Optional, Iterable
from ...data.game_item import GameItem, ItemTag
from ...strings.book_names import ordered_lost_books
item_prefix = "Power: "
location_prefix = "Read "
def to_item_name(book: str) -> str:
return item_prefix + book
def to_location_name(book: str) -> str:
return location_prefix + book
def extract_book_from_location_name(location_name: str) -> Optional[str]:
if not location_name.startswith(location_prefix):
return None
return location_name[len(location_prefix):]
class BooksanityFeature(ABC):
is_enabled: ClassVar[bool]
to_item_name = staticmethod(to_item_name)
progressive_lost_book = "Progressive Lost Book"
to_location_name = staticmethod(to_location_name)
extract_book_from_location_name = staticmethod(extract_book_from_location_name)
@abstractmethod
def is_included(self, book: GameItem) -> bool:
...
@staticmethod
def get_randomized_lost_books() -> Iterable[str]:
return []
class BooksanityDisabled(BooksanityFeature):
is_enabled = False
def is_included(self, book: GameItem) -> bool:
return False
class BooksanityPower(BooksanityFeature):
is_enabled = True
def is_included(self, book: GameItem) -> bool:
return ItemTag.BOOK_POWER in book.tags
class BooksanityPowerSkill(BooksanityFeature):
is_enabled = True
def is_included(self, book: GameItem) -> bool:
return ItemTag.BOOK_POWER in book.tags or ItemTag.BOOK_SKILL in book.tags
class BooksanityAll(BooksanityFeature):
is_enabled = True
def is_included(self, book: GameItem) -> bool:
return ItemTag.BOOK_POWER in book.tags or ItemTag.BOOK_SKILL in book.tags
@staticmethod
def get_randomized_lost_books() -> Iterable[str]:
return ordered_lost_books