From 3190729f85b7d4f3eb5c7fb250555b7e87f71b00 Mon Sep 17 00:00:00 2001 From: wraitii Date: Fri, 23 Jun 2023 07:22:43 +0000 Subject: [PATCH] Small bugfix in Petra's Defense manager We were incorrectly comparing an object to a number. I don't think this will drastically change the AI behaviour as it's rather an edge case. Reviewed By: Freagarach Differential Revision: https://code.wildfiregames.com/D5030 This was SVN commit r27732. --- .../data/mods/public/simulation/ai/petra/defenseManager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/binaries/data/mods/public/simulation/ai/petra/defenseManager.js b/binaries/data/mods/public/simulation/ai/petra/defenseManager.js index 64351c0ec5..26fc1aa26e 100644 --- a/binaries/data/mods/public/simulation/ai/petra/defenseManager.js +++ b/binaries/data/mods/public/simulation/ai/petra/defenseManager.js @@ -684,12 +684,12 @@ PETRA.DefenseManager.prototype.checkEvents = function(gameState, events) { let unitAIState = target.unitAIState(); let unitAIStateOrder = unitAIState ? unitAIState.split(".")[1] : ""; - if (unitAIStateOrder == "COMBAT" && (currentTarget == attacker.id() || + if (unitAIStateOrder === "COMBAT" && (currentTarget.id() === attacker.id() || !currentTarget.hasClasses(["Structure", "Support"]))) continue; - if (unitAIStateOrder == "REPAIR" && currentTarget.hasDefensiveFire()) + if (unitAIStateOrder === "REPAIR" && currentTarget.hasDefensiveFire()) continue; - if (unitAIStateOrder == "COMBAT" && !PETRA.isSiegeUnit(currentTarget) && + if (unitAIStateOrder === "COMBAT" && !PETRA.isSiegeUnit(currentTarget) && gameState.ai.HQ.capturableTargets.has(orderData[0].target)) { // Take the nearest unit also attacking this structure to help us.