Speed up score animations and fix end-of-round UI

- Cut reveal/tally/celebration timings by ~50% for snappier round end
- Add dealAnimationInProgress flag to suppress flip prompts during deal
- Stop deck/discard pulse animation when round ends
- Update CLAUDE.md with animation race condition documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
adlee-was-taken
2026-02-14 08:45:44 -05:00
parent 49b2490c25
commit 8431cd6fd1
2 changed files with 25 additions and 15 deletions

View File

@@ -56,6 +56,9 @@ class GolfGame {
// Track opponent discard animation in progress (prevent renderGame from updating discard)
this.opponentDiscardAnimating = false;
// Track deal animation in progress (suppress flip prompts until dealing complete)
this.dealAnimationInProgress = false;
// Track round winners for visual highlight
this.roundWinnerNames = new Set();
@@ -1510,11 +1513,16 @@ class GolfGame {
this.playerCards.style.visibility = 'hidden';
this.opponentsRow.style.visibility = 'hidden';
// Suppress flip prompts until dealing complete
this.dealAnimationInProgress = true;
if (window.cardAnimations) {
window.cardAnimations.animateDealing(
this.gameState,
(playerId, cardIdx) => this.getCardSlotRect(playerId, cardIdx),
() => {
// Deal complete - allow flip prompts
this.dealAnimationInProgress = false;
// Show real cards
this.playerCards.style.visibility = 'visible';
this.opponentsRow.style.visibility = 'visible';
@@ -1525,6 +1533,7 @@ class GolfGame {
);
} else {
// Fallback
this.dealAnimationInProgress = false;
this.playerCards.style.visibility = 'visible';
this.opponentsRow.style.visibility = 'visible';
this.playSound('shuffle');
@@ -3386,7 +3395,8 @@ class GolfGame {
// Update deck/discard clickability and visual state
// Use visual check so indicators sync with opponent swap animation
const hasDrawn = this.drawnCard || this.gameState.has_drawn_card;
const canDraw = this.isVisuallyMyTurn() && !hasDrawn && !this.gameState.waiting_for_initial_flip;
const isRoundActive = this.gameState.phase !== 'round_over' && this.gameState.phase !== 'game_over';
const canDraw = isRoundActive && this.isVisuallyMyTurn() && !hasDrawn && !this.gameState.waiting_for_initial_flip;
// Pulse the deck area when it's player's turn to draw
const wasTurnToDraw = this.deckArea.classList.contains('your-turn-to-draw');
@@ -3516,8 +3526,8 @@ class GolfGame {
this.renderPairIndicators();
// Show flip prompt for initial flip
// Show flip prompt during initial flip phase
if (this.gameState.waiting_for_initial_flip) {
// Show flip prompt during initial flip phase (but not during deal animation)
if (this.gameState.waiting_for_initial_flip && !this.dealAnimationInProgress) {
const requiredFlips = this.gameState.initial_flips || 2;
const flippedCount = this.locallyFlippedCards.size;
const remaining = requiredFlips - flippedCount;