mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
Fixed infinite AI loop in TargetPermanent abilities (see #5023)
This commit is contained in:
parent
3a987f11df
commit
d06b79e9b4
1 changed files with 4 additions and 0 deletions
|
@ -500,6 +500,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
}
|
||||
if (target.getOriginalTarget() instanceof TargetPermanent) {
|
||||
List<Permanent> targets;
|
||||
TargetPermanent t = (TargetPermanent) target.getOriginalTarget();
|
||||
boolean outcomeTargets = true;
|
||||
if (outcome.isGood()) {
|
||||
targets = threats(abilityControllerId, source == null ? null : source.getSourceId(), ((TargetPermanent) target).getFilter(), game, target.getTargets());
|
||||
|
@ -512,6 +513,9 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
outcomeTargets = false;
|
||||
//targets = game.getBattlefield().getActivePermanents(((TargetPermanent)target).getFilter(), playerId, game);
|
||||
}
|
||||
if (targets.isEmpty() && target.isRequired()) {
|
||||
targets = game.getBattlefield().getActivePermanents(t.getFilter(), playerId, game);
|
||||
}
|
||||
for (Permanent permanent : targets) {
|
||||
if (((TargetPermanent) target).canTarget(abilityControllerId, permanent.getId(), source, game)) {
|
||||
target.addTarget(permanent.getId(), source, game);
|
||||
|
|
Loading…
Reference in a new issue