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
This commit is contained in:
4
worlds/stardew_valley/content/feature/__init__.py
Normal file
4
worlds/stardew_valley/content/feature/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from . import booksanity
|
||||
from . import cropsanity
|
||||
from . import fishsanity
|
||||
from . import friendsanity
|
||||
72
worlds/stardew_valley/content/feature/booksanity.py
Normal file
72
worlds/stardew_valley/content/feature/booksanity.py
Normal file
@@ -0,0 +1,72 @@
|
||||
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
|
||||
42
worlds/stardew_valley/content/feature/cropsanity.py
Normal file
42
worlds/stardew_valley/content/feature/cropsanity.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import ClassVar, Optional
|
||||
|
||||
from ...data.game_item import GameItem, ItemTag
|
||||
|
||||
location_prefix = "Harvest "
|
||||
|
||||
|
||||
def to_location_name(crop: str) -> str:
|
||||
return location_prefix + crop
|
||||
|
||||
|
||||
def extract_crop_from_location_name(location_name: str) -> Optional[str]:
|
||||
if not location_name.startswith(location_prefix):
|
||||
return None
|
||||
|
||||
return location_name[len(location_prefix):]
|
||||
|
||||
|
||||
class CropsanityFeature(ABC):
|
||||
is_enabled: ClassVar[bool]
|
||||
|
||||
to_location_name = staticmethod(to_location_name)
|
||||
extract_crop_from_location_name = staticmethod(extract_crop_from_location_name)
|
||||
|
||||
@abstractmethod
|
||||
def is_included(self, crop: GameItem) -> bool:
|
||||
...
|
||||
|
||||
|
||||
class CropsanityDisabled(CropsanityFeature):
|
||||
is_enabled = False
|
||||
|
||||
def is_included(self, crop: GameItem) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
class CropsanityEnabled(CropsanityFeature):
|
||||
is_enabled = True
|
||||
|
||||
def is_included(self, crop: GameItem) -> bool:
|
||||
return ItemTag.CROPSANITY_SEED in crop.tags
|
||||
101
worlds/stardew_valley/content/feature/fishsanity.py
Normal file
101
worlds/stardew_valley/content/feature/fishsanity.py
Normal file
@@ -0,0 +1,101 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass
|
||||
from typing import ClassVar, Optional
|
||||
|
||||
from ...data.fish_data import FishItem
|
||||
from ...strings.fish_names import Fish
|
||||
|
||||
location_prefix = "Fishsanity: "
|
||||
|
||||
|
||||
def to_location_name(fish: str) -> str:
|
||||
return location_prefix + fish
|
||||
|
||||
|
||||
def extract_fish_from_location_name(location_name: str) -> Optional[str]:
|
||||
if not location_name.startswith(location_prefix):
|
||||
return None
|
||||
|
||||
return location_name[len(location_prefix):]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class FishsanityFeature(ABC):
|
||||
is_enabled: ClassVar[bool]
|
||||
|
||||
randomization_ratio: float = 1
|
||||
|
||||
to_location_name = staticmethod(to_location_name)
|
||||
extract_fish_from_location_name = staticmethod(extract_fish_from_location_name)
|
||||
|
||||
@property
|
||||
def is_randomized(self) -> bool:
|
||||
return self.randomization_ratio != 1
|
||||
|
||||
@abstractmethod
|
||||
def is_included(self, fish: FishItem) -> bool:
|
||||
...
|
||||
|
||||
|
||||
class FishsanityNone(FishsanityFeature):
|
||||
is_enabled = False
|
||||
|
||||
def is_included(self, fish: FishItem) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
class FishsanityLegendaries(FishsanityFeature):
|
||||
is_enabled = True
|
||||
|
||||
def is_included(self, fish: FishItem) -> bool:
|
||||
return fish.legendary
|
||||
|
||||
|
||||
class FishsanitySpecial(FishsanityFeature):
|
||||
is_enabled = True
|
||||
|
||||
included_fishes = {
|
||||
Fish.angler,
|
||||
Fish.crimsonfish,
|
||||
Fish.glacierfish,
|
||||
Fish.legend,
|
||||
Fish.mutant_carp,
|
||||
Fish.blobfish,
|
||||
Fish.lava_eel,
|
||||
Fish.octopus,
|
||||
Fish.scorpion_carp,
|
||||
Fish.ice_pip,
|
||||
Fish.super_cucumber,
|
||||
Fish.dorado
|
||||
}
|
||||
|
||||
def is_included(self, fish: FishItem) -> bool:
|
||||
return fish.name in self.included_fishes
|
||||
|
||||
|
||||
class FishsanityAll(FishsanityFeature):
|
||||
is_enabled = True
|
||||
|
||||
def is_included(self, fish: FishItem) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
class FishsanityExcludeLegendaries(FishsanityFeature):
|
||||
is_enabled = True
|
||||
|
||||
def is_included(self, fish: FishItem) -> bool:
|
||||
return not fish.legendary
|
||||
|
||||
|
||||
class FishsanityExcludeHardFish(FishsanityFeature):
|
||||
is_enabled = True
|
||||
|
||||
def is_included(self, fish: FishItem) -> bool:
|
||||
return fish.difficulty < 80
|
||||
|
||||
|
||||
class FishsanityOnlyEasyFish(FishsanityFeature):
|
||||
is_enabled = True
|
||||
|
||||
def is_included(self, fish: FishItem) -> bool:
|
||||
return fish.difficulty < 50
|
||||
139
worlds/stardew_valley/content/feature/friendsanity.py
Normal file
139
worlds/stardew_valley/content/feature/friendsanity.py
Normal file
@@ -0,0 +1,139 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass
|
||||
from functools import lru_cache
|
||||
from typing import Optional, Tuple, ClassVar
|
||||
|
||||
from ...data.villagers_data import Villager
|
||||
from ...strings.villager_names import NPC
|
||||
|
||||
suffix = " <3"
|
||||
location_prefix = "Friendsanity: "
|
||||
|
||||
|
||||
def to_item_name(npc_name: str) -> str:
|
||||
return npc_name + suffix
|
||||
|
||||
|
||||
def to_location_name(npc_name: str, heart: int) -> str:
|
||||
return location_prefix + npc_name + " " + str(heart) + suffix
|
||||
|
||||
|
||||
pet_heart_item_name = to_item_name(NPC.pet)
|
||||
|
||||
|
||||
def extract_npc_from_item_name(item_name: str) -> Optional[str]:
|
||||
if not item_name.endswith(suffix):
|
||||
return None
|
||||
|
||||
return item_name[:-len(suffix)]
|
||||
|
||||
|
||||
def extract_npc_from_location_name(location_name: str) -> Tuple[Optional[str], int]:
|
||||
if not location_name.endswith(suffix):
|
||||
return None, 0
|
||||
|
||||
trimmed = location_name[len(location_prefix):-len(suffix)]
|
||||
last_space = trimmed.rindex(" ")
|
||||
return trimmed[:last_space], int(trimmed[last_space + 1:])
|
||||
|
||||
|
||||
@lru_cache(maxsize=32) # Should not go pass 32 values if every friendsanity options are in the multi world
|
||||
def get_heart_steps(max_heart: int, heart_size: int) -> Tuple[int, ...]:
|
||||
return tuple(range(heart_size, max_heart + 1, heart_size)) + ((max_heart,) if max_heart % heart_size else ())
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class FriendsanityFeature(ABC):
|
||||
is_enabled: ClassVar[bool]
|
||||
|
||||
heart_size: int
|
||||
|
||||
to_item_name = staticmethod(to_item_name)
|
||||
to_location_name = staticmethod(to_location_name)
|
||||
pet_heart_item_name = pet_heart_item_name
|
||||
extract_npc_from_item_name = staticmethod(extract_npc_from_item_name)
|
||||
extract_npc_from_location_name = staticmethod(extract_npc_from_location_name)
|
||||
|
||||
@abstractmethod
|
||||
def get_randomized_hearts(self, villager: Villager) -> Tuple[int, ...]:
|
||||
...
|
||||
|
||||
@property
|
||||
def is_pet_randomized(self):
|
||||
return bool(self.get_pet_randomized_hearts())
|
||||
|
||||
@abstractmethod
|
||||
def get_pet_randomized_hearts(self) -> Tuple[int, ...]:
|
||||
...
|
||||
|
||||
|
||||
class FriendsanityNone(FriendsanityFeature):
|
||||
is_enabled = False
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(1)
|
||||
|
||||
def get_randomized_hearts(self, villager: Villager) -> Tuple[int, ...]:
|
||||
return ()
|
||||
|
||||
def get_pet_randomized_hearts(self) -> Tuple[int, ...]:
|
||||
return ()
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class FriendsanityBachelors(FriendsanityFeature):
|
||||
is_enabled = True
|
||||
|
||||
def get_randomized_hearts(self, villager: Villager) -> Tuple[int, ...]:
|
||||
if not villager.bachelor:
|
||||
return ()
|
||||
|
||||
return get_heart_steps(8, self.heart_size)
|
||||
|
||||
def get_pet_randomized_hearts(self) -> Tuple[int, ...]:
|
||||
return ()
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class FriendsanityStartingNpc(FriendsanityFeature):
|
||||
is_enabled = True
|
||||
|
||||
def get_randomized_hearts(self, villager: Villager) -> Tuple[int, ...]:
|
||||
if not villager.available:
|
||||
return ()
|
||||
|
||||
if villager.bachelor:
|
||||
return get_heart_steps(8, self.heart_size)
|
||||
|
||||
return get_heart_steps(10, self.heart_size)
|
||||
|
||||
def get_pet_randomized_hearts(self) -> Tuple[int, ...]:
|
||||
return get_heart_steps(5, self.heart_size)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class FriendsanityAll(FriendsanityFeature):
|
||||
is_enabled = True
|
||||
|
||||
def get_randomized_hearts(self, villager: Villager) -> Tuple[int, ...]:
|
||||
if villager.bachelor:
|
||||
return get_heart_steps(8, self.heart_size)
|
||||
|
||||
return get_heart_steps(10, self.heart_size)
|
||||
|
||||
def get_pet_randomized_hearts(self) -> Tuple[int, ...]:
|
||||
return get_heart_steps(5, self.heart_size)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class FriendsanityAllWithMarriage(FriendsanityFeature):
|
||||
is_enabled = True
|
||||
|
||||
def get_randomized_hearts(self, villager: Villager) -> Tuple[int, ...]:
|
||||
if villager.bachelor:
|
||||
return get_heart_steps(14, self.heart_size)
|
||||
|
||||
return get_heart_steps(10, self.heart_size)
|
||||
|
||||
def get_pet_randomized_hearts(self) -> Tuple[int, ...]:
|
||||
return get_heart_steps(5, self.heart_size)
|
||||
Reference in New Issue
Block a user