Fix opponent draw-from-discard animation showing wrong card

Force discard pile DOM update before draw animation starts to prevent
stale card display when previous swap animation blocked renderGame.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
adlee-was-taken 2026-02-23 20:26:24 -05:00
parent 86697dd454
commit b129aa4f29

View File

@ -2450,8 +2450,13 @@ class GolfGame {
this.opponentDiscardAnimating = false; this.opponentDiscardAnimating = false;
// Set isDrawAnimating to block renderGame from updating discard pile // Set isDrawAnimating to block renderGame from updating discard pile
this.isDrawAnimating = true; this.isDrawAnimating = true;
// Force discard DOM to show the card being drawn before animation starts
// (previous animation may have blocked renderGame from updating it)
if (oldDiscard) {
this.updateDiscardPileDisplay(oldDiscard);
}
console.log('[DEBUG] Opponent draw from discard - setting isDrawAnimating=true'); console.log('[DEBUG] Opponent draw from discard - setting isDrawAnimating=true');
window.drawAnimations.animateDrawDiscard(drawnCard, () => { window.drawAnimations.animateDrawDiscard(oldDiscard || drawnCard, () => {
console.log('[DEBUG] Opponent draw from discard complete - clearing isDrawAnimating'); console.log('[DEBUG] Opponent draw from discard complete - clearing isDrawAnimating');
this.isDrawAnimating = false; this.isDrawAnimating = false;
onAnimComplete(); onAnimComplete();