From 1ffa8f41c72bfb3df3ad4fa72456eec788079936 Mon Sep 17 00:00:00 2001 From: Loki Date: Sun, 4 Sep 2011 16:26:49 +0300 Subject: [PATCH] add FilterSpiritOrArcaneCard, refactoring --- .../GuardianOfSolitude.java | 12 ++----- .../HikariTwilightGuardian.java | 12 ++----- .../sets/championsofkamigawa/HorizonSeed.java | 12 ++----- .../championsofkamigawa/InameDeathAspect.java | 8 ++--- .../championsofkamigawa/InnocenceKami.java | 12 ++----- .../championsofkamigawa/KamiOfFiresRoar.java | 12 ++----- .../championsofkamigawa/KamiOfTheHunt.java | 11 ++----- .../KamiOfTheWaningMoon.java | 12 ++----- .../KodamaOfTheSouthTree.java | 12 ++----- .../championsofkamigawa/OrbweaverKumo.java | 12 ++----- .../sets/championsofkamigawa/OreGorger.java | 12 ++----- .../championsofkamigawa/SireOfTheStorm.java | 12 ++----- .../sets/championsofkamigawa/Soilshaper.java | 12 ++----- .../sets/championsofkamigawa/SoulOfMagma.java | 12 ++----- .../sets/championsofkamigawa/ThiefOfHope.java | 12 ++----- .../common/FilterSpiritOrArcaneCard.java | 32 +++++++++++++++++++ 16 files changed, 65 insertions(+), 142 deletions(-) create mode 100644 Mage/src/mage/filter/common/FilterSpiritOrArcaneCard.java diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/GuardianOfSolitude.java b/Mage.Sets/src/mage/sets/championsofkamigawa/GuardianOfSolitude.java index e7252f21da..d66c789ce2 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/GuardianOfSolitude.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/GuardianOfSolitude.java @@ -41,21 +41,13 @@ import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.FilterCard; +import mage.filter.common.FilterSpiritOrArcaneCard; import mage.target.common.TargetCreaturePermanent; /** * @author Loki */ public class GuardianOfSolitude extends CardImpl { - - private final static FilterCard filter = new FilterCard("a Spirit or Arcane spell"); - - static { - filter.getSubtype().add("Spirit"); - filter.getSubtype().add("Arcane"); - filter.setScopeSubtype(Filter.ComparisonScope.Any); - } - public GuardianOfSolitude(UUID ownerId) { super(ownerId, 64, "Guardian of Solitude", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{U}"); this.expansionSetCode = "CHK"; @@ -63,7 +55,7 @@ public class GuardianOfSolitude extends CardImpl { this.color.setBlue(true); this.power = new MageInt(1); this.toughness = new MageInt(2); - Ability ability = new SpellCastTriggeredAbility(new GainAbilityTargetEffect(FlyingAbility.getInstance(), Constants.Duration.EndOfTurn), filter, false); + Ability ability = new SpellCastTriggeredAbility(new GainAbilityTargetEffect(FlyingAbility.getInstance(), Constants.Duration.EndOfTurn), FilterSpiritOrArcaneCard.getDefault(), false); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/HikariTwilightGuardian.java b/Mage.Sets/src/mage/sets/championsofkamigawa/HikariTwilightGuardian.java index f84278a704..04d96f49eb 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/HikariTwilightGuardian.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/HikariTwilightGuardian.java @@ -43,6 +43,8 @@ import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.FilterCard; +import mage.filter.FilterSpell; +import mage.filter.common.FilterSpiritOrArcaneCard; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; @@ -52,14 +54,6 @@ import mage.game.permanent.Permanent; * @author Loki */ public class HikariTwilightGuardian extends CardImpl { - private final static FilterCard filter = new FilterCard("a Spirit or Arcane spell"); - - static { - filter.getSubtype().add("Spirit"); - filter.getSubtype().add("Arcane"); - filter.setScopeSubtype(Filter.ComparisonScope.Any); - } - public HikariTwilightGuardian (UUID ownerId) { super(ownerId, 12, "Hikari, Twilight Guardian", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{W}{W}"); this.expansionSetCode = "CHK"; @@ -69,7 +63,7 @@ public class HikariTwilightGuardian extends CardImpl { this.power = new MageInt(4); this.toughness = new MageInt(4); this.addAbility(FlyingAbility.getInstance()); - this.addAbility(new SpellCastTriggeredAbility(new HikariTwilightGuardianEffect(), filter, true)); + this.addAbility(new SpellCastTriggeredAbility(new HikariTwilightGuardianEffect(), FilterSpiritOrArcaneCard.getDefault(), true)); } public HikariTwilightGuardian (final HikariTwilightGuardian card) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/HorizonSeed.java b/Mage.Sets/src/mage/sets/championsofkamigawa/HorizonSeed.java index 21622fa816..af1d27c713 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/HorizonSeed.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/HorizonSeed.java @@ -39,21 +39,13 @@ import mage.abilities.effects.common.RegenerateTargetEffect; import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.FilterCard; +import mage.filter.common.FilterSpiritOrArcaneCard; import mage.target.common.TargetCreaturePermanent; /** * @author Loki */ public class HorizonSeed extends CardImpl { - - private final static FilterCard filter = new FilterCard("Spirit or Arcane spell"); - - static { - filter.getSubtype().add("Spirit"); - filter.getSubtype().add("Arcane"); - filter.setScopeSubtype(Filter.ComparisonScope.Any); - } - public HorizonSeed(UUID ownerId) { super(ownerId, 15, "Horizon Seed", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{W}"); this.expansionSetCode = "CHK"; @@ -61,7 +53,7 @@ public class HorizonSeed extends CardImpl { this.color.setWhite(true); this.power = new MageInt(2); this.toughness = new MageInt(1); - Ability ability = new SpellCastTriggeredAbility(new RegenerateTargetEffect(), filter, false); + Ability ability = new SpellCastTriggeredAbility(new RegenerateTargetEffect(), FilterSpiritOrArcaneCard.getDefault(), false); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/InameDeathAspect.java b/Mage.Sets/src/mage/sets/championsofkamigawa/InameDeathAspect.java index 103c478b17..2b2cfeed5d 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/InameDeathAspect.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/InameDeathAspect.java @@ -76,10 +76,10 @@ class InameDeathAspectEffect extends SearchEffect { private final static FilterCreatureCard filter = new FilterCreatureCard(); -// static { -// filter.getSubtype().add("Spirit"); -// filter.setScopeSubtype(Filter.ComparisonScope.Any); -// } + static { + filter.getSubtype().add("Spirit"); + filter.setScopeSubtype(Filter.ComparisonScope.Any); + } public InameDeathAspectEffect() { super(new TargetCardInLibrary(0, 0, filter), Constants.Outcome.Neutral); diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/InnocenceKami.java b/Mage.Sets/src/mage/sets/championsofkamigawa/InnocenceKami.java index 07ee5f308d..0b02df21fc 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/InnocenceKami.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/InnocenceKami.java @@ -44,21 +44,13 @@ import mage.abilities.effects.common.UntapSourceEffect; import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.FilterCard; +import mage.filter.common.FilterSpiritOrArcaneCard; import mage.target.common.TargetCreaturePermanent; /** * @author Loki */ public class InnocenceKami extends CardImpl { - - private final static FilterCard filter = new FilterCard("a Spirit or Arcane spell"); - - static { - filter.getSubtype().add("Spirit"); - filter.getSubtype().add("Arcane"); - filter.setScopeSubtype(Filter.ComparisonScope.Any); - } - public InnocenceKami(UUID ownerId) { super(ownerId, 18, "Innocence Kami", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{W}{W}"); this.expansionSetCode = "CHK"; @@ -70,7 +62,7 @@ public class InnocenceKami extends CardImpl { ability.addCost(new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); - this.addAbility(new SpellCastTriggeredAbility(new UntapSourceEffect(), filter, false)); + this.addAbility(new SpellCastTriggeredAbility(new UntapSourceEffect(), FilterSpiritOrArcaneCard.getDefault(), false)); } public InnocenceKami(final InnocenceKami card) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/KamiOfFiresRoar.java b/Mage.Sets/src/mage/sets/championsofkamigawa/KamiOfFiresRoar.java index 5b95fc7885..e4d3e6917c 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/KamiOfFiresRoar.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/KamiOfFiresRoar.java @@ -41,21 +41,13 @@ import mage.abilities.effects.common.continious.GainAbilityTargetEffect; import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.FilterCard; +import mage.filter.common.FilterSpiritOrArcaneCard; import mage.target.common.TargetCreaturePermanent; /** * @author Loki */ public class KamiOfFiresRoar extends CardImpl { - - private final static FilterCard filter = new FilterCard("a Spirit of Arcane spell"); - - static { - filter.getSubtype().add("Spirit"); - filter.getSubtype().add("Arcane"); - filter.setScopeSubtype(Filter.ComparisonScope.Any); - } - public KamiOfFiresRoar(UUID ownerId) { super(ownerId, 174, "Kami of Fire's Roar", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{R}"); this.expansionSetCode = "CHK"; @@ -63,7 +55,7 @@ public class KamiOfFiresRoar extends CardImpl { this.color.setRed(true); this.power = new MageInt(2); this.toughness = new MageInt(3); - Ability ability = new SpellCastTriggeredAbility(new GainAbilityTargetEffect(CantBlockAbility.getInstance(), Constants.Duration.EndOfTurn), filter, false); + Ability ability = new SpellCastTriggeredAbility(new GainAbilityTargetEffect(CantBlockAbility.getInstance(), Constants.Duration.EndOfTurn), FilterSpiritOrArcaneCard.getDefault(), false); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/KamiOfTheHunt.java b/Mage.Sets/src/mage/sets/championsofkamigawa/KamiOfTheHunt.java index 0818bc434a..7ee24ac7cd 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/KamiOfTheHunt.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/KamiOfTheHunt.java @@ -39,20 +39,13 @@ import mage.abilities.effects.common.continious.BoostSourceEffect; import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.FilterCard; +import mage.filter.common.FilterSpiritOrArcaneCard; /** * @author Loki */ public class KamiOfTheHunt extends CardImpl { - private final static FilterCard filter = new FilterCard("a Spirit or Arcane spell"); - - static { - filter.getSubtype().add("Spirit"); - filter.getSubtype().add("Arcane"); - filter.setScopeSubtype(Filter.ComparisonScope.Any); - } - public KamiOfTheHunt(UUID ownerId) { super(ownerId, 219, "Kami of the Hunt", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{G}"); this.expansionSetCode = "CHK"; @@ -60,7 +53,7 @@ public class KamiOfTheHunt extends CardImpl { this.color.setGreen(true); this.power = new MageInt(2); this.toughness = new MageInt(2); - this.addAbility(new SpellCastTriggeredAbility(new BoostSourceEffect(1, 1, Constants.Duration.EndOfTurn), filter, false)); + this.addAbility(new SpellCastTriggeredAbility(new BoostSourceEffect(1, 1, Constants.Duration.EndOfTurn), FilterSpiritOrArcaneCard.getDefault(), false)); } public KamiOfTheHunt(final KamiOfTheHunt card) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/KamiOfTheWaningMoon.java b/Mage.Sets/src/mage/sets/championsofkamigawa/KamiOfTheWaningMoon.java index 5c088341d0..e973ad83e0 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/KamiOfTheWaningMoon.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/KamiOfTheWaningMoon.java @@ -42,21 +42,13 @@ import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.FilterCard; +import mage.filter.common.FilterSpiritOrArcaneCard; import mage.target.common.TargetCreaturePermanent; /** * @author Loki */ public class KamiOfTheWaningMoon extends CardImpl { - - private final static FilterCard filter = new FilterCard("a Spirit or Arcane spell"); - - static { - filter.getSubtype().add("Spirit"); - filter.getSubtype().add("Arcane"); - filter.setScopeSubtype(Filter.ComparisonScope.Any); - } - public KamiOfTheWaningMoon(UUID ownerId) { super(ownerId, 120, "Kami of the Waning Moon", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{B}"); this.expansionSetCode = "CHK"; @@ -65,7 +57,7 @@ public class KamiOfTheWaningMoon extends CardImpl { this.power = new MageInt(1); this.toughness = new MageInt(1); this.addAbility(FlyingAbility.getInstance()); - Ability ability = new SpellCastTriggeredAbility(new GainAbilityTargetEffect(FearAbility.getInstance(), Constants.Duration.EndOfTurn), filter, false); + Ability ability = new SpellCastTriggeredAbility(new GainAbilityTargetEffect(FearAbility.getInstance(), Constants.Duration.EndOfTurn), FilterSpiritOrArcaneCard.getDefault(), false); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/KodamaOfTheSouthTree.java b/Mage.Sets/src/mage/sets/championsofkamigawa/KodamaOfTheSouthTree.java index e5cd235b97..2b65abcfe4 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/KodamaOfTheSouthTree.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/KodamaOfTheSouthTree.java @@ -43,20 +43,12 @@ import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.FilterCard; import mage.filter.common.FilterCreaturePermanent; +import mage.filter.common.FilterSpiritOrArcaneCard; /** * @author Loki */ public class KodamaOfTheSouthTree extends CardImpl { - - private final static FilterCard filter = new FilterCard("a Spirit or Arcane spell"); - - static { - filter.getSubtype().add("Spirit"); - filter.getSubtype().add("Arcane"); - filter.setScopeSubtype(Filter.ComparisonScope.Any); - } - public KodamaOfTheSouthTree(UUID ownerId) { super(ownerId, 223, "Kodama of the South Tree", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{G}{G}"); this.expansionSetCode = "CHK"; @@ -65,7 +57,7 @@ public class KodamaOfTheSouthTree extends CardImpl { this.color.setGreen(true); this.power = new MageInt(4); this.toughness = new MageInt(4); - Ability ability = new SpellCastTriggeredAbility(new BoostControlledEffect(1, 1, Constants.Duration.EndOfTurn, FilterCreaturePermanent.getDefault(), true), filter, false); + Ability ability = new SpellCastTriggeredAbility(new BoostControlledEffect(1, 1, Constants.Duration.EndOfTurn, FilterCreaturePermanent.getDefault(), true), FilterSpiritOrArcaneCard.getDefault(), false); ability.addEffect(new GainAbilityControlledEffect(TrampleAbility.getInstance(), Constants.Duration.EndOfTurn, FilterCreaturePermanent.getDefault(), true)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/OrbweaverKumo.java b/Mage.Sets/src/mage/sets/championsofkamigawa/OrbweaverKumo.java index 5c9e9af242..8305182df3 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/OrbweaverKumo.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/OrbweaverKumo.java @@ -41,20 +41,12 @@ import mage.abilities.keyword.ReachAbility; import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.FilterCard; +import mage.filter.common.FilterSpiritOrArcaneCard; /** * @author Loki */ public class OrbweaverKumo extends CardImpl { - - private final static FilterCard filter = new FilterCard("a Spirit or Arcane spell"); - - static { - filter.getSubtype().add("Spirit"); - filter.getSubtype().add("Arcane"); - filter.setScopeSubtype(Filter.ComparisonScope.Any); - } - public OrbweaverKumo(UUID ownerId) { super(ownerId, 231, "Orbweaver Kumo", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{G}{G}"); this.expansionSetCode = "CHK"; @@ -63,7 +55,7 @@ public class OrbweaverKumo extends CardImpl { this.power = new MageInt(3); this.toughness = new MageInt(4); this.addAbility(ReachAbility.getInstance()); - this.addAbility(new SpellCastTriggeredAbility(new GainAbilitySourceEffect(new ForestwalkAbility(), Constants.Duration.EndOfTurn), filter, false)); + this.addAbility(new SpellCastTriggeredAbility(new GainAbilitySourceEffect(new ForestwalkAbility(), Constants.Duration.EndOfTurn), FilterSpiritOrArcaneCard.getDefault(), false)); } public OrbweaverKumo(final OrbweaverKumo card) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/OreGorger.java b/Mage.Sets/src/mage/sets/championsofkamigawa/OreGorger.java index 33aa4eca87..79e6f38286 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/OreGorger.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/OreGorger.java @@ -39,21 +39,13 @@ import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.FilterCard; +import mage.filter.common.FilterSpiritOrArcaneCard; import mage.target.common.TargetNonBasicLandPermanent; /** * @author Loki */ public class OreGorger extends CardImpl { - - private final static FilterCard filter = new FilterCard("a Spirit or Arcane spell"); - - static { - filter.getSubtype().add("Spirit"); - filter.getSubtype().add("Arcane"); - filter.setScopeSubtype(Filter.ComparisonScope.Any); - } - public OreGorger(UUID ownerId) { super(ownerId, 182, "Ore Gorger", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{R}{R}"); this.expansionSetCode = "CHK"; @@ -61,7 +53,7 @@ public class OreGorger extends CardImpl { this.color.setRed(true); this.power = new MageInt(3); this.toughness = new MageInt(1); - Ability ability = new SpellCastTriggeredAbility(new DestroyTargetEffect(), filter, true); + Ability ability = new SpellCastTriggeredAbility(new DestroyTargetEffect(), FilterSpiritOrArcaneCard.getDefault(), true); ability.addTarget(new TargetNonBasicLandPermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/SireOfTheStorm.java b/Mage.Sets/src/mage/sets/championsofkamigawa/SireOfTheStorm.java index 143fa1b7dd..cc237115da 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/SireOfTheStorm.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/SireOfTheStorm.java @@ -39,20 +39,12 @@ import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.FilterCard; +import mage.filter.common.FilterSpiritOrArcaneCard; /** * @author Loki */ public class SireOfTheStorm extends CardImpl { - - private final static FilterCard filter = new FilterCard("a Spirit or Arcane spell"); - - static { - filter.getSubtype().add("Spirit"); - filter.getSubtype().add("Arcane"); - filter.setScopeSubtype(Filter.ComparisonScope.Any); - } - public SireOfTheStorm(UUID ownerId) { super(ownerId, 85, "Sire of the Storm", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{U}{U}"); this.expansionSetCode = "CHK"; @@ -62,7 +54,7 @@ public class SireOfTheStorm extends CardImpl { this.power = new MageInt(3); this.toughness = new MageInt(3); this.addAbility(FlyingAbility.getInstance()); - this.addAbility(new SpellCastTriggeredAbility(new DrawCardControllerEffect(1), filter, true)); + this.addAbility(new SpellCastTriggeredAbility(new DrawCardControllerEffect(1), FilterSpiritOrArcaneCard.getDefault(), true)); } public SireOfTheStorm(final SireOfTheStorm card) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/Soilshaper.java b/Mage.Sets/src/mage/sets/championsofkamigawa/Soilshaper.java index cd0de00f4b..b31dcdf059 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/Soilshaper.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/Soilshaper.java @@ -40,6 +40,7 @@ import mage.abilities.effects.common.continious.BecomesCreatureTargetEffect; import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.FilterCard; +import mage.filter.common.FilterSpiritOrArcaneCard; import mage.game.permanent.token.Token; import mage.target.common.TargetLandPermanent; @@ -47,15 +48,6 @@ import mage.target.common.TargetLandPermanent; * @author Loki */ public class Soilshaper extends CardImpl { - - private final static FilterCard filter = new FilterCard("a Spirit or Arcane spell"); - - static { - filter.getSubtype().add("Spirit"); - filter.getSubtype().add("Arcane"); - filter.setScopeSubtype(Filter.ComparisonScope.Any); - } - public Soilshaper(UUID ownerId) { super(ownerId, 243, "Soilshaper", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{G}"); this.expansionSetCode = "CHK"; @@ -63,7 +55,7 @@ public class Soilshaper extends CardImpl { this.color.setGreen(true); this.power = new MageInt(1); this.toughness = new MageInt(1); - Ability ability = new SpellCastTriggeredAbility(new BecomesCreatureTargetEffect(new SoilshaperToken(), "land", Duration.EndOfTurn), filter, false); + Ability ability = new SpellCastTriggeredAbility(new BecomesCreatureTargetEffect(new SoilshaperToken(), "land", Duration.EndOfTurn), FilterSpiritOrArcaneCard.getDefault(), false); ability.addTarget(new TargetLandPermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/SoulOfMagma.java b/Mage.Sets/src/mage/sets/championsofkamigawa/SoulOfMagma.java index 8d62378372..85930bd7e3 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/SoulOfMagma.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/SoulOfMagma.java @@ -39,21 +39,13 @@ import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.FilterCard; +import mage.filter.common.FilterSpiritOrArcaneCard; import mage.target.common.TargetCreaturePermanent; /** * @author Loki */ public class SoulOfMagma extends CardImpl { - - private final static FilterCard filter = new FilterCard("a Spirit or Arcane spell"); - - static { - filter.getSubtype().add("Spirit"); - filter.getSubtype().add("Arcane"); - filter.setScopeSubtype(Filter.ComparisonScope.Any); - } - public SoulOfMagma(UUID ownerId) { super(ownerId, 189, "Soul of Magma", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{R}{R}"); this.expansionSetCode = "CHK"; @@ -61,7 +53,7 @@ public class SoulOfMagma extends CardImpl { this.color.setRed(true); this.power = new MageInt(2); this.toughness = new MageInt(2); - Ability ability = new SpellCastTriggeredAbility(new DamageTargetEffect(1), filter, false); + Ability ability = new SpellCastTriggeredAbility(new DamageTargetEffect(1), FilterSpiritOrArcaneCard.getDefault(), false); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/ThiefOfHope.java b/Mage.Sets/src/mage/sets/championsofkamigawa/ThiefOfHope.java index 8c2da54776..2d38218ff3 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/ThiefOfHope.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/ThiefOfHope.java @@ -41,21 +41,13 @@ import mage.abilities.keyword.SoulshiftAbility; import mage.cards.CardImpl; import mage.filter.Filter; import mage.filter.FilterCard; +import mage.filter.common.FilterSpiritOrArcaneCard; import mage.target.common.TargetOpponent; /** * @author Loki */ public class ThiefOfHope extends CardImpl { - - private final static FilterCard filter = new FilterCard("a Spirit or Arcane spell"); - - static { - filter.getSubtype().add("Spirit"); - filter.getSubtype().add("Arcane"); - filter.setScopeSubtype(Filter.ComparisonScope.Any); - } - public ThiefOfHope(UUID ownerId) { super(ownerId, 147, "Thief of Hope", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{B}"); this.expansionSetCode = "CHK"; @@ -63,7 +55,7 @@ public class ThiefOfHope extends CardImpl { this.color.setBlack(true); this.power = new MageInt(2); this.toughness = new MageInt(2); - Ability ability = new SpellCastTriggeredAbility(new LoseLifeTargetEffect(1), filter, false); + Ability ability = new SpellCastTriggeredAbility(new LoseLifeTargetEffect(1), FilterSpiritOrArcaneCard.getDefault(), false); ability.addEffect(new GainLifeEffect(1)); ability.addTarget(new TargetOpponent()); this.addAbility(ability); diff --git a/Mage/src/mage/filter/common/FilterSpiritOrArcaneCard.java b/Mage/src/mage/filter/common/FilterSpiritOrArcaneCard.java new file mode 100644 index 0000000000..df7160da48 --- /dev/null +++ b/Mage/src/mage/filter/common/FilterSpiritOrArcaneCard.java @@ -0,0 +1,32 @@ +package mage.filter.common; + +import mage.filter.Filter; +import mage.filter.FilterCard; + +public class FilterSpiritOrArcaneCard extends FilterCard { + private final static FilterSpiritOrArcaneCard defaultFilter = new FilterSpiritOrArcaneCard(); + + public FilterSpiritOrArcaneCard() { + this("a Spirit or Arcane spell"); + } + + public FilterSpiritOrArcaneCard(String name) { + super(name); + this.getSubtype().add("Spirit"); + this.getSubtype().add("Arcane"); + this.setScopeSubtype(Filter.ComparisonScope.Any); + } + + public FilterSpiritOrArcaneCard(final FilterSpiritOrArcaneCard filter) { + super(filter); + } + + public static FilterSpiritOrArcaneCard getDefault() { + return defaultFilter; + } + + @Override + public FilterSpiritOrArcaneCard copy() { + return new FilterSpiritOrArcaneCard(this); + } +}