Files
Grinch-AP/worlds/stardew_valley/data/harvest.py
Jérémie Bolduc 9ac921380f Stardew Valley: Refactor buildings to use content packs (#4239)
* create building data object and rename ItemSource to Source to be more generic

# Conflicts:
#	worlds/stardew_valley/content/game_content.py

# Conflicts:
#	worlds/stardew_valley/data/artisan.py
#	worlds/stardew_valley/data/game_item.py
#	worlds/stardew_valley/data/harvest.py
#	worlds/stardew_valley/data/shop.py

* remove compound sources, replace by other requirements which already handle this usecase

* add coops to content packs

* add building progression in game features

* add shippping bin to starting building; remove has_house

* replace config check with feature

* add other buildings in content packs

* not passing

* tests passes, unbelievable

* use newly create methods more

* use new assets to ease readability

* self review

* fix flake8 maybe

* properly split rule for mapping cave systems

* fix tractor garage name

* self review

* add upgrade_from to farm house buldings

* don't override building name variable in logic

* remove has_group from buildings

* mark some items easy in grinding logic so blueprints buildings can be in more early spheres

* move stuff around to maybe avoid future conflicts cuz I have like 10 PRs opened right now

* remove price_multiplier, turns out it's unused during generation

* disable shop source for mapping cave systems

* bunch of code review changes

* add petbowl and farmhouse to autobuilding

* set min easy items to 300

* fix farm type
2025-04-08 12:37:45 -04:00

66 lines
1.5 KiB
Python

from dataclasses import dataclass
from typing import Tuple, Sequence, Mapping
from .game_item import Source, ItemTag
from ..strings.season_names import Season
@dataclass(frozen=True, kw_only=True)
class ForagingSource(Source):
regions: Tuple[str, ...]
seasons: Tuple[str, ...] = Season.all
@dataclass(frozen=True, kw_only=True)
class SeasonalForagingSource(Source):
season: str
days: Sequence[int]
regions: Tuple[str, ...]
def as_foraging_source(self) -> ForagingSource:
return ForagingSource(seasons=(self.season,), regions=self.regions)
@dataclass(frozen=True, kw_only=True)
class FruitBatsSource(Source):
...
@dataclass(frozen=True, kw_only=True)
class MushroomCaveSource(Source):
...
@dataclass(frozen=True, kw_only=True)
class HarvestFruitTreeSource(Source):
add_tags = (ItemTag.CROPSANITY,)
sapling: str
seasons: Tuple[str, ...] = Season.all
@property
def requirement_tags(self) -> Mapping[str, Tuple[ItemTag, ...]]:
return {
self.sapling: (ItemTag.CROPSANITY_SEED,)
}
@dataclass(frozen=True, kw_only=True)
class HarvestCropSource(Source):
add_tags = (ItemTag.CROPSANITY,)
seed: str
seasons: Tuple[str, ...] = Season.all
"""Empty means it can't be grown on the farm."""
@property
def requirement_tags(self) -> Mapping[str, Tuple[ItemTag, ...]]:
return {
self.seed: (ItemTag.CROPSANITY_SEED,)
}
@dataclass(frozen=True, kw_only=True)
class ArtifactSpotSource(Source):
amount: int