[refactor] removed constructor from FitlerControlledPermanent

This commit is contained in:
North 2013-09-08 01:30:36 +03:00
parent cf8c69e000
commit 26676b9ab5
5 changed files with 24 additions and 15 deletions

View file

@ -46,6 +46,7 @@ import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate; import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
/** /**
@ -54,10 +55,13 @@ import mage.target.common.TargetCreaturePermanent;
*/ */
public class JaggedScarArchers extends CardImpl<JaggedScarArchers> { public class JaggedScarArchers extends CardImpl<JaggedScarArchers> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying"); private static final FilterCreaturePermanent flyingCreatureFilter = new FilterCreaturePermanent("creature with flying");
private static final FilterControlledPermanent controlledElvesFilter = new FilterControlledPermanent("Elves you control");
static { static {
filter.add(new AbilityPredicate(FlyingAbility.class)); flyingCreatureFilter.add(new AbilityPredicate(FlyingAbility.class));
controlledElvesFilter.add(new SubtypePredicate("Elf"));
} }
public JaggedScarArchers(UUID ownerId) { public JaggedScarArchers(UUID ownerId) {
super(ownerId, 222, "Jagged-Scar Archers", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{G}{G}"); super(ownerId, 222, "Jagged-Scar Archers", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{G}{G}");
this.expansionSetCode = "LRW"; this.expansionSetCode = "LRW";
@ -69,10 +73,10 @@ public class JaggedScarArchers extends CardImpl<JaggedScarArchers> {
this.toughness = new MageInt(0); this.toughness = new MageInt(0);
// Jagged-Scar Archers's power and toughness are each equal to the number of Elves you control. // Jagged-Scar Archers's power and toughness are each equal to the number of Elves you control.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(new FilterControlledPermanent("Elf", "Elves you control")), Duration.EndOfGame))); this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(controlledElvesFilter), Duration.EndOfGame)));
// {tap}: Jagged-Scar Archers deals damage equal to its power to target creature with flying. // {tap}: Jagged-Scar Archers deals damage equal to its power to target creature with flying.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(new SourcePermanentPowerCount()), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(new SourcePermanentPowerCount()), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent(filter)); ability.addTarget(new TargetCreaturePermanent(flyingCreatureFilter));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -34,6 +34,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/** /**
* *
@ -41,6 +42,12 @@ import mage.filter.common.FilterControlledPermanent;
*/ */
public class MerrowCommerce extends CardImpl<MerrowCommerce> { public class MerrowCommerce extends CardImpl<MerrowCommerce> {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("Merfolk you control");
static {
filter.add(new SubtypePredicate("Merfolk"));
}
public MerrowCommerce(UUID ownerId) { public MerrowCommerce(UUID ownerId) {
super(ownerId, 72, "Merrow Commerce", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}"); super(ownerId, 72, "Merrow Commerce", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
this.expansionSetCode = "LRW"; this.expansionSetCode = "LRW";
@ -50,7 +57,7 @@ public class MerrowCommerce extends CardImpl<MerrowCommerce> {
this.color.setBlue(true); this.color.setBlue(true);
// At the beginning of your end step, untap all Merfolk you control. // At the beginning of your end step, untap all Merfolk you control.
this.addAbility(new BeginningOfYourEndStepTriggeredAbility(new UntapAllControllerEffect(new FilterControlledPermanent("Merfolk", "Merfolk you control"), "untap all Merfolk you control"), false)); this.addAbility(new BeginningOfYourEndStepTriggeredAbility(new UntapAllControllerEffect(filter, "untap all Merfolk you control"), false));
} }
public MerrowCommerce(final MerrowCommerce card) { public MerrowCommerce(final MerrowCommerce card) {

View file

@ -38,6 +38,7 @@ import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetControlledPermanent;
/** /**
@ -46,6 +47,12 @@ import mage.target.common.TargetControlledPermanent;
*/ */
public class WanderwineProphets extends CardImpl<WanderwineProphets> { public class WanderwineProphets extends CardImpl<WanderwineProphets> {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("Merfolk");
static {
filter.add(new SubtypePredicate("Merfolk"));
}
public WanderwineProphets(UUID ownerId) { public WanderwineProphets(UUID ownerId) {
super(ownerId, 95, "Wanderwine Prophets", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{U}{U}"); super(ownerId, 95, "Wanderwine Prophets", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{U}{U}");
this.expansionSetCode = "LRW"; this.expansionSetCode = "LRW";
@ -60,7 +67,7 @@ public class WanderwineProphets extends CardImpl<WanderwineProphets> {
this.addAbility(new ChampionAbility(this, "Merfolk")); this.addAbility(new ChampionAbility(this, "Merfolk"));
// Whenever Wanderwine Prophets deals combat damage to a player, you may sacrifice a Merfolk. If you do, take an extra turn after this one. // Whenever Wanderwine Prophets deals combat damage to a player, you may sacrifice a Merfolk. If you do, take an extra turn after this one.
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new AddExtraTurnControllerEffect(), true); Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new AddExtraTurnControllerEffect(), true);
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, new FilterControlledPermanent("Merfolk", "Merfolk"), true))); ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, filter, true)));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -47,7 +47,6 @@ import mage.constants.Zone;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreatureOrPlayer; import mage.target.common.TargetCreatureOrPlayer;
import mage.target.common.TargetCreaturePermanent;
/** /**
* *

View file

@ -30,7 +30,6 @@ package mage.filter.common;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate; import mage.filter.predicate.permanent.ControllerPredicate;
/** /**
@ -48,13 +47,6 @@ public class FilterControlledPermanent extends FilterPermanent {
this.add(new ControllerPredicate(TargetController.YOU)); this.add(new ControllerPredicate(TargetController.YOU));
} }
public FilterControlledPermanent(String subtype, String name) {
super(name);
this.add(new SubtypePredicate(subtype));
this.add(new ControllerPredicate(TargetController.YOU));
}
public FilterControlledPermanent(final FilterControlledPermanent filter) { public FilterControlledPermanent(final FilterControlledPermanent filter) {
super(filter); super(filter);
} }