mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
#3373: added exiling multiple targets in Mindbreak Trap
This commit is contained in:
parent
43586849bb
commit
83ee1252cd
2 changed files with 14 additions and 2 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue