1
0
forked from 0ad/0ad

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.
This commit is contained in:
wraitii 2023-06-23 07:22:43 +00:00
parent 7df7566d7c
commit 3190729f85

View File

@ -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.