mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Remove custom multitarget handling from DestroyTargetEffect (use EachTargetPointer instead)
This commit is contained in:
parent
addfd5166e
commit
e3b8a813e5
24 changed files with 124 additions and 217 deletions
|
@ -1,8 +1,6 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DestroyAllEffect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -13,6 +11,7 @@ import mage.constants.TargetController;
|
|||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
public final class BoomBust extends SplitCard {
|
||||
|
||||
|
@ -29,9 +28,7 @@ public final class BoomBust extends SplitCard {
|
|||
|
||||
// Boom
|
||||
// Destroy target land you control and target land you don't control.
|
||||
Effect effect = new DestroyTargetEffect(false, true);
|
||||
effect.setText("Destroy target land you control and target land you don't control");
|
||||
getLeftHalfCard().getSpellAbility().addEffect(effect);
|
||||
getLeftHalfCard().getSpellAbility().addEffect(new DestroyTargetEffect().setTargetPointer(new EachTargetPointer()));
|
||||
getLeftHalfCard().getSpellAbility().addTarget(new TargetPermanent(filter1));
|
||||
getLeftHalfCard().getSpellAbility().addTarget(new TargetPermanent(filter2));
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -11,6 +10,7 @@ import mage.target.common.TargetArtifactPermanent;
|
|||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.common.TargetEnchantmentPermanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -22,9 +22,7 @@ public final class Decimate extends CardImpl {
|
|||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{R}{G}");
|
||||
|
||||
// Destroy target artifact, target creature, target enchantment, and target land.
|
||||
Effect effect = new DestroyTargetEffect(false, true);
|
||||
effect.setText("Destroy target artifact, target creature, target enchantment, and target land.");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect().setTargetPointer(new EachTargetPointer()));
|
||||
this.getSpellAbility().addTarget(new TargetArtifactPermanent());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addTarget(new TargetEnchantmentPermanent());
|
||||
|
|
|
@ -15,6 +15,7 @@ import mage.filter.predicate.permanent.ControllerIdPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
@ -31,7 +32,8 @@ public final class DismantlingWave extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{W}");
|
||||
|
||||
// For each opponent, destroy up to one target artifact or enchantment that player controls.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect(false, true)
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect()
|
||||
.setTargetPointer(new EachTargetPointer())
|
||||
.setText("For each opponent, destroy up to one target artifact or enchantment that player controls."));
|
||||
this.getSpellAbility().setTargetAdjuster(DismantlingWaveAdjuster.instance);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ public final class FinaleOfEternity extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{B}{B}");
|
||||
|
||||
// Destroy up to three target creatures with toughness X or less. If X is 10 or more, return all creature cards from your graveyard to the battlefield.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect().setText("destroy up to three target creatures with toughness X or less"));
|
||||
this.getSpellAbility().addEffect(new FinaleOfEternityEffect());
|
||||
this.getSpellAbility().setTargetAdjuster(FinaleOfEternityAdjuster.instance);
|
||||
}
|
||||
|
@ -59,9 +60,8 @@ enum FinaleOfEternityAdjuster implements TargetAdjuster {
|
|||
class FinaleOfEternityEffect extends OneShotEffect {
|
||||
|
||||
FinaleOfEternityEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Destroy up to three target creatures with toughness X or less. " +
|
||||
"If X is 10 or more, return all creature cards from your graveyard to the battlefield.";
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
staticText = "If X is 10 or more, return all creature cards from your graveyard to the battlefield.";
|
||||
}
|
||||
|
||||
private FinaleOfEternityEffect(final FinaleOfEternityEffect effect) {
|
||||
|
@ -75,7 +75,6 @@ class FinaleOfEternityEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
new DestroyTargetEffect(false, true).apply(game, source);
|
||||
if (source.getManaCostsToPay().getX() < 10) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -10,6 +9,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -23,9 +23,7 @@ public final class Fumarole extends CardImpl {
|
|||
// As an additional cost to cast Fumarole, pay 3 life.
|
||||
this.getSpellAbility().addCost(new PayLifeCost(3));
|
||||
// Destroy target creature and target land.
|
||||
Effect effect = new DestroyTargetEffect(false, true);
|
||||
effect.setText("Destroy target creature and target land");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect().setTargetPointer(new EachTargetPointer()));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addTarget(new TargetLandPermanent());
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -15,6 +14,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -29,7 +29,8 @@ public final class GoblinGrenadiers extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Whenever Goblin Grenadiers attacks and isn't blocked, you may sacrifice it. If you do, destroy target creature and target land.
|
||||
Effect effect = new DoIfCostPaid(new DestroyTargetEffect(false, true), new SacrificeSourceCost(), "Sacrifice {this} to destroy target creature and target land?");
|
||||
Effect effect = new DoIfCostPaid(new DestroyTargetEffect(), new SacrificeSourceCost(), "Sacrifice {this} to destroy target creature and target land?");
|
||||
effect.setTargetPointer(new EachTargetPointer());
|
||||
effect.setText("you may sacrifice it. If you do, destroy target creature and target land");
|
||||
Ability ability = new AttacksAndIsNotBlockedTriggeredAbility(effect);
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
|
||||
package mage.cards.h;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetArtifactPermanent;
|
||||
import mage.target.common.TargetEnchantmentPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -23,21 +21,16 @@ public final class HullBreach extends CardImpl {
|
|||
|
||||
// Choose one - Destroy target artifact;
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||
Target target = new TargetArtifactPermanent();
|
||||
this.getSpellAbility().addTarget(target);
|
||||
this.getSpellAbility().addTarget(new TargetArtifactPermanent());
|
||||
// or destroy target enchantment;
|
||||
Mode mode = new Mode(new DestroyTargetEffect());
|
||||
target = new TargetEnchantmentPermanent();
|
||||
mode.addTarget(target);
|
||||
mode.addTarget(new TargetEnchantmentPermanent());
|
||||
this.getSpellAbility().addMode(mode);
|
||||
// or destroy target artifact and target enchantment.
|
||||
Effect effect = new DestroyTargetEffect(false, true);
|
||||
effect.setText("destroy target artifact and target enchantment");
|
||||
mode = new Mode(effect);
|
||||
mode = new Mode(new DestroyTargetEffect().setTargetPointer(new EachTargetPointer()));
|
||||
mode.addTarget(new TargetArtifactPermanent());
|
||||
mode.addTarget(new TargetEnchantmentPermanent());
|
||||
this.getSpellAbility().addMode(mode);
|
||||
|
||||
}
|
||||
|
||||
private HullBreach(final HullBreach card) {
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
import mage.abilities.costs.common.PayLifeCost;
|
||||
import mage.abilities.effects.common.DestroyMultiTargetEffect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -17,7 +16,7 @@ import mage.target.targetadjustment.TargetAdjuster;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author escplan9 - Derek Monturo
|
||||
* @author awjackson
|
||||
*/
|
||||
public final class PhyrexianPurge extends CardImpl {
|
||||
|
||||
|
@ -28,7 +27,7 @@ public final class PhyrexianPurge extends CardImpl {
|
|||
// Phyrexian Purge costs 3 life more to cast for each target.
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE));
|
||||
this.getSpellAbility().addEffect(new InfoEffect("this spell costs 3 life more to cast for each target"));
|
||||
this.getSpellAbility().addEffect(new DestroyMultiTargetEffect().concatBy("<br>"));
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect().concatBy("<br>").setText("destroy any number of target creatures"));
|
||||
this.getSpellAbility().setTargetAdjuster(PhyrexianPurgeTargetAdjuster.instance);
|
||||
this.getSpellAbility().setCostAdjuster(PhyrexianPurgeCostAdjuster.instance);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -9,6 +8,7 @@ import mage.constants.CardType;
|
|||
import mage.filter.StaticFilters;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -21,9 +21,7 @@ public final class PlagueSpores extends CardImpl {
|
|||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{B}{R}");
|
||||
|
||||
// Destroy target nonblack creature and target land. They can't be regenerated.
|
||||
Effect effect = new DestroyTargetEffect(true, true);
|
||||
effect.setText("Destroy target nonblack creature and target land. They can't be regenerated.");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect(true).setTargetPointer(new EachTargetPointer()));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_PERMANENT_CREATURE_NON_BLACK));
|
||||
this.getSpellAbility().addTarget(new TargetLandPermanent());
|
||||
}
|
||||
|
|
|
@ -11,8 +11,10 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -20,28 +22,26 @@ import mage.target.TargetPermanent;
|
|||
*/
|
||||
public final class ReignOfChaos extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter1 = new FilterPermanent("Plains");
|
||||
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("white creature");
|
||||
private static final FilterPermanent filter3 = new FilterPermanent("Island");
|
||||
private static final FilterCreaturePermanent filter4 = new FilterCreaturePermanent("blue creature");
|
||||
private static final FilterPermanent filterPlains = new FilterLandPermanent(SubType.PLAINS, "Plains");
|
||||
private static final FilterPermanent filterWhite = new FilterCreaturePermanent("white creature");
|
||||
private static final FilterPermanent filterIsland = new FilterLandPermanent(SubType.ISLAND, "Island");
|
||||
private static final FilterPermanent filterBlue = new FilterCreaturePermanent("blue creature");
|
||||
|
||||
static {
|
||||
filter1.add(SubType.PLAINS.getPredicate());
|
||||
filter2.add(new ColorPredicate(ObjectColor.WHITE));
|
||||
filter3.add(SubType.ISLAND.getPredicate());
|
||||
filter4.add(new ColorPredicate(ObjectColor.BLUE));
|
||||
filterWhite.add(new ColorPredicate(ObjectColor.WHITE));
|
||||
filterBlue.add(new ColorPredicate(ObjectColor.BLUE));
|
||||
}
|
||||
|
||||
public ReignOfChaos(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}{R}");
|
||||
|
||||
// Choose one - Destroy target Plains and target white creature; or destroy target Island and target blue creature.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect(false, true));
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(filter1));
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(filter2));
|
||||
Mode mode = new Mode(new DestroyTargetEffect(false, true));
|
||||
mode.addTarget(new TargetPermanent(filter3));
|
||||
mode.addTarget(new TargetPermanent(filter4));
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect().setTargetPointer(new EachTargetPointer()));
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(filterPlains));
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(filterWhite));
|
||||
Mode mode = new Mode(new DestroyTargetEffect().setTargetPointer(new EachTargetPointer()));
|
||||
mode.addTarget(new TargetPermanent(filterIsland));
|
||||
mode.addTarget(new TargetPermanent(filterBlue));
|
||||
this.getSpellAbility().addMode(mode);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
|
||||
package mage.cards.r;
|
||||
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
|
||||
import mage.filter.predicate.other.AnotherTargetPredicate;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -17,15 +20,19 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class RelicCrush extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterArtifactOrEnchantmentPermanent("other target artifact or enchantment");
|
||||
|
||||
static {
|
||||
filter.add(new AnotherTargetPredicate(2));
|
||||
}
|
||||
|
||||
public RelicCrush(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{4}{G}");
|
||||
|
||||
// Destroy target artifact or enchantment and up to one other target artifact or enchantment.
|
||||
Effect effect = new DestroyTargetEffect(false, true);
|
||||
effect.setText("Destroy target artifact or enchantment and up to one other target artifact or enchantment");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT));
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT, false));
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect().setTargetPointer(new EachTargetPointer()));
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT).setTargetTag(1));
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(0, 1, filter).setTargetTag(2));
|
||||
}
|
||||
|
||||
private RelicCrush(final RelicCrush card) {
|
||||
|
|
|
@ -23,7 +23,7 @@ public final class SeismicShift extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}");
|
||||
|
||||
// Destroy target land. Up to two target creatures can't block this turn.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect(false, false));
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetLandPermanent());
|
||||
this.getSpellAbility().addEffect(new CantBlockTargetEffect(Duration.EndOfTurn)
|
||||
.setText("Up to two target creatures can't block this turn")
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -20,9 +19,7 @@ public final class SpitefulBlow extends CardImpl {
|
|||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{B}{B}");
|
||||
|
||||
// Destroy target creature and target land.
|
||||
Effect effect = new DestroyTargetEffect(false, true);
|
||||
effect.setText("Destroy target creature and target land");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect().setTargetPointer(new EachTargetPointer()));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addTarget(new TargetLandPermanent());
|
||||
}
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.common.DestroyMultiTargetEffect;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.target.common.TargetArtifactPermanent;
|
||||
import mage.target.common.TargetEnchantmentPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author vereena42
|
||||
* @author awjackson
|
||||
*/
|
||||
public final class StompAndHowl extends CardImpl {
|
||||
|
||||
|
@ -18,9 +19,9 @@ public final class StompAndHowl extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");
|
||||
|
||||
// Destroy target artifact and target enchantment.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect().setTargetPointer(new EachTargetPointer()));
|
||||
this.getSpellAbility().addTarget(new TargetArtifactPermanent());
|
||||
this.getSpellAbility().addTarget(new TargetEnchantmentPermanent());
|
||||
this.getSpellAbility().addEffect(new DestroyMultiTargetEffect());
|
||||
}
|
||||
|
||||
private StompAndHowl(final StompAndHowl card) {
|
||||
|
|
|
@ -17,10 +17,11 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.target.common.TargetArtifactPermanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetPlaneswalkerPermanent;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
|
@ -41,8 +42,7 @@ public final class SwordOfSinewAndSteel extends CardImpl {
|
|||
|
||||
// Whenever equipped creature deals combat damage to a player, destroy up to one target planeswalker and up to one target artifact.
|
||||
ability = new DealsDamageToAPlayerAttachedTriggeredAbility(
|
||||
new DestroyTargetEffect(false, true)
|
||||
.setText("destroy up to one target planeswalker and up to one target artifact."),
|
||||
new DestroyTargetEffect().setTargetPointer(new EachTargetPointer()),
|
||||
"equipped creature", false
|
||||
);
|
||||
ability.addTarget(new TargetPlaneswalkerPermanent(0, 1));
|
||||
|
|
|
@ -11,6 +11,7 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.target.targetpointer.EachTargetPointer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -23,11 +24,9 @@ public final class WindgracesJudgment extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{B}{G}");
|
||||
|
||||
// For any number of opponents, destroy target nonland permanent that player controls.
|
||||
this.getSpellAbility().addEffect(
|
||||
new DestroyTargetEffect(false, true).
|
||||
setText("For any number of opponents, "
|
||||
+ "destroy target nonland permanent "
|
||||
+ "that player controls")
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect()
|
||||
.setTargetPointer(new EachTargetPointer())
|
||||
.setText("For any number of opponents, destroy target nonland permanent that player controls")
|
||||
);
|
||||
this.getSpellAbility().setTargetAdjuster(WindgracesJudgmentAdjuster.instance);
|
||||
}
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import mage.constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class DestroyMultiTargetEffect extends OneShotEffect {
|
||||
protected boolean noRegen;
|
||||
|
||||
public DestroyMultiTargetEffect() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
public DestroyMultiTargetEffect(boolean noRegen) {
|
||||
super(Outcome.DestroyPermanent);
|
||||
this.noRegen = noRegen;
|
||||
}
|
||||
|
||||
public DestroyMultiTargetEffect(final DestroyMultiTargetEffect effect) {
|
||||
super(effect);
|
||||
this.noRegen = effect.noRegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DestroyMultiTargetEffect copy() {
|
||||
return new DestroyMultiTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int affectedTargets = 0;
|
||||
for (Target target: source.getTargets()) {
|
||||
for (UUID permanentId: target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
if (permanent != null) {
|
||||
permanent.destroy(source, game, noRegen);
|
||||
affectedTargets++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return affectedTargets > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Destroy ");
|
||||
|
||||
Iterator<Target> iterator = mode.getTargets().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Target target = iterator.next();
|
||||
if (target.getNumberOfTargets() > 1) {
|
||||
sb.append(target.getNumberOfTargets()).append(' ');
|
||||
}
|
||||
sb.append("target ").append(target.getTargetName());
|
||||
if (iterator.hasNext()) {
|
||||
sb.append(" and ");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
|
@ -19,7 +19,6 @@ import java.util.UUID;
|
|||
public class DestroyTargetEffect extends OneShotEffect {
|
||||
|
||||
protected boolean noRegen;
|
||||
protected boolean multitargetHandling;
|
||||
|
||||
public DestroyTargetEffect() {
|
||||
this(false);
|
||||
|
@ -30,24 +29,18 @@ public class DestroyTargetEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public DestroyTargetEffect(boolean noRegen) {
|
||||
this(noRegen, false);
|
||||
super(Outcome.DestroyPermanent);
|
||||
this.noRegen = noRegen;
|
||||
}
|
||||
|
||||
public DestroyTargetEffect(String ruleText, boolean noRegen) {
|
||||
this(noRegen, false);
|
||||
this(noRegen);
|
||||
staticText = ruleText;
|
||||
}
|
||||
|
||||
public DestroyTargetEffect(boolean noRegen, boolean multitargetHandling) {
|
||||
super(Outcome.Detriment);
|
||||
this.noRegen = noRegen;
|
||||
this.multitargetHandling = multitargetHandling;
|
||||
}
|
||||
|
||||
public DestroyTargetEffect(final DestroyTargetEffect effect) {
|
||||
super(effect);
|
||||
this.noRegen = effect.noRegen;
|
||||
this.multitargetHandling = effect.multitargetHandling;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,21 +51,6 @@ public class DestroyTargetEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int affectedTargets = 0;
|
||||
if (multitargetHandling
|
||||
&& source.getTargets().size() > 1
|
||||
&& targetPointer instanceof FirstTargetPointer) { // Decimate
|
||||
for (Target target : source.getTargets()) {
|
||||
for (UUID permanentId : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
if (permanent != null
|
||||
&& permanent.isPhasedIn()
|
||||
&& !permanent.isPhasedOutIndirectly()) {
|
||||
permanent.destroy(source, game, noRegen);
|
||||
affectedTargets++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (UUID permanentId : targetPointer.getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
if (permanent != null
|
||||
|
@ -82,7 +60,6 @@ public class DestroyTargetEffect extends OneShotEffect {
|
|||
affectedTargets++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return affectedTargets > 0;
|
||||
}
|
||||
|
||||
|
@ -91,36 +68,11 @@ public class DestroyTargetEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (mode.getTargets().isEmpty()) {
|
||||
sb.append("destroy that creature"); //TODO add possibility to specify text with targetPointer usage
|
||||
} else {
|
||||
Target target;
|
||||
if (targetPointer instanceof SecondTargetPointer && mode.getTargets().size() > 1) {
|
||||
target = mode.getTargets().get(1);
|
||||
} else {
|
||||
target = mode.getTargets().get(0);
|
||||
}
|
||||
if (target.getNumberOfTargets() == 1) {
|
||||
String targetName = target.getTargetName();
|
||||
sb.append("destroy ");
|
||||
if (!targetName.startsWith("another")) {
|
||||
sb.append("target ");
|
||||
}
|
||||
sb.append(targetName);
|
||||
} else {
|
||||
if (target.getMaxNumberOfTargets() == target.getMinNumberOfTargets()) {
|
||||
sb.append("destroy ").append(CardUtil.numberToText(target.getNumberOfTargets()));
|
||||
} else {
|
||||
sb.append("destroy up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets()));
|
||||
}
|
||||
sb.append(" target ").append(target.getTargetName());
|
||||
}
|
||||
}
|
||||
StringBuilder sb = new StringBuilder("destroy " + getTargetPointer().describeTargets(mode.getTargets(), "that creature"));
|
||||
if (noRegen) {
|
||||
sb.append(". It can't be regenerated");
|
||||
sb.append(getTargetPointer().isPlural(mode.getTargets()) ? ". They" : ". It");
|
||||
sb.append(" can't be regenerated");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,10 @@ import mage.game.permanent.Permanent;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author awjackson
|
||||
*/
|
||||
public enum AttachedOrShareCreatureTypePredicate implements ObjectSourcePlayerPredicate<Permanent> {
|
||||
instance;
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
import mage.target.Targets;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -129,4 +131,17 @@ public class EachTargetPointer extends TargetPointerImpl {
|
|||
}
|
||||
return permanent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String describeTargets(Targets targets, String defaultDescription) {
|
||||
if (targets.isEmpty()) {
|
||||
return defaultDescription;
|
||||
}
|
||||
return CardUtil.concatWithAnd(targets.stream().map(Target::getDescription).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlural(Targets targets) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,4 +123,9 @@ public class FirstTargetPointer extends TargetPointerImpl {
|
|||
public String describeTargets(Targets targets, String defaultDescription) {
|
||||
return targets.isEmpty() ? defaultDescription : targets.get(0).getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlural(Targets targets) {
|
||||
return !targets.isEmpty() && targets.get(0).getMaxNumberOfTargets() > 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,4 +120,9 @@ public class SecondTargetPointer extends TargetPointerImpl {
|
|||
public String describeTargets(Targets targets, String defaultDescription) {
|
||||
return targets.size() < 2 ? defaultDescription : targets.get(1).getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlural(Targets targets) {
|
||||
return targets.size() > 1 && targets.get(1).getMaxNumberOfTargets() > 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,15 +39,20 @@ public interface TargetPointer extends Serializable, Copyable<TargetPointer> {
|
|||
Permanent getFirstTargetPermanentOrLKI(Game game, Ability source);
|
||||
|
||||
/**
|
||||
* Returns description of targets for ability text
|
||||
* Describes the appropriate subset of targets for ability text.
|
||||
*
|
||||
* @param targets
|
||||
* @param defaultText
|
||||
* @return
|
||||
*/
|
||||
default String describeTargets(Targets targets, String defaultDescription) {
|
||||
return defaultDescription;
|
||||
}
|
||||
|
||||
default boolean isPlural(Targets targets) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store text to target pointer (usefull to keep data for specific trigger, e.g. selected target name for rules)
|
||||
*
|
||||
|
|
|
@ -124,4 +124,9 @@ public class ThirdTargetPointer extends TargetPointerImpl {
|
|||
public String describeTargets(Targets targets, String defaultDescription) {
|
||||
return targets.size() < 3 ? defaultDescription : targets.get(2).getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlural(Targets targets) {
|
||||
return targets.size() > 2 && targets.get(2).getMaxNumberOfTargets() > 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue