#3373: added exiling multiple targets in Mindbreak Trap

This commit is contained in:
magenoxx 2017-05-16 20:17:40 +03:00
parent 43586849bb
commit 83ee1252cd
2 changed files with 14 additions and 2 deletions

View file

@ -58,7 +58,7 @@ public class MindbreakTrap extends CardImpl {
// Exile any number of target spells.
this.getSpellAbility().addTarget(new TargetSpell(0, Integer.MAX_VALUE, filter));
this.getSpellAbility().addEffect(new ExileTargetEffect("Exile any number of target spells"));
this.getSpellAbility().addEffect(new ExileTargetEffect("Exile any number of target spells", true));
}
public MindbreakTrap(final MindbreakTrap card) {

View file

@ -58,8 +58,13 @@ public class ExileTargetEffect extends OneShotEffect {
protected boolean multitargetHandling;
public ExileTargetEffect(String effectText) {
this(effectText, false);
}
public ExileTargetEffect(String effectText, boolean multitargetHandling) {
this();
this.staticText = effectText;
this.multitargetHandling = multitargetHandling;
}
public ExileTargetEffect() {
@ -100,7 +105,9 @@ public class ExileTargetEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Set<Card> toExile = new LinkedHashSet<>();
if (multitargetHandling && source.getTargets().size() > 1 && targetPointer instanceof FirstTargetPointer) { // Decimate
if (multitargetHandling
&& targetPointer instanceof FirstTargetPointer
&& (source.getTargets().size() > 1 || (source.getTargets().size() > 0 && source.getTargets().get(0).getTargets().size() > 1))) {
for (Target target : source.getTargets()) {
for (UUID targetId : target.getTargets()) {
Permanent permanent = game.getPermanent(targetId);
@ -116,6 +123,11 @@ public class ExileTargetEffect extends OneShotEffect {
if (currentZone != Zone.EXILED && (onlyFromZone == null || onlyFromZone == currentZone)) {
toExile.add(card);
}
} else {
StackObject stackObject = game.getStack().getStackObject(targetId);
if (stackObject instanceof Spell) {
toExile.add((Spell) stackObject);
}
}
}
}