diff --git a/binaries/data/mods/public/simulation/ai/petra/_petrabot.js b/binaries/data/mods/public/simulation/ai/petra/_petrabot.js index 429d1072ae..190ce44506 100644 --- a/binaries/data/mods/public/simulation/ai/petra/_petrabot.js +++ b/binaries/data/mods/public/simulation/ai/petra/_petrabot.js @@ -84,8 +84,8 @@ PetraBot.prototype.CustomInit = function(gameState) this.HQ.init(gameState, this.queues); - // Analyze our starting position and set a strategy - this.HQ.gameAnalysis(gameState); + // Try to analyze our starting position and set a strategy. + this.canPlay = this.HQ.gameAnalysis(gameState); } }; @@ -112,10 +112,10 @@ PetraBot.prototype.OnUpdate = function(sharedScript) this.playedTurn++; - if (this.gameState.getOwnEntities().length === 0) + if (!this.canPlay) { Engine.ProfileStop(); - return; // With no entities to control the AI cannot do anything + return; } this.HQ.update(this.gameState, this.queues, this.savedEvents); diff --git a/binaries/data/mods/public/simulation/ai/petra/startingStrategy.js b/binaries/data/mods/public/simulation/ai/petra/startingStrategy.js index f0d19c602d..8e359f7b60 100644 --- a/binaries/data/mods/public/simulation/ai/petra/startingStrategy.js +++ b/binaries/data/mods/public/simulation/ai/petra/startingStrategy.js @@ -17,7 +17,7 @@ Headquarters.prototype.gameAnalysis = function(gameState) { // Analysis of the terrain and the different access regions if (!this.regionAnalysis(gameState)) - return; + return false; this.attackManager.init(gameState); this.buildManager.init(gameState); @@ -57,6 +57,8 @@ Headquarters.prototype.gameAnalysis = function(gameState) // configure our first base strategy if (this.hasPotentialBase()) this.configFirstBase(gameState); + + return true; }; /**