Play pair sound before element check and add pair detection debug log
Sound was gated behind element check which may fail during swap animation when card DOM elements are replaced by overlays. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2592,6 +2592,7 @@ class GolfGame {
|
||||
|
||||
if (!wasPaired && nowPaired) {
|
||||
// New pair formed!
|
||||
console.log('[PAIR] New pair detected for', newPlayer.name, 'col', top, bottom, 'isLocal:', newPlayer.id === this.playerId);
|
||||
setTimeout(() => {
|
||||
this.firePairCelebration(newPlayer.id, top, bottom);
|
||||
}, window.TIMING?.celebration?.pairDelay || 50);
|
||||
@@ -2607,10 +2608,10 @@ class GolfGame {
|
||||
}
|
||||
|
||||
firePairCelebration(playerId, pos1, pos2) {
|
||||
this.playSound('pair');
|
||||
const elements = this.getCardElements(playerId, pos1, pos2);
|
||||
if (elements.length < 2) return;
|
||||
|
||||
this.playSound('pair');
|
||||
if (window.cardAnimations) {
|
||||
window.cardAnimations.celebratePair(elements[0], elements[1]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user