Stardew Valley: Remove seasonal farming event, use regions instead (#4379)

This commit is contained in:
Jouramie 2025-01-12 11:01:02 -05:00 committed by GitHub
parent 4edca0ce54
commit 0fc722cb28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 40 deletions

View File

@ -5,29 +5,23 @@ from typing import Dict, Any, Iterable, Optional, Union, List, TextIO
from BaseClasses import Region, Entrance, Location, Item, Tutorial, ItemClassification, MultiWorld, CollectionState
from Options import PerGameCommonOptions
from worlds.AutoWorld import World, WebWorld
from . import rules
from .bundles.bundle_room import BundleRoom
from .bundles.bundles import get_all_bundles
from .content import content_packs, StardewContent, unpack_content, create_content
from .content import StardewContent, create_content
from .early_items import setup_early_items
from .items import item_table, create_items, ItemData, Group, items_by_group, get_all_filler_items, remove_limited_amount_packs
from .locations import location_table, create_locations, LocationData, locations_by_tag
from .logic.bundle_logic import BundleLogic
from .logic.logic import StardewLogic
from .logic.time_logic import MAX_MONTHS
from .options import StardewValleyOptions, SeasonRandomization, Goal, BundleRandomization, EnabledFillerBuffs, NumberOfMovementBuffs, \
BuildingProgression, ExcludeGingerIsland, TrapItems, EntranceRandomization, FarmType, Walnutsanity
BuildingProgression, ExcludeGingerIsland, TrapItems, EntranceRandomization, FarmType
from .options.forced_options import force_change_options_if_incompatible
from .options.option_groups import sv_option_groups
from .options.presets import sv_options_presets
from .regions import create_regions
from .rules import set_rules
from .stardew_rule import True_, StardewRule, HasProgressionPercent, true_
from .stardew_rule import True_, StardewRule, HasProgressionPercent
from .strings.ap_names.event_names import Event
from .strings.entrance_names import Entrance as EntranceName
from .strings.goal_names import Goal as GoalName
from .strings.metal_names import Ore
from .strings.region_names import Region as RegionName, LogicRegion
logger = logging.getLogger(__name__)
@ -159,7 +153,7 @@ class StardewValleyWorld(World):
self.multiworld.itempool += created_items
setup_early_items(self.multiworld, self.options, self.content, self.player, self.random)
self.setup_player_events()
self.setup_logic_events()
self.setup_victory()
# This is really a best-effort to get the total progression items count. It is mostly used to spread grinds across spheres are push back locations that
@ -199,20 +193,6 @@ class StardewValleyWorld(World):
if self.options.farm_type == FarmType.option_meadowlands and self.options.building_progression & BuildingProgression.option_progressive:
self.multiworld.push_precollected(self.create_starting_item("Progressive Coop"))
def setup_player_events(self):
self.setup_action_events()
self.setup_logic_events()
def setup_action_events(self):
spring_farming = LocationData(None, LogicRegion.spring_farming, Event.spring_farming)
self.create_event_location(spring_farming, true_, Event.spring_farming)
summer_farming = LocationData(None, LogicRegion.summer_farming, Event.summer_farming)
self.create_event_location(summer_farming, true_, Event.summer_farming)
fall_farming = LocationData(None, LogicRegion.fall_farming, Event.fall_farming)
self.create_event_location(fall_farming, true_, Event.fall_farming)
winter_farming = LocationData(None, LogicRegion.winter_farming, Event.winter_farming)
self.create_event_location(winter_farming, true_, Event.winter_farming)
def setup_logic_events(self):
def register_event(name: str, region: str, rule: StardewRule):
event_location = LocationData(None, region, name)

View File

@ -10,17 +10,16 @@ from .season_logic import SeasonLogicMixin
from .tool_logic import ToolLogicMixin
from .. import options
from ..stardew_rule import StardewRule, True_, false_
from ..strings.ap_names.event_names import Event
from ..strings.fertilizer_names import Fertilizer
from ..strings.region_names import Region
from ..strings.region_names import Region, LogicRegion
from ..strings.season_names import Season
from ..strings.tool_names import Tool
farming_event_by_season = {
Season.spring: Event.spring_farming,
Season.summer: Event.summer_farming,
Season.fall: Event.fall_farming,
Season.winter: Event.winter_farming,
farming_region_by_season = {
Season.spring: LogicRegion.spring_farming,
Season.summer: LogicRegion.summer_farming,
Season.fall: LogicRegion.fall_farming,
Season.winter: LogicRegion.winter_farming,
}
@ -54,7 +53,7 @@ class FarmingLogic(BaseLogic[Union[HasLogicMixin, ReceivedLogicMixin, RegionLogi
if isinstance(seasons, str):
seasons = (seasons,)
return self.logic.or_(*(self.logic.received(farming_event_by_season[season]) for season in 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.options.exclude_ginger_island == options.ExcludeGingerIsland.option_false:

View File

@ -8,9 +8,5 @@ def event(name: str):
class Event:
victory = event("Victory")
spring_farming = event("Spring Farming")
summer_farming = event("Summer Farming")
fall_farming = event("Fall Farming")
winter_farming = event("Winter Farming")
received_walnuts = event("Received Walnuts")

View File

@ -1,7 +1,7 @@
from collections import Counter
from .. import SVTestBase
from ... import Event, options
from ... import options
from ...options import ToolProgression, SeasonRandomization
from ...strings.entrance_names import Entrance
from ...strings.region_names import Region
@ -74,12 +74,10 @@ class TestProgressiveToolsLogic(SVTestBase):
self.assert_rule_true(rule, self.multiworld.state)
self.remove(fall)
self.remove(self.create_item(Event.fall_farming))
self.assert_rule_false(rule, self.multiworld.state)
self.remove(tuesday)
green_house = self.create_item("Greenhouse")
self.collect(self.create_item(Event.fall_farming))
self.multiworld.state.collect(green_house)
self.assert_rule_false(rule, self.multiworld.state)
@ -88,7 +86,6 @@ class TestProgressiveToolsLogic(SVTestBase):
self.assertTrue(self.multiworld.get_location("Old Master Cannoli", 1).access_rule(self.multiworld.state))
self.remove(green_house)
self.remove(self.create_item(Event.fall_farming))
self.assert_rule_false(rule, self.multiworld.state)
self.remove(friday)