feat(engine): playability improvements — input intelligence, audio, HUD, onboarding (#27–#30, #37, #39–#40, #44, #48–#49)

Task #27: Double-click auto-move — best_destination() finds optimal target
(foundation over tableau); handle_double_click() fires MoveRequestEvent.

Task #28: Hint system — find_hint() returns first legal from/to/count triple;
H key tints the source stack HintHighlight (yellow pulse via tick_hint_highlight).

Task #29: No-moves detection — has_legal_moves() checks stock/waste/all face-up
cards; check_no_moves system fires InfoToastEvent("No moves available") once per
stalemate (debounced so it fires only once until the state changes).

Task #30: Forfeit — G key fires ForfeitEvent; StatsPlugin records abandoned game,
persists stats, starts a new deal.

Task #37: Mute-all (M) and mute-music (Shift+M) toggles; MuteState resource
applied in apply_volume_on_change.

Task #39: Daily challenge HUD constraint label (time limit / target score).

Task #40: Undo-count HUD label; amber colour when undos > 0.

Task #44: Win-streak and level line on pause screen.

Task #48: Undo sound routes UndoRequestEvent → lib.flip audio channel.

Task #49: Onboarding banner rich-text key highlights — D and H rendered as
orange KeyHighlightSpan children so they stand out from body text.

Also registers CursorPlugin in solitaire_app (tasks #31/#32 wire-up).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-04-27 19:11:47 +00:00
parent c3ee7c45a7
commit ddd7502a06
16 changed files with 1269 additions and 46 deletions
+22
View File
@@ -642,4 +642,26 @@ mod tests {
assert_eq!(merged.progress.weekly_goal_week_iso, Some("2026-W17".to_string()));
assert_eq!(merged.progress.weekly_goal_progress.get("weekly_5_wins"), Some(&1));
}
#[test]
fn fastest_win_both_max_sentinel_stays_max() {
// Both sides have u64::MAX (no wins recorded on either) — result must remain MAX,
// not wrap or clamp to 0.
let local = default_payload();
let remote = default_payload();
assert_eq!(local.stats.fastest_win_seconds, u64::MAX);
assert_eq!(remote.stats.fastest_win_seconds, u64::MAX);
let (merged, _) = merge(&local, &remote);
assert_eq!(merged.stats.fastest_win_seconds, u64::MAX);
}
#[test]
fn fastest_win_one_side_max_takes_real_value() {
// Local has no wins (u64::MAX); remote has a real win. Merged must use the real time.
let local = default_payload(); // fastest_win_seconds = u64::MAX
let mut remote = default_payload();
remote.stats.fastest_win_seconds = 300;
let (merged, _) = merge(&local, &remote);
assert_eq!(merged.stats.fastest_win_seconds, 300);
}
}