- Fixed a possible infinite loop caused by creatures with "can't attack alone" and "must attack if able".

This commit is contained in:
Sloth
2015-07-14 22:07:30 +00:00
parent 03c49d48d4
commit 4ad634b57e
2 changed files with 5 additions and 0 deletions

View File

@@ -1138,6 +1138,9 @@ public class AiController {
for (final Map.Entry<Card, GameEntity> mandatoryAttacker : legal.entrySet()) {
combat.addAttacker(mandatoryAttacker.getKey(), mandatoryAttacker.getValue());
}
if (!CombatUtil.validateAttackers(combat)) {
aiAtk.declareAttackers(combat);
}
}
for (final Card element : combat.getAttackers()) {

View File

@@ -298,6 +298,8 @@ public class AttackConstraints {
final int previousNeeded = attackersNeeded;
attackersNeeded = Ints.max(3 - (myAttackers.size() + reserved.size()), 0);
localMaximum -= Ints.max(attackersNeeded - previousNeeded, 0);
} else if (restrictions.get(req.attacker).getTypes().contains(AttackRestrictionType.NOT_ALONE)) {
attackersNeeded = Ints.max(2 - (myAttackers.size() + reserved.size()), 0);
}
}