- Fixed the AI changing targets of triggers with "OptionalDecider" before resolving.

This commit is contained in:
Sloth
2012-09-27 16:14:55 +00:00
parent 1f7a5906ec
commit 4e039e9ba4
3 changed files with 23 additions and 1 deletions

View File

@@ -124,6 +124,17 @@ public class TargetChoices {
return false;
}
/**
* <p>
* clear.
* </p>
*/
public final void clear() {
this.targetPlayers.clear();
this.targetCards.clear();
this.targetSAs.clear();
}
/**
* <p>
* removeTarget.

View File

@@ -978,10 +978,21 @@ public class TriggerHandler {
}
}
} else {
ArrayList<Object> tgts = null;
// make sure the targets won't change
if (sa[0].getTarget() != null) {
tgts = new ArrayList<Object>(sa[0].getTarget().getTargetChoices().getTargets());
}
// This isn't quite right, but better than canPlayAI
if (!sa[0].doTrigger(isMandatory)) {
return;
}
if (sa[0].getTarget() != null) {
for (Object tgt : tgts) {
sa[0].getTarget().getTargetChoices().clear();
sa[0].getTarget().getTargetChoices().addTarget(tgt);
}
}
}
}