add FilterSpiritOrArcaneCard, refactoring

This commit is contained in:
Loki 2011-09-04 16:26:49 +03:00
parent a4ed12b47b
commit 1ffa8f41c7
16 changed files with 65 additions and 142 deletions

View file

@ -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<GuardianOfSolitude> {
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<GuardianOfSolitude> {
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);
}

View file

@ -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<HikariTwilightGuardian> {
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<HikariTwilightGuardian> {
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) {

View file

@ -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<HorizonSeed> {
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<HorizonSeed> {
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);
}

View file

@ -76,10 +76,10 @@ class InameDeathAspectEffect extends SearchEffect<InameDeathAspectEffect> {
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);

View file

@ -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<InnocenceKami> {
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<InnocenceKami> {
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) {

View file

@ -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<KamiOfFiresRoar> {
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<KamiOfFiresRoar> {
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);
}

View file

@ -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<KamiOfTheHunt> {
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<KamiOfTheHunt> {
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) {

View file

@ -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<KamiOfTheWaningMoon> {
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<KamiOfTheWaningMoon> {
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);
}

View file

@ -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<KodamaOfTheSouthTree> {
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<KodamaOfTheSouthTree> {
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);
}

View file

@ -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<OrbweaverKumo> {
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<OrbweaverKumo> {
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) {

View file

@ -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<OreGorger> {
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<OreGorger> {
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);
}

View file

@ -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<SireOfTheStorm> {
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<SireOfTheStorm> {
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) {

View file

@ -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<Soilshaper> {
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<Soilshaper> {
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);
}

View file

@ -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<SoulOfMagma> {
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<SoulOfMagma> {
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);
}

View file

@ -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<ThiefOfHope> {
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<ThiefOfHope> {
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);

View file

@ -0,0 +1,32 @@
package mage.filter.common;
import mage.filter.Filter;
import mage.filter.FilterCard;
public class FilterSpiritOrArcaneCard extends FilterCard<FilterSpiritOrArcaneCard> {
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);
}
}