Skip to content

Commit

Permalink
remove seasonal farming event, use regions instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouramie committed Dec 16, 2024
1 parent 728d249 commit 2d0110f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 31 deletions.
16 changes: 1 addition & 15 deletions worlds/stardew_valley/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def create_items(self):
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
Expand Down Expand Up @@ -199,20 +199,6 @@ def precollect_farm_type_items(self):
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)
Expand Down
15 changes: 7 additions & 8 deletions worlds/stardew_valley/logic/farming_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@
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,
}


Expand Down Expand Up @@ -54,7 +53,7 @@ def can_plant_and_grow_item(self, seasons: Union[str, Tuple[str]]) -> StardewRul
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:
Expand Down
4 changes: 0 additions & 4 deletions worlds/stardew_valley/strings/ap_names/event_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
5 changes: 1 addition & 4 deletions worlds/stardew_valley/test/rules/TestTools.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -74,12 +74,10 @@ def test_old_master_cannoli(self):
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)

Expand All @@ -88,7 +86,6 @@ def test_old_master_cannoli(self):
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)

Expand Down

0 comments on commit 2d0110f

Please sign in to comment.