Add the promised Retire option to the Home menu#112
Conversation
… is reached The README and in-game victory message both tell players they can retire from the Home menu once they hit the $10,000 wealth goal, but no such option existed. Retire now appears in the Home menu once the goal milestone is earned, shows a closing career summary, and ends the run. Closes #107 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
{ |
|
Self-review: no issues found. (Correcting the previous comment — that one accidentally posted the raw JSON body meant for the reviews API instead of its text.) Verified:
|
There was a problem hiding this comment.
Pull request overview
Adds the missing “Retire from the Home menu” flow that is promised by the README and the in-game goal message, unlocking it only after the wealth-goal milestone has been earned.
Changes:
- Adds a goal-gated
Retireoption to the Home menu and a retirement summary dialogue that ends the run. - Refactors Home stats rendering by factoring stat-line assembly into a shared helper used by both Stats and Retire flows.
- Moves
GOAL_AMOUNT/GOAL_MILESTONE_NAMEconstants intoachievements/achievements.pyand re-exports them fromfishE.py; adds Home-menu coverage in tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/location/test_home.py | Adds tests for Retire visibility/selection behavior and validates retirement summary content. |
| src/location/home.py | Implements the Retire menu option (gated on earned milestone), adds retire() flow, and refactors stats lines into _statsLines(). |
| src/fishE.py | Imports goal constants from achievements to avoid circular imports while keeping fishE.GOAL_* available to callers/tests. |
| src/achievements/achievements.py | Defines goal constants alongside milestone definitions so Home and FishE can share them. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| self.currentPrompt.text = "What would you like to do?" | ||
| return LocationType.DOCKS | ||
| elif self.input == "5": | ||
| elif retireAvailable and self.input == "5": |
| self.userInterface.showDialogue("\n".join(self._statsLines())) | ||
|
|
||
| def retire(self): | ||
| """Show a closing summary and end the run, reusing displayStats()'s lines.""" |
Summary
Home.run()now offers aRetireoption, inserted beforeQuit, onceachievements.GOAL_MILESTONE_NAMEis present instats.earnedMilestones(the same flagFishE.announceGoalIfReachedalready sets).Retireshows a closing career summary (reusing the same stat linesdisplayStats()already assembles, factored into a shared_statsLines()helper) and ends the run the same wayQuitdoes.GOAL_AMOUNT/GOAL_MILESTONE_NAMEconstants fromfishE.pyintoachievements/achievements.pysohome.pycan read them without a circular import (fishE.pyalready importslocation.home);fishE.pyre-imports them sofishE.GOAL_AMOUNT/fishE.GOAL_MILESTONE_NAMEstill resolve for existing callers/tests.Test plan
python3 -m compileall -q src testspython3 -m pytest -q --cov=src --cov-report=term-missing --cov-report=xml:cov.xml— 329 passed,home.pyat 99% coveragetests/location/test_home.py: Retire hidden before the goal is reached, Retire appears and is selectable right before Quit after the goal is reached, Quit still works once the option list has shifted, and the retire summary includes the stat linesHomeonly calls the genericshowOptions/showDialogueprimitives (no per-frontend helper methods), which all three front-ends (console, pygame, web) already implement generically for any option list/dialogue text — no per-frontend changes were neededschemas/*.jsonchanges needed — no new persisted fields were added, this only reuses the existingearnedMilestoneslist already covered byschemas/stats.jsonCloses #107