From bea1cee395a9b0765fdbee1eaaed5c2e71ec723d Mon Sep 17 00:00:00 2001 From: Justin Godesky Date: Fri, 5 Jun 2015 12:05:51 -0400 Subject: [PATCH] Refactored a lot of the artifact/enchantment destruction. Using common filter types to reduce code duplication. --- .gitignore | 3 +- .../sets/alarareborn/QasaliPridemage.java | 17 ++--------- .../sets/alarareborn/VithianRenegades.java | 15 +++------- .../mage/sets/apocalypse/IllusionReality.java | 2 -- .../mage/sets/apocalypse/OrimsThunder.java | 17 ++--------- Mage.Sets/src/mage/sets/apocalypse/Smash.java | 4 --- .../mage/sets/avacynrestored/NaturalEnd.java | 15 ++-------- .../betrayersofkamigawa/TerashisGrasp.java | 16 ++-------- .../sets/championsofkamigawa/WearAway.java | 12 ++------ .../src/mage/sets/commander/AuraShards.java | 19 +++--------- .../commander2014/FreyaliseLlanowarsFury.java | 13 ++------ .../mage/sets/conflux/FiligreeFracture.java | 15 ++-------- .../mage/sets/darkascension/TorchFiend.java | 1 - .../sets/darkascension/WerewolfRansacker.java | 15 +++------- .../src/mage/sets/darksteel/Oxidize.java | 14 ++------- .../mage/sets/darksteel/ViridianZealot.java | 19 +++--------- .../sets/dissension/IndrikStomphowler.java | 15 ++-------- .../mage/sets/fifthdawn/TelJiladJustice.java | 1 - .../mage/sets/guildpact/ShatteringSpree.java | 1 - .../mage/sets/innistrad/AncientGrudge.java | 13 ++------ .../mage/sets/invasion/DismantlingBlow.java | 15 ++-------- .../mage/sets/khansoftarkir/SultaiCharm.java | 2 -- .../mage/sets/magic2010/SolemnOffering.java | 16 ++-------- .../src/mage/sets/magic2011/ManicVandal.java | 13 ++------ Mage.Sets/src/mage/sets/magic2013/Smelt.java | 1 - Mage.Sets/src/mage/sets/mirrodin/Shatter.java | 13 ++------ .../mirrodinbesieged/ViridianCorrupter.java | 14 ++------- .../mage/sets/nemesis/SealOfCleansing.java | 16 ++-------- .../mage/sets/odyssey/RayOfDistortion.java | 13 ++------ .../sets/planarchaos/SealOfPrimordium.java | 16 ++-------- .../sets/planechase2012/NullmageAdvocate.java | 12 ++------ .../mage/sets/ravnica/NullmageShepherd.java | 11 ++----- .../src/mage/sets/ravnica/SunderingVitae.java | 15 ++-------- .../sets/returntoravnica/RakdosCharm.java | 3 -- .../sets/saviorsofkamigawa/RendingVines.java | 1 - .../mage/sets/saviorsofkamigawa/YukiOnna.java | 15 ++-------- .../sets/scarsofmirrodin/SliceinTwain.java | 14 ++------- .../sets/scarsofmirrodin/SylvokReplica.java | 17 +++-------- .../mage/sets/shadowmoor/GleefulSabotage.java | 16 ++-------- .../sets/shadowmoor/SmashToSmithereens.java | 1 - .../sets/shardsofalara/DispellersCapsule.java | 17 ++--------- .../src/mage/sets/tempest/Disenchant.java | 15 ++-------- .../src/mage/sets/tempest/Verdigris.java | 11 ++----- .../mage/sets/tenthedition/Naturalize.java | 16 ++-------- .../src/mage/sets/theros/ArtisansSorrow.java | 13 ++------ .../mage/sets/theros/DestructiveRevelry.java | 12 ++------ .../mage/sets/timespiral/HarmonicSliver.java | 11 ++----- .../src/mage/sets/timespiral/KrosanGrip.java | 15 ++-------- .../sets/urzaslegacy/ViashinoHeretic.java | 1 - Mage.Sets/src/mage/sets/urzassaga/Scrap.java | 12 ++------ .../sets/vintagemasters/DevoutWitness.java | 14 ++------- .../mage/sets/weatherlight/AuraOfSilence.java | 15 ++-------- .../src/mage/sets/worldwake/NaturesClaim.java | 17 ++--------- .../mage/sets/zendikar/KorSanctifiers.java | 16 ++-------- .../src/mage/sets/zendikar/RelicCrush.java | 14 ++------- .../FilterArtifactOrEnchantmentPermanent.java | 30 +++++++++++++++---- 56 files changed, 130 insertions(+), 550 deletions(-) diff --git a/.gitignore b/.gitignore index 2d4ddf9ef2..812f56fc36 100644 --- a/.gitignore +++ b/.gitignore @@ -50,7 +50,8 @@ Mage.Updater/target mage.updater.client/target releases -Utils/author.txt +Utils/author.txt +.DS_Store .metadata .project .settings diff --git a/Mage.Sets/src/mage/sets/alarareborn/QasaliPridemage.java b/Mage.Sets/src/mage/sets/alarareborn/QasaliPridemage.java index bccf5694cd..392f4efd5c 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/QasaliPridemage.java +++ b/Mage.Sets/src/mage/sets/alarareborn/QasaliPridemage.java @@ -39,9 +39,7 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.ExaltedAbility; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.Target; import mage.target.TargetPermanent; @@ -51,22 +49,11 @@ import mage.target.TargetPermanent; */ public class QasaliPridemage extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public QasaliPridemage(UUID ownerId) { super(ownerId, 75, "Qasali Pridemage", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{G}{W}"); this.expansionSetCode = "ARB"; this.subtype.add("Cat"); this.subtype.add("Wizard"); - - - this.power = new MageInt(2); this.toughness = new MageInt(2); @@ -76,7 +63,7 @@ public class QasaliPridemage extends CardImpl { // {1}, Sacrifice Qasali Pridemage: Destroy target artifact or enchantment. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{1}")); ability.addCost(new SacrificeSourceCost()); - Target target = new TargetPermanent(filter); + Target target = new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()); ability.addTarget(target); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/alarareborn/VithianRenegades.java b/Mage.Sets/src/mage/sets/alarareborn/VithianRenegades.java index 292651c14d..3f693142a4 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/VithianRenegades.java +++ b/Mage.Sets/src/mage/sets/alarareborn/VithianRenegades.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.alarareborn; import java.util.UUID; @@ -36,8 +35,7 @@ import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactPermanent; import mage.target.TargetPermanent; /** @@ -45,11 +43,6 @@ import mage.target.TargetPermanent; * @author Loki */ public class VithianRenegades extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact"); - - static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); - } public VithianRenegades (UUID ownerId) { super(ownerId, 64, "Vithian Renegades", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{R}{G}"); @@ -57,11 +50,12 @@ public class VithianRenegades extends CardImpl { this.subtype.add("Human"); this.subtype.add("Shaman"); - this.power = new MageInt(3); this.toughness = new MageInt(2); + + // When Vithian Renegades enters the battlefield, destroy target artifact. Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect()); - ability.addTarget(new TargetPermanent(filter)); + ability.addTarget(new TargetPermanent(new FilterArtifactPermanent())); this.addAbility(ability); } @@ -73,5 +67,4 @@ public class VithianRenegades extends CardImpl { public VithianRenegades copy() { return new VithianRenegades(this); } - } diff --git a/Mage.Sets/src/mage/sets/apocalypse/IllusionReality.java b/Mage.Sets/src/mage/sets/apocalypse/IllusionReality.java index dd3af7ac03..6a875b15cb 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/IllusionReality.java +++ b/Mage.Sets/src/mage/sets/apocalypse/IllusionReality.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.apocalypse; import java.util.UUID; @@ -65,7 +64,6 @@ public class IllusionReality extends SplitCard { getRightHalfCard().getColor().setGreen(true); getRightHalfCard().getSpellAbility().addTarget(new TargetArtifactPermanent()); getRightHalfCard().getSpellAbility().addEffect(new DestroyTargetEffect()); - } public IllusionReality(final IllusionReality card) { diff --git a/Mage.Sets/src/mage/sets/apocalypse/OrimsThunder.java b/Mage.Sets/src/mage/sets/apocalypse/OrimsThunder.java index 764f0b9a0a..9300329a73 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/OrimsThunder.java +++ b/Mage.Sets/src/mage/sets/apocalypse/OrimsThunder.java @@ -28,7 +28,6 @@ package mage.sets.apocalypse; import java.util.UUID; - import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; @@ -41,9 +40,7 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.KickerAbility; import mage.cards.CardImpl; import mage.constants.Zone; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; @@ -55,30 +52,20 @@ import mage.target.common.TargetCreaturePermanent; */ public class OrimsThunder extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public OrimsThunder(UUID ownerId) { super(ownerId, 15, "Orim's Thunder", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{W}"); this.expansionSetCode = "APC"; - // Kicker {R} this.addAbility(new KickerAbility("{R}")); // Destroy target artifact or enchantment. If Orim's Thunder was kicked, it deals damage equal to that permanent's converted mana cost to target creature. this.getSpellAbility().addEffect(new OrimsThunderEffect()); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.getSpellAbility().addEffect(new ConditionalOneShotEffect( new OrimsThunderEffect2(), KickedCondition.getInstance(), "If Orim's Thunder was kicked, it deals damage equal to that permanent's converted mana cost to target creature")); - } @Override diff --git a/Mage.Sets/src/mage/sets/apocalypse/Smash.java b/Mage.Sets/src/mage/sets/apocalypse/Smash.java index 255670b260..d744e0f308 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/Smash.java +++ b/Mage.Sets/src/mage/sets/apocalypse/Smash.java @@ -28,15 +28,12 @@ package mage.sets.apocalypse; import java.util.UUID; - import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; import mage.filter.common.FilterArtifactPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; import mage.target.TargetPermanent; /** @@ -48,7 +45,6 @@ public class Smash extends CardImpl { super(ownerId, 69, "Smash", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{R}"); this.expansionSetCode = "APC"; - // Destroy target artifact. this.getSpellAbility().addEffect(new DestroyTargetEffect(true)); this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactPermanent())); diff --git a/Mage.Sets/src/mage/sets/avacynrestored/NaturalEnd.java b/Mage.Sets/src/mage/sets/avacynrestored/NaturalEnd.java index 2075204aa2..2f177aa610 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/NaturalEnd.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/NaturalEnd.java @@ -33,9 +33,7 @@ import mage.constants.Rarity; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -44,23 +42,14 @@ import mage.target.TargetPermanent; */ public class NaturalEnd extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public NaturalEnd(UUID ownerId) { super(ownerId, 185, "Natural End", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{G}"); this.expansionSetCode = "AVR"; - // Destroy target artifact or enchantment. You gain 3 life. this.getSpellAbility().addEffect(new DestroyTargetEffect()); this.getSpellAbility().addEffect(new GainLifeEffect(3)); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); } public NaturalEnd(final NaturalEnd card) { diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/TerashisGrasp.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/TerashisGrasp.java index 355f5ce0c6..92340a737d 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/TerashisGrasp.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/TerashisGrasp.java @@ -28,7 +28,6 @@ package mage.sets.betrayersofkamigawa; import java.util.UUID; - import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.Ability; @@ -36,9 +35,7 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; import mage.constants.Outcome; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -50,22 +47,13 @@ import mage.target.TargetPermanent; */ public class TerashisGrasp extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public TerashisGrasp(UUID ownerId) { super(ownerId, 26, "Terashi's Grasp", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{2}{W}"); this.expansionSetCode = "BOK"; this.subtype.add("Arcane"); - // Destroy target artifact or enchantment. - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.getSpellAbility().addEffect(new DestroyTargetEffect()); // You gain life equal to its converted mana cost. this.getSpellAbility().addEffect(new TerashisGraspEffect()); diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/WearAway.java b/Mage.Sets/src/mage/sets/championsofkamigawa/WearAway.java index 0c7c0cf220..b831a1fa4d 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/WearAway.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/WearAway.java @@ -33,9 +33,7 @@ import mage.abilities.keyword.SpliceOntoArcaneAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.Target; import mage.target.TargetPermanent; @@ -45,20 +43,14 @@ import mage.target.TargetPermanent; */ public class WearAway extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - static { - filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.ENCHANTMENT))); - } - public WearAway(UUID ownerId) { super(ownerId, 250, "Wear Away", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{G}{G}"); this.expansionSetCode = "CHK"; this.subtype.add("Arcane"); - // Destroy target artifact or enchantment. this.getSpellAbility().addEffect(new DestroyTargetEffect()); - Target target = new TargetPermanent(filter); + Target target = new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()); this.getSpellAbility().addTarget(target); // Splice onto Arcane {3}{G} this.addAbility(new SpliceOntoArcaneAbility("{3}{G}")); diff --git a/Mage.Sets/src/mage/sets/commander/AuraShards.java b/Mage.Sets/src/mage/sets/commander/AuraShards.java index c61c4ec75f..3827c941bb 100644 --- a/Mage.Sets/src/mage/sets/commander/AuraShards.java +++ b/Mage.Sets/src/mage/sets/commander/AuraShards.java @@ -31,37 +31,26 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility; import mage.abilities.effects.common.DestroyTargetEffect; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; +import mage.target.TargetPermanent; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; -import mage.filter.FilterPermanent; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.target.TargetPermanent; /** * * @author emerald000 */ public class AuraShards extends CardImpl { - - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public AuraShards(UUID ownerId) { super(ownerId, 182, "Aura Shards", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}{W}"); this.expansionSetCode = "CMD"; - // Whenever a creature enters the battlefield under your control, you may destroy target artifact or enchantment. Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new FilterCreaturePermanent(), true, "Whenever a creature enters the battlefield under your control, you may destroy target artifact or enchantment"); - ability.addTarget(new TargetPermanent(filter)); + ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/commander2014/FreyaliseLlanowarsFury.java b/Mage.Sets/src/mage/sets/commander2014/FreyaliseLlanowarsFury.java index 9a85986a5f..adf5daa6ca 100644 --- a/Mage.Sets/src/mage/sets/commander2014/FreyaliseLlanowarsFury.java +++ b/Mage.Sets/src/mage/sets/commander2014/FreyaliseLlanowarsFury.java @@ -43,10 +43,8 @@ import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.counters.CounterType; -import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.permanent.token.Token; import mage.target.TargetPermanent; @@ -57,13 +55,8 @@ import mage.target.TargetPermanent; */ public class FreyaliseLlanowarsFury extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); private static final FilterControlledCreaturePermanent filterGreen = new FilterControlledCreaturePermanent("green creature you control"); - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); filterGreen.add(new ColorPredicate(ObjectColor.GREEN)); } @@ -72,21 +65,19 @@ public class FreyaliseLlanowarsFury extends CardImpl { this.expansionSetCode = "C14"; this.subtype.add("Freyalise"); - this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(3)), false)); // +2: Put a 1/1 green Elf Druid creature token onto the battlefield with "{T}: Add {G} to your mana pool." this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new FreyaliseLlanowarsFuryToken()), 2)); // -2: Destroy target artifact or enchantment. LoyaltyAbility loyaltyAbility = new LoyaltyAbility(new DestroyTargetEffect(), -2); - loyaltyAbility.addTarget(new TargetPermanent(filter)); + loyaltyAbility.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.addAbility(loyaltyAbility); // -6: Draw a card for each green creature you control. this.addAbility(new LoyaltyAbility(new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filterGreen)), -6)); // Freyalise, Llanowar's Fury can be your commander. this.addAbility(CanBeYourCommanderAbility.getInstance()); - } public FreyaliseLlanowarsFury(final FreyaliseLlanowarsFury card) { diff --git a/Mage.Sets/src/mage/sets/conflux/FiligreeFracture.java b/Mage.Sets/src/mage/sets/conflux/FiligreeFracture.java index e229e08cb0..d232cccae2 100644 --- a/Mage.Sets/src/mage/sets/conflux/FiligreeFracture.java +++ b/Mage.Sets/src/mage/sets/conflux/FiligreeFracture.java @@ -36,9 +36,7 @@ import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -50,21 +48,12 @@ import mage.target.TargetPermanent; */ public class FiligreeFracture extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public FiligreeFracture(UUID ownerId) { super(ownerId, 82, "Filigree Fracture", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{G}"); this.expansionSetCode = "CON"; - // Destroy target artifact or enchantment. If that permanent was blue or black, draw a card. - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.getSpellAbility().addEffect(new DestroyTargetEffect()); this.getSpellAbility().addEffect(new FiligreeFractureEffect()); } diff --git a/Mage.Sets/src/mage/sets/darkascension/TorchFiend.java b/Mage.Sets/src/mage/sets/darkascension/TorchFiend.java index 662c0104c1..285ab2610f 100644 --- a/Mage.Sets/src/mage/sets/darkascension/TorchFiend.java +++ b/Mage.Sets/src/mage/sets/darkascension/TorchFiend.java @@ -28,7 +28,6 @@ package mage.sets.darkascension; import java.util.UUID; - import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; diff --git a/Mage.Sets/src/mage/sets/darkascension/WerewolfRansacker.java b/Mage.Sets/src/mage/sets/darkascension/WerewolfRansacker.java index 452b74d0fa..20b2619b74 100644 --- a/Mage.Sets/src/mage/sets/darkascension/WerewolfRansacker.java +++ b/Mage.Sets/src/mage/sets/darkascension/WerewolfRansacker.java @@ -28,7 +28,6 @@ package mage.sets.darkascension; import java.util.UUID; - import mage.constants.*; import mage.MageInt; import mage.abilities.Ability; @@ -45,6 +44,7 @@ import mage.abilities.keyword.TransformAbility; import mage.cards.CardImpl; import mage.filter.FilterPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactPermanent; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; @@ -90,17 +90,12 @@ public class WerewolfRansacker extends CardImpl { } class WerewolfRansackerAbility extends TriggeredAbilityImpl { - - private static final FilterPermanent filter = new FilterPermanent("artifact"); + public static final String RULE_TEXT = "Whenever this creature transforms into Werewolf Ransacker, you may destroy target artifact. If that artifact is put into a graveyard this way, Werewolf Ransacker deals 3 damage to that artifact's controller"; - - static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); - } - + public WerewolfRansackerAbility() { super(Zone.BATTLEFIELD, new WerewolfRansackerEffect(), true); - Target target = new TargetPermanent(filter); + Target target = new TargetPermanent(new FilterArtifactPermanent()); this.addTarget(target); } @@ -129,7 +124,6 @@ class WerewolfRansackerAbility extends TriggeredAbilityImpl { public String getRule() { return RULE_TEXT + '.'; } - } class WerewolfRansackerEffect extends OneShotEffect { @@ -167,5 +161,4 @@ class WerewolfRansackerEffect extends OneShotEffect { } return affectedTargets > 0; } - } diff --git a/Mage.Sets/src/mage/sets/darksteel/Oxidize.java b/Mage.Sets/src/mage/sets/darksteel/Oxidize.java index a0d075f092..0cae108e86 100644 --- a/Mage.Sets/src/mage/sets/darksteel/Oxidize.java +++ b/Mage.Sets/src/mage/sets/darksteel/Oxidize.java @@ -25,17 +25,14 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.darksteel; import java.util.UUID; - import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactPermanent; import mage.target.TargetPermanent; /** @@ -43,18 +40,12 @@ import mage.target.TargetPermanent; */ public class Oxidize extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact"); - - static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); - } - public Oxidize(UUID ownerId) { super(ownerId, 79, "Oxidize", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{G}"); this.expansionSetCode = "DST"; this.getSpellAbility().addEffect(new DestroyTargetEffect(true)); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactPermanent())); } public Oxidize(final Oxidize card) { @@ -65,5 +56,4 @@ public class Oxidize extends CardImpl { public Oxidize copy() { return new Oxidize(this); } - } diff --git a/Mage.Sets/src/mage/sets/darksteel/ViridianZealot.java b/Mage.Sets/src/mage/sets/darksteel/ViridianZealot.java index ba3372745f..d8e1ace7d8 100644 --- a/Mage.Sets/src/mage/sets/darksteel/ViridianZealot.java +++ b/Mage.Sets/src/mage/sets/darksteel/ViridianZealot.java @@ -25,11 +25,9 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.darksteel; import java.util.UUID; - import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; @@ -40,9 +38,7 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; import mage.constants.Zone; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -50,14 +46,6 @@ import mage.target.TargetPermanent; */ public class ViridianZealot extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public ViridianZealot(UUID ownerId) { super(ownerId, 90, "Viridian Zealot", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{G}{G}"); this.expansionSetCode = "DST"; @@ -66,9 +54,11 @@ public class ViridianZealot extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(1); + + // {1}{G}, Sacrifice Viridian Zealot: Destroy target artifact or enchantment. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{1}{G}")); ability.addCost(new SacrificeSourceCost()); - ability.addTarget(new TargetPermanent(filter)); + ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.addAbility(ability); } @@ -80,5 +70,4 @@ public class ViridianZealot extends CardImpl { public ViridianZealot copy() { return new ViridianZealot(this); } - } diff --git a/Mage.Sets/src/mage/sets/dissension/IndrikStomphowler.java b/Mage.Sets/src/mage/sets/dissension/IndrikStomphowler.java index ab3cfcce02..0181c37f9e 100644 --- a/Mage.Sets/src/mage/sets/dissension/IndrikStomphowler.java +++ b/Mage.Sets/src/mage/sets/dissension/IndrikStomphowler.java @@ -28,7 +28,6 @@ package mage.sets.dissension; import java.util.UUID; - import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; @@ -36,9 +35,7 @@ import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -46,14 +43,6 @@ import mage.target.TargetPermanent; */ public class IndrikStomphowler extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public IndrikStomphowler(UUID ownerId) { super(ownerId, 86, "Indrik Stomphowler", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{G}"); this.expansionSetCode = "DIS"; @@ -62,7 +51,7 @@ public class IndrikStomphowler extends CardImpl { this.power = new MageInt(4); this.toughness = new MageInt(4); Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), false); - ability.addTarget(new TargetPermanent(filter)); + ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/fifthdawn/TelJiladJustice.java b/Mage.Sets/src/mage/sets/fifthdawn/TelJiladJustice.java index 37cfafa777..5e09b49285 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/TelJiladJustice.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/TelJiladJustice.java @@ -45,7 +45,6 @@ public class TelJiladJustice extends CardImpl { super(ownerId, 95, "Tel-Jilad Justice", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{G}"); this.expansionSetCode = "5DN"; - // Destroy target artifact. this.getSpellAbility().addEffect(new DestroyTargetEffect()); this.getSpellAbility().addTarget(new TargetArtifactPermanent()); diff --git a/Mage.Sets/src/mage/sets/guildpact/ShatteringSpree.java b/Mage.Sets/src/mage/sets/guildpact/ShatteringSpree.java index 8d445861e8..f84eca751d 100644 --- a/Mage.Sets/src/mage/sets/guildpact/ShatteringSpree.java +++ b/Mage.Sets/src/mage/sets/guildpact/ShatteringSpree.java @@ -46,7 +46,6 @@ public class ShatteringSpree extends CardImpl { super(ownerId, 75, "Shattering Spree", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{R}"); this.expansionSetCode = "GPT"; - // Replicate {R} this.addAbility(new ReplicateAbility(this, "{R}")); // Destroy target artifact. diff --git a/Mage.Sets/src/mage/sets/innistrad/AncientGrudge.java b/Mage.Sets/src/mage/sets/innistrad/AncientGrudge.java index 8936c752c6..54a7f3404e 100644 --- a/Mage.Sets/src/mage/sets/innistrad/AncientGrudge.java +++ b/Mage.Sets/src/mage/sets/innistrad/AncientGrudge.java @@ -34,8 +34,7 @@ import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.FlashbackAbility; import mage.cards.CardImpl; import mage.constants.TimingRule; -import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactPermanent; import mage.target.TargetPermanent; import java.util.UUID; @@ -44,21 +43,13 @@ import java.util.UUID; * @author nantuko */ public class AncientGrudge extends CardImpl { - - private static final FilterPermanent filter = new FilterPermanent("artifact"); - - static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); - } - public AncientGrudge(UUID ownerId) { super(ownerId, 127, "Ancient Grudge", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{R}"); this.expansionSetCode = "ISD"; - // Destroy target artifact. this.getSpellAbility().addEffect(new DestroyTargetEffect()); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactPermanent())); // Flashback {G} this.addAbility(new FlashbackAbility(new ManaCostsImpl("{G}"), TimingRule.INSTANT)); diff --git a/Mage.Sets/src/mage/sets/invasion/DismantlingBlow.java b/Mage.Sets/src/mage/sets/invasion/DismantlingBlow.java index 7d6e4f246f..7d3e1c221d 100644 --- a/Mage.Sets/src/mage/sets/invasion/DismantlingBlow.java +++ b/Mage.Sets/src/mage/sets/invasion/DismantlingBlow.java @@ -36,9 +36,7 @@ import mage.abilities.keyword.KickerAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -47,24 +45,15 @@ import mage.target.TargetPermanent; */ public class DismantlingBlow extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public DismantlingBlow(UUID ownerId) { super(ownerId, 14, "Dismantling Blow", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{W}"); this.expansionSetCode = "INV"; - // Kicker {2}{U} this.addAbility(new KickerAbility("{2}{U}")); // Destroy target artifact or enchantment. this.getSpellAbility().addEffect(new DestroyTargetEffect()); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); // If Dismantling Blow was kicked, draw two cards. this.getSpellAbility().addEffect(new ConditionalOneShotEffect( new DrawCardSourceControllerEffect(2), diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/SultaiCharm.java b/Mage.Sets/src/mage/sets/khansoftarkir/SultaiCharm.java index c81bb8869c..68e6d6f445 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/SultaiCharm.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/SultaiCharm.java @@ -57,7 +57,6 @@ public class SultaiCharm extends CardImpl { super(ownerId, 204, "Sultai Charm", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{B}{G}{U}"); this.expansionSetCode = "KTK"; - // Choose one - // * Destroy target monocolored creature. this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter)); @@ -73,7 +72,6 @@ public class SultaiCharm extends CardImpl { mode = new Mode(); mode.getEffects().add(new DrawDiscardControllerEffect(2,1)); this.getSpellAbility().addMode(mode); - } public SultaiCharm(final SultaiCharm card) { diff --git a/Mage.Sets/src/mage/sets/magic2010/SolemnOffering.java b/Mage.Sets/src/mage/sets/magic2010/SolemnOffering.java index f3d3f8deb3..2c695654c3 100644 --- a/Mage.Sets/src/mage/sets/magic2010/SolemnOffering.java +++ b/Mage.Sets/src/mage/sets/magic2010/SolemnOffering.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.magic2010; import java.util.UUID; @@ -34,9 +33,7 @@ import mage.constants.Rarity; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -45,19 +42,12 @@ import mage.target.TargetPermanent; */ public class SolemnOffering extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public SolemnOffering(UUID ownerId) { super(ownerId, 33, "Solemn Offering", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{2}{W}"); this.expansionSetCode = "M10"; - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + // Destroy target artifact or enchantment. You gain 4 life. + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.getSpellAbility().addEffect(new DestroyTargetEffect()); this.getSpellAbility().addEffect(new GainLifeEffect(4)); } diff --git a/Mage.Sets/src/mage/sets/magic2011/ManicVandal.java b/Mage.Sets/src/mage/sets/magic2011/ManicVandal.java index b4974d6724..c00248da50 100644 --- a/Mage.Sets/src/mage/sets/magic2011/ManicVandal.java +++ b/Mage.Sets/src/mage/sets/magic2011/ManicVandal.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.magic2011; import java.util.UUID; @@ -36,8 +35,7 @@ import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactPermanent; import mage.target.Target; import mage.target.TargetPermanent; @@ -47,12 +45,6 @@ import mage.target.TargetPermanent; */ public class ManicVandal extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact"); - - static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); - } - public ManicVandal(UUID ownerId) { super(ownerId, 151, "Manic Vandal", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{R}"); this.expansionSetCode = "M11"; @@ -63,7 +55,7 @@ public class ManicVandal extends CardImpl { this.toughness = new MageInt(2); Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), false); - Target target = new TargetPermanent(filter); + Target target = new TargetPermanent(new FilterArtifactPermanent()); ability.addTarget(target); this.addAbility(ability); } @@ -76,5 +68,4 @@ public class ManicVandal extends CardImpl { public ManicVandal copy() { return new ManicVandal(this); } - } diff --git a/Mage.Sets/src/mage/sets/magic2013/Smelt.java b/Mage.Sets/src/mage/sets/magic2013/Smelt.java index ff67773bb9..2db7734370 100644 --- a/Mage.Sets/src/mage/sets/magic2013/Smelt.java +++ b/Mage.Sets/src/mage/sets/magic2013/Smelt.java @@ -44,7 +44,6 @@ public class Smelt extends CardImpl { super(ownerId, 149, "Smelt", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{R}"); this.expansionSetCode = "M13"; - // Destroy target artifact. this.getSpellAbility().addEffect(new DestroyTargetEffect()); this.getSpellAbility().addTarget(new TargetArtifactPermanent()); diff --git a/Mage.Sets/src/mage/sets/mirrodin/Shatter.java b/Mage.Sets/src/mage/sets/mirrodin/Shatter.java index 44bce28e95..6c8c5d5154 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/Shatter.java +++ b/Mage.Sets/src/mage/sets/mirrodin/Shatter.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.mirrodin; import java.util.UUID; @@ -33,8 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactPermanent; import mage.target.TargetPermanent; /** @@ -42,19 +40,13 @@ import mage.target.TargetPermanent; * @author Loki */ public class Shatter extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact"); - - static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); - } - public Shatter (UUID ownerId) { super(ownerId, 105, "Shatter", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{R}"); this.expansionSetCode = "MRD"; // Destroy target artifact. this.getSpellAbility().addEffect(new DestroyTargetEffect()); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactPermanent())); } public Shatter (final Shatter card) { @@ -65,5 +57,4 @@ public class Shatter extends CardImpl { public Shatter copy() { return new Shatter(this); } - } diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/ViridianCorrupter.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/ViridianCorrupter.java index 93d5b5a96b..1b78b3a011 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/ViridianCorrupter.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/ViridianCorrupter.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.mirrodinbesieged; import java.util.UUID; @@ -37,8 +36,7 @@ import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.InfectAbility; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactPermanent; import mage.target.Target; import mage.target.TargetPermanent; @@ -48,12 +46,6 @@ import mage.target.TargetPermanent; */ public class ViridianCorrupter extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact"); - - static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); - } - public ViridianCorrupter (UUID ownerId) { super(ownerId, 94, "Viridian Corrupter", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{G}{G}"); this.expansionSetCode = "MBS"; @@ -64,8 +56,9 @@ public class ViridianCorrupter extends CardImpl { this.toughness = new MageInt(2); this.addAbility(InfectAbility.getInstance()); + // When Viridian Corrupter enters the battlefield, destroy target artifact. Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), false); - Target target = new TargetPermanent(filter); + Target target = new TargetPermanent(new FilterArtifactPermanent()); ability.addTarget(target); this.addAbility(ability); } @@ -78,5 +71,4 @@ public class ViridianCorrupter extends CardImpl { public ViridianCorrupter copy() { return new ViridianCorrupter(this); } - } diff --git a/Mage.Sets/src/mage/sets/nemesis/SealOfCleansing.java b/Mage.Sets/src/mage/sets/nemesis/SealOfCleansing.java index b4ba95f23f..19f87fb040 100644 --- a/Mage.Sets/src/mage/sets/nemesis/SealOfCleansing.java +++ b/Mage.Sets/src/mage/sets/nemesis/SealOfCleansing.java @@ -28,7 +28,6 @@ package mage.sets.nemesis; import java.util.UUID; - import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.Ability; @@ -37,9 +36,7 @@ import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; import mage.constants.Zone; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -47,23 +44,14 @@ import mage.target.TargetPermanent; * @author Plopman */ public class SealOfCleansing extends CardImpl { - - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } public SealOfCleansing(UUID ownerId) { super(ownerId, 18, "Seal of Cleansing", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); this.expansionSetCode = "NMS"; - // Sacrifice Seal of Cleansing: Destroy target artifact or enchantment. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new SacrificeSourceCost()); - ability.addTarget(new TargetPermanent(filter)); + ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/odyssey/RayOfDistortion.java b/Mage.Sets/src/mage/sets/odyssey/RayOfDistortion.java index 36233bea58..a57877773c 100644 --- a/Mage.Sets/src/mage/sets/odyssey/RayOfDistortion.java +++ b/Mage.Sets/src/mage/sets/odyssey/RayOfDistortion.java @@ -35,9 +35,7 @@ import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.TimingRule; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -46,20 +44,13 @@ import mage.target.TargetPermanent; */ public class RayOfDistortion extends CardImpl { - static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.ENCHANTMENT))); - } - public RayOfDistortion(UUID ownerId) { super(ownerId, 42, "Ray of Distortion", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{W}"); this.expansionSetCode = "ODY"; - // Destroy target artifact or enchantment. this.getSpellAbility().addEffect(new DestroyTargetEffect()); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); // Flashback {4}{W}{W} this.addAbility(new FlashbackAbility(new ManaCostsImpl("{4}{W}{W}"), TimingRule.INSTANT)); } diff --git a/Mage.Sets/src/mage/sets/planarchaos/SealOfPrimordium.java b/Mage.Sets/src/mage/sets/planarchaos/SealOfPrimordium.java index 91d38aa731..4dcee2ae1b 100644 --- a/Mage.Sets/src/mage/sets/planarchaos/SealOfPrimordium.java +++ b/Mage.Sets/src/mage/sets/planarchaos/SealOfPrimordium.java @@ -28,7 +28,6 @@ package mage.sets.planarchaos; import java.util.UUID; - import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.Ability; @@ -37,9 +36,7 @@ import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; import mage.constants.Zone; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -48,22 +45,13 @@ import mage.target.TargetPermanent; */ public class SealOfPrimordium extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public SealOfPrimordium(UUID ownerId) { super(ownerId, 153, "Seal of Primordium", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}"); this.expansionSetCode = "PLC"; - // Sacrifice Seal of Primordium: Destroy target artifact or enchantment. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new SacrificeSourceCost()); - ability.addTarget(new TargetPermanent(filter)); + ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/planechase2012/NullmageAdvocate.java b/Mage.Sets/src/mage/sets/planechase2012/NullmageAdvocate.java index 6d89ed2872..358c04d9e5 100644 --- a/Mage.Sets/src/mage/sets/planechase2012/NullmageAdvocate.java +++ b/Mage.Sets/src/mage/sets/planechase2012/NullmageAdvocate.java @@ -40,9 +40,7 @@ import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect; import mage.cards.CardImpl; import mage.filter.FilterCard; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; import mage.target.common.TargetCardInOpponentsGraveyard; import mage.target.targetpointer.SecondTargetPointer; @@ -53,17 +51,11 @@ import mage.target.targetpointer.SecondTargetPointer; */ public class NullmageAdvocate extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent(); - static { - filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.ENCHANTMENT))); - } - public NullmageAdvocate(UUID ownerId) { super(ownerId, 70, "Nullmage Advocate", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{G}"); this.expansionSetCode = "PC2"; this.subtype.add("Insect"); this.subtype.add("Druid"); - this.power = new MageInt(2); this.toughness = new MageInt(3); @@ -76,7 +68,7 @@ public class NullmageAdvocate extends CardImpl { effect.setTargetPointer(new SecondTargetPointer()); ability.addEffect(effect); ability.addTarget(new TargetCardInOpponentsGraveyard(2,2, new FilterCard("two target cards from an opponent's graveyard"), true)); - ability.addTarget(new TargetPermanent(filter)); + ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/ravnica/NullmageShepherd.java b/Mage.Sets/src/mage/sets/ravnica/NullmageShepherd.java index ede068e74e..160b53f7c5 100644 --- a/Mage.Sets/src/mage/sets/ravnica/NullmageShepherd.java +++ b/Mage.Sets/src/mage/sets/ravnica/NullmageShepherd.java @@ -28,7 +28,6 @@ package mage.sets.ravnica; import java.util.UUID; - import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; @@ -38,10 +37,9 @@ import mage.abilities.costs.common.TapTargetCost; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; import mage.constants.Zone; -import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.filter.predicate.permanent.TappedPredicate; import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; @@ -53,13 +51,8 @@ import mage.target.common.TargetControlledCreaturePermanent; public class NullmageShepherd extends CardImpl { private static final FilterControlledCreaturePermanent filterCost = new FilterControlledCreaturePermanent("untapped creatures you control"); - private static final FilterPermanent filterTarget = new FilterPermanent("artifact or enchantment"); - static { filterCost.add(Predicates.not(new TappedPredicate())); - filterTarget.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); } public NullmageShepherd(UUID ownerId) { @@ -73,7 +66,7 @@ public class NullmageShepherd extends CardImpl { // Tap four untapped creatures you control: Destroy target artifact or enchantment. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new TapTargetCost(new TargetControlledCreaturePermanent(4, 4, filterCost, true))); - ability.addTarget(new TargetPermanent(filterTarget)); + ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/ravnica/SunderingVitae.java b/Mage.Sets/src/mage/sets/ravnica/SunderingVitae.java index bf5465aa57..208e25aa39 100644 --- a/Mage.Sets/src/mage/sets/ravnica/SunderingVitae.java +++ b/Mage.Sets/src/mage/sets/ravnica/SunderingVitae.java @@ -33,9 +33,7 @@ import mage.constants.Rarity; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.ConvokeAbility; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -43,24 +41,15 @@ import mage.target.TargetPermanent; * @author jonubuu */ public class SunderingVitae extends CardImpl { - - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } public SunderingVitae(UUID ownerId) { super(ownerId, 185, "Sundering Vitae", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{G}"); this.expansionSetCode = "RAV"; - // Convoke this.addAbility(new ConvokeAbility()); // Destroy target artifact or enchantment. - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.getSpellAbility().addEffect(new DestroyTargetEffect()); } diff --git a/Mage.Sets/src/mage/sets/returntoravnica/RakdosCharm.java b/Mage.Sets/src/mage/sets/returntoravnica/RakdosCharm.java index d6b4a5f73f..5ad478abf5 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/RakdosCharm.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/RakdosCharm.java @@ -55,7 +55,6 @@ public class RakdosCharm extends CardImpl { super(ownerId, 184, "Rakdos Charm", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{B}{R}"); this.expansionSetCode = "RTR"; - // Choose one — Exile all cards from target player's graveyard; this.getSpellAbility().addEffect(new ExileGraveyardAllTargetPlayerEffect()); this.getSpellAbility().addTarget(new TargetPlayer()); @@ -81,7 +80,6 @@ public class RakdosCharm extends CardImpl { return new RakdosCharm(this); } - private class RakdosCharmDamageEffect extends OneShotEffect { public RakdosCharmDamageEffect() { @@ -113,6 +111,5 @@ public class RakdosCharm extends CardImpl { public RakdosCharmDamageEffect copy() { return new RakdosCharmDamageEffect(this); } - } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/RendingVines.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/RendingVines.java index 4e59199b06..0716462a95 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/RendingVines.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/RendingVines.java @@ -52,7 +52,6 @@ public class RendingVines extends CardImpl { this.expansionSetCode = "SOK"; this.subtype.add("Arcane"); - // Destroy target artifact or enchantment if its converted mana cost is less than or equal to the number of cards in your hand. this.getSpellAbility().addEffect(new RendingVinesEffect()); this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/YukiOnna.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/YukiOnna.java index 8c9f6a80da..3c63718db8 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/YukiOnna.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/YukiOnna.java @@ -28,7 +28,6 @@ package mage.sets.saviorsofkamigawa; import java.util.UUID; - import mage.constants.CardType; import mage.constants.Rarity; import mage.MageInt; @@ -38,9 +37,8 @@ import mage.abilities.common.SpellCastControllerTriggeredAbility; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.ReturnToHandSourceEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; import mage.filter.common.FilterSpiritOrArcaneCard; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactPermanent; import mage.target.TargetPermanent; /** @@ -48,13 +46,6 @@ import mage.target.TargetPermanent; */ public class YukiOnna extends CardImpl { - private static final FilterSpiritOrArcaneCard filter = new FilterSpiritOrArcaneCard(); - private static final FilterPermanent filterTarget = new FilterPermanent("artifact"); - - static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); - } - public YukiOnna(UUID ownerId) { super(ownerId, 120, "Yuki-Onna", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{R}"); this.expansionSetCode = "SOK"; @@ -65,10 +56,10 @@ public class YukiOnna extends CardImpl { // When Yuki-Onna enters the battlefield, destroy target artifact. Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), false); - ability.addTarget(new TargetPermanent(filterTarget)); + ability.addTarget(new TargetPermanent(new FilterArtifactPermanent())); this.addAbility(ability); // Whenever you cast a Spirit or Arcane spell, you may return Yuki-Onna to its owner's hand. - this.addAbility(new SpellCastControllerTriggeredAbility(new ReturnToHandSourceEffect(true), filter, true)); + this.addAbility(new SpellCastControllerTriggeredAbility(new ReturnToHandSourceEffect(true), new FilterSpiritOrArcaneCard(), true)); } public YukiOnna(final YukiOnna card) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/SliceinTwain.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/SliceinTwain.java index a66f44aa3f..668c02f32e 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/SliceinTwain.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/SliceinTwain.java @@ -34,9 +34,7 @@ import mage.constants.Rarity; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -44,13 +42,6 @@ import mage.target.TargetPermanent; * @author Loki */ public class SliceinTwain extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } public SliceinTwain (UUID ownerId) { super(ownerId, 127, "Slice in Twain", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{G}{G}"); @@ -58,7 +49,7 @@ public class SliceinTwain extends CardImpl { this.getSpellAbility().addEffect(new DestroyTargetEffect()); this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1)); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); } public SliceinTwain (final SliceinTwain card) { @@ -69,5 +60,4 @@ public class SliceinTwain extends CardImpl { public SliceinTwain copy() { return new SliceinTwain(this); } - } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/SylvokReplica.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/SylvokReplica.java index d4f6062842..20a3e9bd36 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/SylvokReplica.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/SylvokReplica.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.scarsofmirrodin; import java.util.UUID; @@ -39,9 +38,7 @@ import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -49,13 +46,6 @@ import mage.target.TargetPermanent; * @author Loki */ public class SylvokReplica extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } public SylvokReplica (UUID ownerId) { super(ownerId, 210, "Sylvok Replica", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}"); @@ -63,9 +53,11 @@ public class SylvokReplica extends CardImpl { this.subtype.add("Shaman"); this.power = new MageInt(1); this.toughness = new MageInt(3); + + // {G}, Sacrifice Sylvok Replica: Destroy target artifact or enchantment. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{G}")); ability.addCost(new SacrificeSourceCost()); - ability.addTarget(new TargetPermanent(filter)); + ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.addAbility(ability); } @@ -77,5 +69,4 @@ public class SylvokReplica extends CardImpl { public SylvokReplica copy() { return new SylvokReplica(this); } - } diff --git a/Mage.Sets/src/mage/sets/shadowmoor/GleefulSabotage.java b/Mage.Sets/src/mage/sets/shadowmoor/GleefulSabotage.java index e2799927f8..16869be838 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/GleefulSabotage.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/GleefulSabotage.java @@ -33,9 +33,7 @@ import mage.abilities.keyword.ConspireAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -44,25 +42,16 @@ import mage.target.TargetPermanent; */ public class GleefulSabotage extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("target artifact or enchantment"); - - static { - filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), - (new CardTypePredicate(CardType.ENCHANTMENT)))); - } - public GleefulSabotage(UUID ownerId) { super(ownerId, 116, "Gleeful Sabotage", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{G}"); this.expansionSetCode = "SHM"; - // Destroy target artifact or enchantment. this.getSpellAbility().addEffect(new DestroyTargetEffect()); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); // Conspire this.addAbility(new ConspireAbility(this)); - } public GleefulSabotage(final GleefulSabotage card) { @@ -74,4 +63,3 @@ public class GleefulSabotage extends CardImpl { return new GleefulSabotage(this); } } - diff --git a/Mage.Sets/src/mage/sets/shadowmoor/SmashToSmithereens.java b/Mage.Sets/src/mage/sets/shadowmoor/SmashToSmithereens.java index 3214585d64..98ff75dc2b 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/SmashToSmithereens.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/SmashToSmithereens.java @@ -51,7 +51,6 @@ public class SmashToSmithereens extends CardImpl { super(ownerId, 107, "Smash to Smithereens", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{R}"); this.expansionSetCode = "SHM"; - // Destroy target artifact. Smash to Smithereens deals 3 damage to that artifact's controller. this.getSpellAbility().addTarget(new TargetArtifactPermanent()); this.getSpellAbility().addEffect(new DestroyTargetEffect()); diff --git a/Mage.Sets/src/mage/sets/shardsofalara/DispellersCapsule.java b/Mage.Sets/src/mage/sets/shardsofalara/DispellersCapsule.java index 29d1688d48..74a8c8d847 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/DispellersCapsule.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/DispellersCapsule.java @@ -25,11 +25,9 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.shardsofalara; import java.util.UUID; - import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; @@ -39,9 +37,7 @@ import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -49,21 +45,14 @@ import mage.target.TargetPermanent; * @author Loki */ public class DispellersCapsule extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - + public DispellersCapsule (UUID ownerId) { super(ownerId, 8, "Dispeller's Capsule", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{W}"); this.expansionSetCode = "ALA"; Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{2}{W}")); ability.addCost(new SacrificeSourceCost()); - ability.addTarget(new TargetPermanent(filter)); + ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/tempest/Disenchant.java b/Mage.Sets/src/mage/sets/tempest/Disenchant.java index 1a217e67c2..2d65f90508 100644 --- a/Mage.Sets/src/mage/sets/tempest/Disenchant.java +++ b/Mage.Sets/src/mage/sets/tempest/Disenchant.java @@ -32,9 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -43,20 +41,13 @@ import mage.target.TargetPermanent; */ public class Disenchant extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public Disenchant(UUID ownerId) { super(ownerId, 228, "Disenchant", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{W}"); this.expansionSetCode = "TMP"; + // Destroy target artifact or enchantment. this.getSpellAbility().addEffect(new DestroyTargetEffect()); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); } public Disenchant(final Disenchant card) { diff --git a/Mage.Sets/src/mage/sets/tempest/Verdigris.java b/Mage.Sets/src/mage/sets/tempest/Verdigris.java index dbcf4169c3..d0ceab23f2 100644 --- a/Mage.Sets/src/mage/sets/tempest/Verdigris.java +++ b/Mage.Sets/src/mage/sets/tempest/Verdigris.java @@ -32,8 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactPermanent; import mage.target.TargetPermanent; /** @@ -42,18 +41,12 @@ import mage.target.TargetPermanent; */ public class Verdigris extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact"); - - static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); - } - public Verdigris(UUID ownerId) { super(ownerId, 158, "Verdigris", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{G}"); this.expansionSetCode = "TMP"; this.getSpellAbility().addEffect(new DestroyTargetEffect()); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactPermanent())); } public Verdigris(final Verdigris card) { diff --git a/Mage.Sets/src/mage/sets/tenthedition/Naturalize.java b/Mage.Sets/src/mage/sets/tenthedition/Naturalize.java index 3476eec9d7..7caac8fd17 100644 --- a/Mage.Sets/src/mage/sets/tenthedition/Naturalize.java +++ b/Mage.Sets/src/mage/sets/tenthedition/Naturalize.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.tenthedition; import java.util.UUID; @@ -33,9 +32,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -44,19 +41,12 @@ import mage.target.TargetPermanent; */ public class Naturalize extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public Naturalize(UUID ownerId){ super(ownerId, 282, "Naturalize", Rarity.COMMON, new CardType[]{CardType.INSTANT},"{1}{G}"); this.expansionSetCode = "10E"; - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + // Destroy target artifact or enchantment. + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.getSpellAbility().addEffect(new DestroyTargetEffect()); } diff --git a/Mage.Sets/src/mage/sets/theros/ArtisansSorrow.java b/Mage.Sets/src/mage/sets/theros/ArtisansSorrow.java index 650dfe91f8..c24bc93531 100644 --- a/Mage.Sets/src/mage/sets/theros/ArtisansSorrow.java +++ b/Mage.Sets/src/mage/sets/theros/ArtisansSorrow.java @@ -33,9 +33,7 @@ import mage.abilities.effects.keyword.ScryEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -43,20 +41,13 @@ import mage.target.TargetPermanent; * @author LevelX2 */ public class ArtisansSorrow extends CardImpl { - - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - static { - filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.ENCHANTMENT))); - } - public ArtisansSorrow(UUID ownerId) { super(ownerId, 151, "Artisan's Sorrow", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{3}{G}"); this.expansionSetCode = "THS"; - // Destroy target artifact or enchantment. Scry 2. this.getSpellAbility().addEffect(new DestroyTargetEffect()); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.getSpellAbility().addEffect(new ScryEffect(2)); } diff --git a/Mage.Sets/src/mage/sets/theros/DestructiveRevelry.java b/Mage.Sets/src/mage/sets/theros/DestructiveRevelry.java index 9bc8aeda09..88cb8a54b5 100644 --- a/Mage.Sets/src/mage/sets/theros/DestructiveRevelry.java +++ b/Mage.Sets/src/mage/sets/theros/DestructiveRevelry.java @@ -34,9 +34,7 @@ import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -49,19 +47,13 @@ import mage.target.TargetPermanent; */ public class DestructiveRevelry extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - static { - filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.ENCHANTMENT))); - } - public DestructiveRevelry(UUID ownerId) { super(ownerId, 192, "Destructive Revelry", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{R}{G}"); this.expansionSetCode = "THS"; - // Destroy target artifact or enchantment. Destructive Revelry deals 2 damage to that permanent's controller. this.getSpellAbility().addEffect(new DestructiveRevelryEffect()); - Target target = new TargetPermanent(filter); + Target target = new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()); this.getSpellAbility().addTarget(target); } diff --git a/Mage.Sets/src/mage/sets/timespiral/HarmonicSliver.java b/Mage.Sets/src/mage/sets/timespiral/HarmonicSliver.java index fef56e3baa..bfee4df16f 100644 --- a/Mage.Sets/src/mage/sets/timespiral/HarmonicSliver.java +++ b/Mage.Sets/src/mage/sets/timespiral/HarmonicSliver.java @@ -39,10 +39,8 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.target.TargetPermanent; @@ -53,13 +51,8 @@ import mage.target.TargetPermanent; public class HarmonicSliver extends CardImpl { private static final FilterCreaturePermanent filterSliver = new FilterCreaturePermanent(); - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); static { filterSliver.add(new SubtypePredicate("Sliver")); - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } public HarmonicSliver(UUID ownerId) { @@ -72,7 +65,7 @@ public class HarmonicSliver extends CardImpl { // All Slivers have "When this permanent enters the battlefield, destroy target artifact or enchantment." Ability ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), false); - TargetPermanent target = new TargetPermanent(filter); + TargetPermanent target = new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()); ability.addTarget(target); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect( ability, Duration.WhileOnBattlefield, diff --git a/Mage.Sets/src/mage/sets/timespiral/KrosanGrip.java b/Mage.Sets/src/mage/sets/timespiral/KrosanGrip.java index 8c434a31c1..9be4675622 100644 --- a/Mage.Sets/src/mage/sets/timespiral/KrosanGrip.java +++ b/Mage.Sets/src/mage/sets/timespiral/KrosanGrip.java @@ -33,9 +33,7 @@ import mage.constants.Rarity; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.SplitSecondAbility; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -43,24 +41,15 @@ import mage.target.TargetPermanent; * @author jonubuu */ public class KrosanGrip extends CardImpl { - - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } public KrosanGrip(UUID ownerId) { super(ownerId, 202, "Krosan Grip", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{G}"); this.expansionSetCode = "TSP"; - // Split second this.addAbility(new SplitSecondAbility()); // Destroy target artifact or enchantment. - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.getSpellAbility().addEffect(new DestroyTargetEffect()); } diff --git a/Mage.Sets/src/mage/sets/urzaslegacy/ViashinoHeretic.java b/Mage.Sets/src/mage/sets/urzaslegacy/ViashinoHeretic.java index 4572ec8cfa..dc603948e8 100644 --- a/Mage.Sets/src/mage/sets/urzaslegacy/ViashinoHeretic.java +++ b/Mage.Sets/src/mage/sets/urzaslegacy/ViashinoHeretic.java @@ -114,5 +114,4 @@ class ViashinoHereticEffect extends OneShotEffect { public String getText(Mode mode) { return "Destroy target artifact. Viashino Heretic deals damage to that artifact's controller equal to the artifact's converted mana cost"; } - } \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/urzassaga/Scrap.java b/Mage.Sets/src/mage/sets/urzassaga/Scrap.java index 3d98daa3a9..de35dc1345 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/Scrap.java +++ b/Mage.Sets/src/mage/sets/urzassaga/Scrap.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.urzassaga; import java.util.UUID; @@ -35,8 +34,7 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.CyclingAbility; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactPermanent; import mage.target.TargetPermanent; /** @@ -45,18 +43,12 @@ import mage.target.TargetPermanent; */ public class Scrap extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact"); - - static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); - } - public Scrap(UUID ownerId) { super(ownerId, 213, "Scrap", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{R}"); this.expansionSetCode = "USG"; this.getSpellAbility().addEffect(new DestroyTargetEffect()); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactPermanent())); this.addAbility(new CyclingAbility(new ManaCostsImpl("{2}"))); } diff --git a/Mage.Sets/src/mage/sets/vintagemasters/DevoutWitness.java b/Mage.Sets/src/mage/sets/vintagemasters/DevoutWitness.java index 56b9bf4d68..e3b050e15d 100644 --- a/Mage.Sets/src/mage/sets/vintagemasters/DevoutWitness.java +++ b/Mage.Sets/src/mage/sets/vintagemasters/DevoutWitness.java @@ -39,9 +39,7 @@ import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; import mage.constants.Zone; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -50,14 +48,6 @@ import mage.target.TargetPermanent; */ public class DevoutWitness extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public DevoutWitness(UUID ownerId) { super(ownerId, 24, "Devout Witness", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{W}"); this.expansionSetCode = "VMA"; @@ -71,7 +61,7 @@ public class DevoutWitness extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{1}{W}")); ability.addCost(new TapSourceCost()); ability.addCost(new DiscardCardCost()); - ability.addTarget(new TargetPermanent(filter)); + ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/weatherlight/AuraOfSilence.java b/Mage.Sets/src/mage/sets/weatherlight/AuraOfSilence.java index 66627a149a..a6a93384e8 100644 --- a/Mage.Sets/src/mage/sets/weatherlight/AuraOfSilence.java +++ b/Mage.Sets/src/mage/sets/weatherlight/AuraOfSilence.java @@ -43,9 +43,7 @@ import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.game.Game; import mage.target.TargetPermanent; import mage.util.CardUtil; @@ -55,25 +53,16 @@ import mage.util.CardUtil; * @author emerald000 */ public class AuraOfSilence extends CardImpl { - - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } - public AuraOfSilence(UUID ownerId) { super(ownerId, 123, "Aura of Silence", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{W}"); this.expansionSetCode = "WTH"; - // Artifact and enchantment spells your opponents cast cost {2} more to cast. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AuraOfSilenceCostModificationEffect())); // Sacrifice Aura of Silence: Destroy target artifact or enchantment. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new SacrificeSourceCost()); - ability.addTarget(new TargetPermanent(filter)); + ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/worldwake/NaturesClaim.java b/Mage.Sets/src/mage/sets/worldwake/NaturesClaim.java index 08fcea4fdf..8bfc053fdf 100644 --- a/Mage.Sets/src/mage/sets/worldwake/NaturesClaim.java +++ b/Mage.Sets/src/mage/sets/worldwake/NaturesClaim.java @@ -25,11 +25,9 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.worldwake; import java.util.UUID; - import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.Ability; @@ -38,9 +36,7 @@ import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; import mage.constants.Outcome; import mage.constants.Zone; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -51,21 +47,15 @@ import mage.target.TargetPermanent; * @author Loki */ public class NaturesClaim extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } public NaturesClaim (UUID ownerId) { super(ownerId, 108, "Nature's Claim", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{G}"); this.expansionSetCode = "WWK"; + // Destroy target artifact or enchantment. Its controller gains 4 life. this.getSpellAbility().addEffect(new DestroyTargetEffect()); this.getSpellAbility().addEffect(new NaturesClaimEffect()); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); } public NaturesClaim (final NaturesClaim card) { @@ -105,5 +95,4 @@ class NaturesClaimEffect extends OneShotEffect { public NaturesClaimEffect copy() { return new NaturesClaimEffect(this); } - } \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/zendikar/KorSanctifiers.java b/Mage.Sets/src/mage/sets/zendikar/KorSanctifiers.java index 938a174c88..ef0d2c637c 100644 --- a/Mage.Sets/src/mage/sets/zendikar/KorSanctifiers.java +++ b/Mage.Sets/src/mage/sets/zendikar/KorSanctifiers.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.sets.zendikar; import java.util.UUID; @@ -38,9 +37,7 @@ import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.KickerAbility; import mage.cards.CardImpl; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.target.TargetPermanent; /** @@ -48,13 +45,6 @@ import mage.target.TargetPermanent; * @author Loki */ public class KorSanctifiers extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.ENCHANTMENT))); - } public KorSanctifiers (UUID ownerId) { super(ownerId, 22, "Kor Sanctifiers", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{W}"); @@ -68,10 +58,9 @@ public class KorSanctifiers extends CardImpl { // Kicker {W} (You may pay an additional {W} as you cast this spell.) this.addAbility(new KickerAbility("{W}")); - // When Kor Sanctifiers enters the battlefield, if it was kicked, destroy target artifact or enchantment. EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new DestroyTargetEffect(), false); - ability.addTarget(new TargetPermanent(filter)); + ability.addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); this.addAbility(new ConditionalTriggeredAbility(ability, KickedCondition.getInstance(), "When {this} enters the battlefield, if it was kicked, destroy target artifact or enchantment.")); } @@ -83,5 +72,4 @@ public class KorSanctifiers extends CardImpl { public KorSanctifiers copy() { return new KorSanctifiers(this); } - } diff --git a/Mage.Sets/src/mage/sets/zendikar/RelicCrush.java b/Mage.Sets/src/mage/sets/zendikar/RelicCrush.java index 57f4342258..150a3c4c73 100644 --- a/Mage.Sets/src/mage/sets/zendikar/RelicCrush.java +++ b/Mage.Sets/src/mage/sets/zendikar/RelicCrush.java @@ -35,8 +35,7 @@ import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; @@ -47,24 +46,15 @@ import mage.target.TargetPermanent; */ public class RelicCrush extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment"); - - static { - filter.add(Predicates.or( - (new CardTypePredicate(CardType.ARTIFACT)), - (new CardTypePredicate(CardType.ENCHANTMENT)))); - } - 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()); this.getSpellAbility().addTarget(new TargetPermanent(filter)); this.getSpellAbility().addTarget(new TargetPermanent(0, 1, filter, false)); - } public RelicCrush(final RelicCrush card) { diff --git a/Mage/src/mage/filter/common/FilterArtifactOrEnchantmentPermanent.java b/Mage/src/mage/filter/common/FilterArtifactOrEnchantmentPermanent.java index b65da88c93..7aabd0eeec 100644 --- a/Mage/src/mage/filter/common/FilterArtifactOrEnchantmentPermanent.java +++ b/Mage/src/mage/filter/common/FilterArtifactOrEnchantmentPermanent.java @@ -1,9 +1,30 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. */ - package mage.filter.common; import mage.constants.CardType; @@ -15,7 +36,6 @@ import mage.filter.predicate.mageobject.CardTypePredicate; * * @author LevelX2 */ - public class FilterArtifactOrEnchantmentPermanent extends FilterPermanent { public FilterArtifactOrEnchantmentPermanent() {