Skip to content

Add a daily weather system that modifies fishing yield - #116

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/weather-system
Jul 20, 2026
Merged

Add a daily weather system that modifies fishing yield#116
dmccoystephenson merged 1 commit into
mainfrom
feature/weather-system

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

  • Adds a weather field to TimeService, rolled once per increaseDay() call from ["clear", "rainy", "stormy"] — the deferred stretch half of Make time-of-day (and optionally weather) affect fishing #72, alongside the already-shipped time-of-day modifier.
  • Adds Docks.getWeatherModifier(weather) (same (factor, label) shape as getTimeOfDayModifier) and combines it into the fishToAdd calculation in Docks.fish(): rain gives a catch bonus, storms a penalty, clear is neutral.
  • Surfaces the current weather in the docks descriptor text (Docks._weatherDescriptor) and in the catch report label after a fishing trip.
  • Persists weather via TimeServiceJsonReaderWriter and extends schemas/timeService.json with an enum so save validation stays in sync.

Test plan

  • python3 -m compileall -q src tests
  • python3 -m pytest --cov=src --cov-report=term-missing --cov-report=xml:cov.xml — 351 passed
  • New/updated tests cover: default weather, the daily roll (random.choice patched for determinism), schema validation (valid + out-of-enum-value rejection), reader/writer round-trip, getWeatherModifier's three branches, the fishing-yield effect, the catch-report label, and the docks descriptor text
  • Front-end parity: this only adds text through the existing showOptions/prompt-text primitives already shared by all three front-ends (console/pygame/web) — no new UI primitive was needed, so no front-end-specific change was required

Closes #110

Closes #72's deferred stretch goal: weather now rolls once per day
(clear/rainy/stormy) alongside the existing time-of-day modifier, combining
with it in Docks.fish() to give rain a catch bonus and storms a penalty.
Persisted via TimeServiceJsonReaderWriter/schemas/timeService.json and
surfaced in the docks descriptor and catch report.

Closes #110

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dmccoystephenson

dmccoystephenson commented Jul 19, 2026

Copy link
Copy Markdown
Member Author

Self-review: implementation matches the issue's suggested design closely. Verified all three front-ends (console/pygame/web) treat the docks descriptor and currentPrompt.text as opaque strings passed through showOptions/prompt rendering, so no front-end-specific code was needed for this change - it only adds text through existing shared primitives. Schema and reader-writer stay in sync (weather round-trips and is validated against the new enum, with a test for an out-of-enum value raising ValidationError). No logic errors or missed edge cases found. (Posted as a plain PR comment rather than a formal GitHub review since gh pr review / the pulls reviews API were blocked as requiring interactive approval in this headless session.)

@dmccoystephenson
dmccoystephenson merged commit 857b7e1 into main Jul 20, 2026
1 check passed
@dmccoystephenson
dmccoystephenson deleted the feature/weather-system branch July 20, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a weather system building on the time-of-day fishing modifier (the deferred half of #72)

1 participant