Files
dockipelago/worlds/stardew_valley/logic/farming_logic.py
agilbert1412 1de91fab67 Stardew Valley: 7.x.x - The Jojapocalypse Update (#5432)
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.
2026-02-15 18:02:21 +01:00

75 lines
2.8 KiB
Python

from functools import cached_property
from typing import Union, Tuple
from Utils import cache_self1
from .base_logic import BaseLogicMixin, BaseLogic
from ..content.vanilla.ginger_island import ginger_island_content_pack
from ..stardew_rule import StardewRule
from ..strings.ap_names.ap_option_names import CustomLogicOptionName
from ..strings.craftable_names import Bomb
from ..strings.fertilizer_names import Fertilizer
from ..strings.region_names import Region, LogicRegion
from ..strings.season_names import Season
from ..strings.tool_names import Tool
farming_region_by_season = {
Season.spring: LogicRegion.spring_farming,
Season.summer: LogicRegion.summer_farming,
Season.fall: LogicRegion.fall_farming,
Season.winter: LogicRegion.winter_farming,
}
class FarmingLogicMixin(BaseLogicMixin):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.farming = FarmingLogic(*args, **kwargs)
class FarmingLogic(BaseLogic):
@cached_property
def has_farming_tools_and_water(self) -> StardewRule:
if CustomLogicOptionName.rain_watering in self.options.custom_logic:
return self.has_hoeing_tool
return self.has_hoeing_tool & self.logic.tool.can_water()
@cached_property
def has_farming_and_watering_tools(self) -> StardewRule:
return self.has_hoeing_tool & self.logic.tool.can_water()
@cached_property
def has_hoeing_tool(self) -> StardewRule:
if CustomLogicOptionName.bomb_hoeing in self.options.custom_logic:
return self.logic.tool.has_tool(Tool.hoe) | self.logic.has_any(Bomb.cherry_bomb, Bomb.bomb, Bomb.mega_bomb)
return self.logic.tool.has_tool(Tool.hoe)
def has_fertilizer(self, tier: int) -> StardewRule:
assert 0 <= tier <= 3
if tier == 0:
return self.logic.true_
if tier == 1:
return self.logic.has(Fertilizer.basic)
if tier == 2:
return self.logic.has(Fertilizer.quality)
if tier == 3:
return self.logic.has(Fertilizer.deluxe)
return self.logic.false_
@cache_self1
def can_plant_and_grow_item(self, seasons: Union[str, Tuple[str]]) -> StardewRule:
if seasons == (): # indoor farming
return (self.logic.region.can_reach(Region.greenhouse) & self.logic.farming.has_farming_and_watering_tools) |\
(self.logic.farming.has_island_farm() & self.logic.farming.has_farming_tools_and_water)
if isinstance(seasons, str):
seasons = (seasons,)
return self.logic.or_(*(self.logic.region.can_reach(farming_region_by_season[season]) for season in seasons))
def has_island_farm(self) -> StardewRule:
if self.content.is_enabled(ginger_island_content_pack):
return self.logic.region.can_reach(Region.island_west)
return self.logic.false_