ComputerUtilCombat : fix mustAttack check

This commit is contained in:
Northmoc
2022-04-23 13:53:37 -04:00
parent 61d6731272
commit 773ef28329

View File

@@ -114,8 +114,12 @@ public class ComputerUtilCombat {
return false;
}
if (!StaticAbilityMustAttack.entitiesMustAttack(attacker).contains(defender)) {
return false;
final List<GameEntity> mustAttackEnts = StaticAbilityMustAttack.entitiesMustAttack(attacker);
//if it contains only attacker, it only has a non-specific must attack
if (mustAttackEnts.size() > 1 || (mustAttackEnts.size() == 1 && mustAttackEnts.get(0) != attacker)) {
if (!mustAttackEnts.contains(defender)) {
return false;
}
}
// TODO this should be a factor but needs some alignment with AttachAi