* AI: fixed rollback errors on play cards with target stack (Diplomatic Escort, Not of This World, etc);

This commit is contained in:
Oleg Agafonov 2020-03-09 13:49:07 +04:00
parent 009e55c4f0
commit 86f6d39f5a
5 changed files with 126 additions and 101 deletions

View file

@ -819,10 +819,13 @@ public class ComputerPlayer extends PlayerImpl implements Player {
return target.isChosen();
}
if (target.getOriginalTarget() instanceof TargetSpell) {
if (target.getOriginalTarget() instanceof TargetSpell
|| target.getOriginalTarget() instanceof TargetStackObject) {
if (!game.getStack().isEmpty()) {
for (StackObject o : game.getStack()) {
if (o instanceof Spell && !source.getId().equals(o.getStackAbility().getId())) {
if (o instanceof Spell
&& !source.getId().equals(o.getStackAbility().getId())
&& target.canTarget(abilityControllerId, o.getStackAbility().getId(), source, game)) {
return tryAddTarget(target, o.getId(), source, game);
}
}