feat(core): add achievement module with 14 unlock conditions
Introduces AchievementContext (stats + last-win snapshot), AchievementDef, ALL_ACHIEVEMENTS, and check_achievements. Adds undo_count to GameState so the no_undo and speed_and_skill conditions are evaluable. Skipped achievements that depend on features not yet built: daily_devotee (progress), comeback (recycle counter), zen_winner (modes), perfectionist (max-score calc). They land in later phases. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,9 @@ pub struct GameState {
|
||||
pub seed: u64,
|
||||
pub is_won: bool,
|
||||
pub is_auto_completable: bool,
|
||||
/// Number of times `undo()` has been successfully invoked this game.
|
||||
/// Used by achievement conditions like `no_undo`.
|
||||
pub undo_count: u32,
|
||||
undo_stack: Vec<StateSnapshot>,
|
||||
}
|
||||
|
||||
@@ -64,6 +67,7 @@ impl GameState {
|
||||
seed,
|
||||
is_won: false,
|
||||
is_auto_completable: false,
|
||||
undo_count: 0,
|
||||
undo_stack: Vec::new(),
|
||||
}
|
||||
}
|
||||
@@ -242,6 +246,7 @@ impl GameState {
|
||||
self.move_count = snapshot.move_count;
|
||||
self.is_won = false;
|
||||
self.is_auto_completable = false;
|
||||
self.undo_count = self.undo_count.saturating_add(1);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user