From 7842aa046859d9ec86cf50c35a6b7be25af2f5b7 Mon Sep 17 00:00:00 2001 From: mimo Date: Thu, 10 Sep 2015 19:27:18 +0000 Subject: [PATCH] petra: do not loose time attacking useless structures This was SVN commit r17001. --- .../data/mods/public/simulation/ai/petra/defenseManager.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/binaries/data/mods/public/simulation/ai/petra/defenseManager.js b/binaries/data/mods/public/simulation/ai/petra/defenseManager.js index eaa5d05485..52a8467536 100644 --- a/binaries/data/mods/public/simulation/ai/petra/defenseManager.js +++ b/binaries/data/mods/public/simulation/ai/petra/defenseManager.js @@ -182,11 +182,13 @@ m.DefenseManager.prototype.checkEnemyUnits = function(gameState) if (i !== 0 || this.armies.length > 1 || gameState.ai.HQ.numActiveBase() === 0) return; // look for possible gaia buildings inside our territory (may happen when enemy resign or after structure decay) + // and attack it only if useful (and capturable) or dangereous for (let ent of gameState.getEnemyStructures(i).values()) { if (!ent.position() || ent.getMetadata(PlayerID, "PartOfArmy") !== undefined) continue; - + if (!ent.capturePoints() && !ent.hasDefensiveFire()) + continue; let owner = this.territoryMap.getOwner(ent.position());; if (owner === PlayerID) this.makeIntoArmy(gameState, ent.id());