mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- Fixed a possible infinite loop caused by creatures with "can't attack alone" and "must attack if able".
This commit is contained in:
@@ -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()) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user