Fix AI bot turn completion - remove isAIThinking block in endTurn()
This commit is contained in:
@@ -516,8 +516,8 @@ class GameUI {
|
|||||||
|
|
||||||
async endTurn() {
|
async endTurn() {
|
||||||
if (this.gamePhase !== 'movement') return;
|
if (this.gamePhase !== 'movement') return;
|
||||||
if (this.isAIThinking) return;
|
// Remove isAIThinking check - AI needs to call endTurn() after its move
|
||||||
|
|
||||||
// Apply supply
|
// Apply supply
|
||||||
const supply = this.map.calculateSupply(this.currentPlayer);
|
const supply = this.map.calculateSupply(this.currentPlayer);
|
||||||
this.distributeSupply(supply);
|
this.distributeSupply(supply);
|
||||||
@@ -541,11 +541,10 @@ class GameUI {
|
|||||||
if (this.playerTypes[this.currentPlayer] === 'ai' && this.aiBots[this.currentPlayer]) {
|
if (this.playerTypes[this.currentPlayer] === 'ai' && this.aiBots[this.currentPlayer]) {
|
||||||
this.isAIThinking = true;
|
this.isAIThinking = true;
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
|
|
||||||
// Run AI turn
|
// Run AI turn and reset flag when done
|
||||||
this.aiBots[this.currentPlayer].playTurn().then(() => {
|
this.aiBots[this.currentPlayer].playTurn().then(() => {
|
||||||
this.isAIThinking = false;
|
this.isAIThinking = false;
|
||||||
// AI will call endTurn() when done
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user