Fix knocker highlight not showing on opponents
markKnocker() was called before opponent areas were rebuilt by innerHTML='', so the is-knocker class and OUT badge were immediately destroyed. Move markKnocker to after opponent areas are created. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
86f5222746
commit
e2a90c0f34
@ -3791,14 +3791,19 @@ class GolfGame {
|
|||||||
if (mobileTotal) mobileTotal.textContent = this.gameState.total_rounds;
|
if (mobileTotal) mobileTotal.textContent = this.gameState.total_rounds;
|
||||||
|
|
||||||
// Show/hide final turn badge with enhanced urgency
|
// Show/hide final turn badge with enhanced urgency
|
||||||
|
// Note: markKnocker() is deferred until after opponent areas are rebuilt below
|
||||||
const isFinalTurn = this.gameState.phase === 'final_turn';
|
const isFinalTurn = this.gameState.phase === 'final_turn';
|
||||||
if (isFinalTurn) {
|
if (isFinalTurn) {
|
||||||
this.updateFinalTurnDisplay();
|
this.gameScreen.classList.add('final-turn-active');
|
||||||
|
this.finalTurnBadge.classList.remove('hidden');
|
||||||
|
if (!this.finalTurnAnnounced) {
|
||||||
|
this.playSound('alert');
|
||||||
|
this.finalTurnAnnounced = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.finalTurnBadge.classList.add('hidden');
|
this.finalTurnBadge.classList.add('hidden');
|
||||||
this.gameScreen.classList.remove('final-turn-active');
|
this.gameScreen.classList.remove('final-turn-active');
|
||||||
this.finalTurnAnnounced = false;
|
this.finalTurnAnnounced = false;
|
||||||
this.clearKnockerMark();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle not-my-turn class to disable hover effects when it's not player's turn
|
// Toggle not-my-turn class to disable hover effects when it's not player's turn
|
||||||
@ -4164,6 +4169,13 @@ class GolfGame {
|
|||||||
// Update scoreboard panel
|
// Update scoreboard panel
|
||||||
this.updateScorePanel();
|
this.updateScorePanel();
|
||||||
|
|
||||||
|
// Mark knocker AFTER opponent areas are rebuilt (otherwise innerHTML='' wipes it)
|
||||||
|
if (this.gameState.phase === 'final_turn') {
|
||||||
|
this.markKnocker(this.gameState.finisher_id);
|
||||||
|
} else {
|
||||||
|
this.clearKnockerMark();
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize anime.js hover listeners on newly created cards
|
// Initialize anime.js hover listeners on newly created cards
|
||||||
if (window.cardAnimations) {
|
if (window.cardAnimations) {
|
||||||
window.cardAnimations.initHoverListeners(this.playerCards);
|
window.cardAnimations.initHoverListeners(this.playerCards);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user