From 64c81da166b015160949214d59dcabee1d9bace8 Mon Sep 17 00:00:00 2001 From: sokol Date: Sat, 21 Feb 2026 20:48:29 +0300 Subject: [PATCH] Fix AI bot turn completion - remove isAIThinking block in endTurn() --- public/game.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/public/game.js b/public/game.js index 18b6c96..ceeae9b 100644 --- a/public/game.js +++ b/public/game.js @@ -516,8 +516,8 @@ class GameUI { async endTurn() { if (this.gamePhase !== 'movement') return; - if (this.isAIThinking) return; - + // Remove isAIThinking check - AI needs to call endTurn() after its move + // Apply supply const supply = this.map.calculateSupply(this.currentPlayer); this.distributeSupply(supply); @@ -541,11 +541,10 @@ class GameUI { if (this.playerTypes[this.currentPlayer] === 'ai' && this.aiBots[this.currentPlayer]) { this.isAIThinking = true; this.updateUI(); - - // Run AI turn + + // Run AI turn and reset flag when done this.aiBots[this.currentPlayer].playTurn().then(() => { this.isAIThinking = false; - // AI will call endTurn() when done }); } }