From 3cc2eed989de68ca8dd823945ca0fa2c92920e71 Mon Sep 17 00:00:00 2001 From: mimo Date: Thu, 6 Jul 2017 17:13:28 +0000 Subject: [PATCH] Petra: Fix bug in a case when an army captures its target and then tries to help another army Patch by Sandarac Reviewed By: mimo Differential Revision: https://code.wildfiregames.com/D709 This was SVN commit r19876. --- binaries/data/mods/public/simulation/ai/petra/attackPlan.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/binaries/data/mods/public/simulation/ai/petra/attackPlan.js b/binaries/data/mods/public/simulation/ai/petra/attackPlan.js index c2c5677e95..95bd758863 100644 --- a/binaries/data/mods/public/simulation/ai/petra/attackPlan.js +++ b/binaries/data/mods/public/simulation/ai/petra/attackPlan.js @@ -1799,7 +1799,7 @@ m.AttackPlan.prototype.UpdateTarget = function(gameState, events) if (!this.target || !gameState.getEntityById(this.target.id())) { if (this.Config.debug > 1) - API3.warn("Seems like our target has been destroyed. Switching."); + API3.warn("Seems like our target for plan " + this.name + " has been destroyed or captured. Switching."); this.target = this.getNearestTarget(gameState, this.position, true); if (!this.target) { @@ -1815,7 +1815,8 @@ m.AttackPlan.prototype.UpdateTarget = function(gameState, events) { if (attack.name === this.name) continue; - if (!attack.target || !gameState.getEntityById(attack.target.id())) + if (!attack.target || !gameState.getEntityById(attack.target.id()) || + !gameState.isPlayerEnemy(attack.target.owner())) continue; if (accessIndex !== gameState.ai.accessibility.getAccessValue(attack.targetPos)) continue;