feat(core,engine): "Cinephile" achievement for completing a replay
Adds a 19th achievement: "Cinephile — Watch a saved replay all the way through." Unlocks the first time ReplayPlaybackState transitions Playing → Completed (i.e. the move list runs out without the player pressing Stop). Discoverability nudge for the replay feature itself. The achievement uses the existing event-driven unlock pattern (condition closure returns false; an unlock system fires AchievementUnlockedEvent on the right state transition) rather than the standard condition-evaluation path, mirroring how other non-stat-driven achievements work. The unlock system distinguishes natural completion from Stop-button abort by watching for the specific Playing → Completed transition; Stop transitions Playing → Inactive directly without going through Completed, so it doesn't fire the achievement. Already-unlocked state is checked via AchievementsResource so the achievement can't double-fire on subsequent replays. README's "18 Achievements" → "19 Achievements". ARCHITECTURE.md §11 gains a Cinephile entry alongside the existing 18. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -716,11 +716,14 @@ pub struct AchievementDef {
|
||||
| `speed_and_skill` | ??? | Win < 90s without undo | Yes | Card back #4 |
|
||||
| `comeback` | ??? | Win after 3+ stock recycles | Yes | Background #4 |
|
||||
| `zen_winner` | ??? | Win in Zen Mode | Yes | Badge |
|
||||
| `cinephile` | Cinephile | Watch a saved replay all the way through | No | — |
|
||||
|
||||
### Evaluation Timing
|
||||
|
||||
Achievement conditions are evaluated by `AchievementPlugin` on every `GameWonEvent` and `StateChangedEvent`. The plugin calls `solitaire_core::check_achievements()` which returns a `Vec<AchievementDef>` of newly unlocked achievements. The plugin then fires `AchievementUnlockedEvent` for each, which the toast and persistence systems handle independently.
|
||||
|
||||
A small number of achievements are *event-driven* rather than condition-driven: their `AchievementDef::condition` always returns `false` and their unlock is written from a dedicated observer system instead. `cinephile` is the canonical example — it unlocks when `ReplayPlaybackState` transitions from `Playing` to `Completed` (a saved replay watched to its natural end). The Stop button transitions `Playing → Inactive` directly without entering `Completed`, so manual aborts do not unlock the achievement.
|
||||
|
||||
---
|
||||
|
||||
## 12. Progression System
|
||||
|
||||
Reference in New Issue
Block a user