mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-04-13 15:33:31 -07:00
Major Content update for Stardew Valley ### Features - New BundleRandomization Value: Meme Bundles - Over 100 custom bundles, designed to be jokes, references, trolls, etc - New Setting: Bundles Per Room modifier - New Setting: Backpack Size - New Setting: Secretsanity - Checks for triggering easter eggs and secrets - New Setting: Moviesanity - Checks for watching movies and sharing snacks with Villagers - New Setting: Eatsanity - Checks for eating items - New Setting: Hatsanity - Checks for wearing Hats - New Setting: Start Without - Allows you to select any combination of various "starting" items, that you will actually not start with. Notably, tools, backpack slots, Day5 unlocks, etc. - New Setting: Allowed Filler Items - Allows you to customize the filler items you'll get - New Setting: Endgame Locations - Checks for various expensive endgame tasks and purchases - New Shipsanity value: Crops and Fish - New Settings: Jojapocalypse and settings to customize it - Bundle Plando: Replaced with BundleWhitelist and BundleBlacklist, for more customization freedom - Added a couple of Host.yaml settings to help hosts allow or ban specific difficult settings that could cause problems if the people don't know what they are signing up for. Plus a truckload of improvements on the mod side, not seen in this PR. ### Removed features - Integration for Stardew Valley Expanded. It is simply disabled, the code is all still there, but I'm extremely tired of providing tech support for it, plus Stardew Valley 1.7 was announced and that will break it again, so I'm done. When a maintainer steps up, it can be re-enabled.
141 lines
3.9 KiB
Python
141 lines
3.9 KiB
Python
from abc import ABC, abstractmethod
|
|
from dataclasses import dataclass
|
|
from functools import lru_cache
|
|
from typing import ClassVar
|
|
|
|
from .base import FeatureBase
|
|
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) -> str | None:
|
|
if not item_name.endswith(suffix):
|
|
return None
|
|
|
|
return item_name[:-len(suffix)]
|
|
|
|
|
|
def extract_npc_from_location_name(location_name: str) -> tuple[str | None, 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(FeatureBase, 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)
|