From 39cfbec82f8262a15a1f3899205e53a1d2fa0991 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 8 Sep 2015 16:48:25 +0200 Subject: [PATCH] * Some fixed / changes to multi target destry effects. --- .../sets/apocalypse/DwarvenLandslide.java | 6 ++- .../mage/sets/commander2013/HullBreach.java | 11 ++--- .../src/mage/sets/invasion/PlagueSpores.java | 4 +- .../sets/journeyintonyx/SpitefulBlow.java | 14 ++---- .../sets/weatherlight/GoblinGrenadiers.java | 2 +- .../src/mage/sets/zendikar/RelicCrush.java | 43 +++---------------- 6 files changed, 21 insertions(+), 59 deletions(-) diff --git a/Mage.Sets/src/mage/sets/apocalypse/DwarvenLandslide.java b/Mage.Sets/src/mage/sets/apocalypse/DwarvenLandslide.java index 4edae4f5649..c6168855cc6 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/DwarvenLandslide.java +++ b/Mage.Sets/src/mage/sets/apocalypse/DwarvenLandslide.java @@ -41,6 +41,7 @@ import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.filter.common.FilterControlledLandPermanent; +import mage.filter.common.FilterLandPermanent; import mage.game.Game; import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetLandPermanent; @@ -62,6 +63,7 @@ public class DwarvenLandslide extends CardImpl { this.addAbility(new KickerAbility(kickerCosts)); // Destroy target land. If Dwarven Landslide was kicked, destroy another target land. getSpellAbility().addEffect(new DestroyTargetEffect("Destroy target land. If {this} was kicked, destroy another target land")); + getSpellAbility().addTarget(new TargetLandPermanent()); } public DwarvenLandslide(final DwarvenLandslide card) { @@ -70,7 +72,9 @@ public class DwarvenLandslide extends CardImpl { @Override public void adjustTargets(Ability ability, Game game) { - ability.addTarget(new TargetLandPermanent(KickedCondition.getInstance().apply(game, ability) ? 2 : 1)); + if (KickedCondition.getInstance().apply(game, ability)) { + getSpellAbility().addTarget(new TargetLandPermanent(new FilterLandPermanent("land (Kicker)"))); + } } @Override diff --git a/Mage.Sets/src/mage/sets/commander2013/HullBreach.java b/Mage.Sets/src/mage/sets/commander2013/HullBreach.java index c47d23d6667..d6a51a65743 100644 --- a/Mage.Sets/src/mage/sets/commander2013/HullBreach.java +++ b/Mage.Sets/src/mage/sets/commander2013/HullBreach.java @@ -50,7 +50,6 @@ public class HullBreach extends CardImpl { super(ownerId, 193, "Hull Breach", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{R}{G}"); this.expansionSetCode = "C13"; - // Choose one - Destroy target artifact; this.getSpellAbility().addEffect(new DestroyTargetEffect()); Target target = new TargetArtifactPermanent(); @@ -63,18 +62,14 @@ public class HullBreach extends CardImpl { this.getSpellAbility().addMode(mode); // or destroy target artifact and target enchantment. mode = new Mode(); - mode.getEffects().add(new DestroyTargetEffect()); - target = new TargetArtifactPermanent(); - mode.getTargets().add(target); Effect effect = new DestroyTargetEffect(); effect.setTargetPointer(new SecondTargetPointer()); - effect.setText("and target enchantment"); + effect.setText("destroy target artifact and target enchantment"); mode.getEffects().add(effect); - target = new TargetPermanent(new FilterEnchantmentPermanent()); - mode.getTargets().add(target); + mode.getTargets().add(new TargetArtifactPermanent()); + mode.getTargets().add(new TargetPermanent(new FilterEnchantmentPermanent())); this.getSpellAbility().addMode(mode); - } public HullBreach(final HullBreach card) { diff --git a/Mage.Sets/src/mage/sets/invasion/PlagueSpores.java b/Mage.Sets/src/mage/sets/invasion/PlagueSpores.java index db32455cf27..9d1f8fefc0e 100644 --- a/Mage.Sets/src/mage/sets/invasion/PlagueSpores.java +++ b/Mage.Sets/src/mage/sets/invasion/PlagueSpores.java @@ -43,7 +43,7 @@ import mage.target.common.TargetLandPermanent; /** * * @author LoneFox - + * */ public class PlagueSpores extends CardImpl { @@ -58,7 +58,7 @@ public class PlagueSpores extends CardImpl { this.expansionSetCode = "INV"; // Destroy target nonblack creature and target land. They can't be regenerated. - Effect effect = new DestroyTargetEffect(true); + 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().addTarget(new TargetCreaturePermanent(filter)); diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/SpitefulBlow.java b/Mage.Sets/src/mage/sets/journeyintonyx/SpitefulBlow.java index 48dbb0da2ce..578166c9807 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/SpitefulBlow.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/SpitefulBlow.java @@ -33,10 +33,8 @@ import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; -import mage.target.Target; import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetLandPermanent; -import mage.target.targetpointer.SecondTargetPointer; /** * @@ -48,16 +46,12 @@ public class SpitefulBlow extends CardImpl { super(ownerId, 83, "Spiteful Blow", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{4}{B}{B}"); this.expansionSetCode = "JOU"; - // Destroy target creature and target land. - this.getSpellAbility().addEffect(new DestroyTargetEffect()); - this.getSpellAbility().addTarget(new TargetCreaturePermanent()); - Effect effect = new DestroyTargetEffect(); - effect.setText("and target land"); - effect.setTargetPointer(new SecondTargetPointer()); + Effect effect = new DestroyTargetEffect(false, true); + effect.setText("Destroy target creature and target land"); this.getSpellAbility().addEffect(effect); - Target target = new TargetLandPermanent(); - this.getSpellAbility().addTarget(target); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addTarget(new TargetLandPermanent()); } public SpitefulBlow(final SpitefulBlow card) { diff --git a/Mage.Sets/src/mage/sets/weatherlight/GoblinGrenadiers.java b/Mage.Sets/src/mage/sets/weatherlight/GoblinGrenadiers.java index 13b7c9fcb93..ed5891a9222 100644 --- a/Mage.Sets/src/mage/sets/weatherlight/GoblinGrenadiers.java +++ b/Mage.Sets/src/mage/sets/weatherlight/GoblinGrenadiers.java @@ -55,7 +55,7 @@ public 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(), new SacrificeSourceCost(), "Sacrifice {this} to 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.setText("you may sacrifice it. If you do, destroy target creature and target land"); Ability ability = new AttacksAndIsNotBlockedTriggeredAbility(effect); ability.addTarget(new TargetCreaturePermanent()); diff --git a/Mage.Sets/src/mage/sets/zendikar/RelicCrush.java b/Mage.Sets/src/mage/sets/zendikar/RelicCrush.java index 150a3c4c73d..4f306bf163a 100644 --- a/Mage.Sets/src/mage/sets/zendikar/RelicCrush.java +++ b/Mage.Sets/src/mage/sets/zendikar/RelicCrush.java @@ -29,15 +29,12 @@ package mage.sets.zendikar; import java.util.UUID; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; import mage.filter.FilterPermanent; import mage.filter.common.FilterArtifactOrEnchantmentPermanent; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.TargetPermanent; /** @@ -45,14 +42,16 @@ import mage.target.TargetPermanent; * @author jeffwadsworth */ public class RelicCrush extends CardImpl { - + public RelicCrush(UUID ownerId) { super(ownerId, 179, "Relic Crush", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{4}{G}"); this.expansionSetCode = "ZEN"; // Destroy target artifact or enchantment and up to one other target artifact or enchantment. FilterPermanent filter = new FilterArtifactOrEnchantmentPermanent(); - this.getSpellAbility().addEffect(new RelicCrushEffect()); + 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(filter)); this.getSpellAbility().addTarget(new TargetPermanent(0, 1, filter, false)); } @@ -66,33 +65,3 @@ public class RelicCrush extends CardImpl { return new RelicCrush(this); } } - -class RelicCrushEffect extends OneShotEffect { - - public RelicCrushEffect() { - super(Outcome.DestroyPermanent); - this.staticText = "Destroy target artifact or enchantment and up to one other target artifact or enchantment"; - } - - public RelicCrushEffect(final RelicCrushEffect effect) { - super(effect); - } - - @Override - public RelicCrushEffect copy() { - return new RelicCrushEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent firstTarget = game.getPermanent(source.getFirstTarget()); - Permanent secondTarget = game.getPermanent(source.getTargets().get(1).getFirstTarget()); - if (firstTarget != null) { - firstTarget.destroy(id, game, false); - } - if (secondTarget != null) { - return secondTarget.destroy(id, game, false); - } - return true; - } -}