Files
Grinch-AP/worlds/stardew_valley/logic/base_logic.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

52 lines
1.6 KiB
Python

from __future__ import annotations
from typing import TypeVar, Generic, Dict, Collection
from ..content.game_content import StardewContent
from ..options import StardewValleyOptions
from ..stardew_rule import StardewRule
class LogicRegistry:
def __init__(self):
self.item_rules: Dict[str, StardewRule] = {}
self.seed_rules: Dict[str, StardewRule] = {}
self.cooking_rules: Dict[str, StardewRule] = {}
self.crafting_rules: Dict[str, StardewRule] = {}
self.crop_rules: Dict[str, StardewRule] = {}
self.artisan_good_rules: Dict[str, StardewRule] = {}
self.fish_rules: Dict[str, StardewRule] = {}
self.museum_rules: Dict[str, StardewRule] = {}
self.festival_rules: Dict[str, StardewRule] = {}
self.quest_rules: Dict[str, StardewRule] = {}
self.special_order_rules: Dict[str, StardewRule] = {}
self.sve_location_rules: Dict[str, StardewRule] = {}
class BaseLogicMixin:
def __init__(self, *args, **kwargs):
pass
T = TypeVar("T", bound=BaseLogicMixin)
class BaseLogic(BaseLogicMixin, Generic[T]):
player: int
registry: LogicRegistry
options: StardewValleyOptions
content: StardewContent
regions: Collection[str]
logic: T
def __init__(self, player: int, registry: LogicRegistry, options: StardewValleyOptions, content: StardewContent, regions: Collection[str], logic: T):
super().__init__(player, registry, options, content, regions, logic)
self.player = player
self.registry = registry
self.options = options
self.content = content
self.regions = regions
self.logic = logic