diff --git a/Mage.Sets/src/mage/cards/b/BackToBasics.java b/Mage.Sets/src/mage/cards/b/BackToBasics.java index 45ccce6321..462683bc5f 100644 --- a/Mage.Sets/src/mage/cards/b/BackToBasics.java +++ b/Mage.Sets/src/mage/cards/b/BackToBasics.java @@ -37,8 +37,6 @@ import mage.constants.Duration; import mage.constants.TargetController; import mage.constants.Zone; import mage.filter.common.FilterLandPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.SupertypePredicate; /** * @@ -46,18 +44,12 @@ import mage.filter.predicate.mageobject.SupertypePredicate; */ public class BackToBasics extends CardImpl { - private static final FilterLandPermanent filter = new FilterLandPermanent("Nonbasic lands"); - - static { - filter.add(Predicates.not(new SupertypePredicate("Basic"))); - } - public BackToBasics(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}"); // Nonbasic lands don't untap during their controllers' untap steps. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DontUntapInControllersUntapStepAllEffect(Duration.WhileOnBattlefield, TargetController.ANY, filter))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DontUntapInControllersUntapStepAllEffect(Duration.WhileOnBattlefield, TargetController.ANY, FilterLandPermanent.nonbasicLands()))); } public BackToBasics(final BackToBasics card) { diff --git a/Mage.Sets/src/mage/cards/d/DestructiveFlow.java b/Mage.Sets/src/mage/cards/d/DestructiveFlow.java index e1cc008c58..c560638bca 100644 --- a/Mage.Sets/src/mage/cards/d/DestructiveFlow.java +++ b/Mage.Sets/src/mage/cards/d/DestructiveFlow.java @@ -35,8 +35,6 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.TargetController; import mage.filter.common.FilterLandPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.SupertypePredicate; /** * @@ -44,17 +42,11 @@ import mage.filter.predicate.mageobject.SupertypePredicate; */ public class DestructiveFlow extends CardImpl { - private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic land"); - - static { - filter.add(Predicates.not(new SupertypePredicate("Basic"))); - } - public DestructiveFlow(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{B}{R}{G}"); // At the beginning of each player's upkeep, that player sacrifices a nonbasic land. - this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeEffect(filter, 1, "that player"), + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeEffect(FilterLandPermanent.nonbasicLand(), 1, "that player"), TargetController.ANY, false)); } diff --git a/Mage.Sets/src/mage/cards/d/DryadSophisticate.java b/Mage.Sets/src/mage/cards/d/DryadSophisticate.java index dbfa78599f..890a952190 100644 --- a/Mage.Sets/src/mage/cards/d/DryadSophisticate.java +++ b/Mage.Sets/src/mage/cards/d/DryadSophisticate.java @@ -34,8 +34,6 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.filter.common.FilterLandPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.SupertypePredicate; /** * @@ -51,7 +49,7 @@ public class DryadSophisticate extends CardImpl { this.toughness = new MageInt(1); // Nonbasic landwalk - this.addAbility(new NonbasicLandwalkAbility()); + this.addAbility(new LandwalkAbility(FilterLandPermanent.nonbasicLand())); } public DryadSophisticate(final DryadSophisticate card) { @@ -63,25 +61,3 @@ public class DryadSophisticate extends CardImpl { return new DryadSophisticate(this); } } - -class NonbasicLandwalkAbility extends LandwalkAbility { - - private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic land"); - - static { - filter.add(Predicates.not(new SupertypePredicate("Basic"))); - } - - public NonbasicLandwalkAbility() { - super(filter); - } - - public NonbasicLandwalkAbility(final NonbasicLandwalkAbility ability) { - super(ability); - } - - @Override - public NonbasicLandwalkAbility copy() { - return new NonbasicLandwalkAbility(this); - } -} diff --git a/Mage.Sets/src/mage/cards/f/FromTheAshes.java b/Mage.Sets/src/mage/cards/f/FromTheAshes.java index 8de8919d7f..61b5f307e1 100644 --- a/Mage.Sets/src/mage/cards/f/FromTheAshes.java +++ b/Mage.Sets/src/mage/cards/f/FromTheAshes.java @@ -40,9 +40,6 @@ import mage.constants.Outcome; import mage.constants.Zone; import mage.filter.common.FilterBasicLandCard; import mage.filter.common.FilterLandPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.filter.predicate.mageobject.SupertypePredicate; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -74,11 +71,7 @@ public class FromTheAshes extends CardImpl { class FromTheAshesEffect extends OneShotEffect { - private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic lands"); - static { - filter.add(new CardTypePredicate(CardType.LAND)); - filter.add(Predicates.not(new SupertypePredicate("Basic"))); - } + private static final FilterLandPermanent filter = FilterLandPermanent.nonbasicLands(); public FromTheAshesEffect() { super(Outcome.Benefit); diff --git a/Mage.Sets/src/mage/cards/p/PriceOfProgress.java b/Mage.Sets/src/mage/cards/p/PriceOfProgress.java index 2d76a3d0b4..b0a6f02f7a 100644 --- a/Mage.Sets/src/mage/cards/p/PriceOfProgress.java +++ b/Mage.Sets/src/mage/cards/p/PriceOfProgress.java @@ -35,8 +35,6 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; import mage.filter.common.FilterLandPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.SupertypePredicate; import mage.game.Game; import mage.players.Player; @@ -66,11 +64,7 @@ public class PriceOfProgress extends CardImpl { class PriceOfProgressEffect extends OneShotEffect { - private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic lands"); - - static { - filter.add(Predicates.not(new SupertypePredicate("Basic"))); - } + private static final FilterLandPermanent filter = FilterLandPermanent.nonbasicLands(); public PriceOfProgressEffect() { super(Outcome.Benefit); diff --git a/Mage.Sets/src/mage/cards/p/PrimalOrder.java b/Mage.Sets/src/mage/cards/p/PrimalOrder.java index 5251cd238f..f3e6454b11 100644 --- a/Mage.Sets/src/mage/cards/p/PrimalOrder.java +++ b/Mage.Sets/src/mage/cards/p/PrimalOrder.java @@ -39,8 +39,6 @@ import mage.constants.Outcome; import mage.constants.TargetController; import mage.constants.Zone; import mage.filter.common.FilterLandPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.SupertypePredicate; import mage.game.Game; import mage.players.Player; @@ -69,11 +67,7 @@ public class PrimalOrder extends CardImpl { class PrimalOrderDamageTargetEffect extends OneShotEffect{ - private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic lands"); - - static { - filter.add(Predicates.not(new SupertypePredicate("Basic"))); - } + private static final FilterLandPermanent filter = FilterLandPermanent.nonbasicLands(); public PrimalOrderDamageTargetEffect() { diff --git a/Mage.Sets/src/mage/cards/r/Ruination.java b/Mage.Sets/src/mage/cards/r/Ruination.java index a086eba476..42ed52bd6c 100644 --- a/Mage.Sets/src/mage/cards/r/Ruination.java +++ b/Mage.Sets/src/mage/cards/r/Ruination.java @@ -33,9 +33,6 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.filter.common.FilterLandPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.filter.predicate.mageobject.SupertypePredicate; /** * @@ -43,18 +40,12 @@ import mage.filter.predicate.mageobject.SupertypePredicate; */ public class Ruination extends CardImpl { - private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic lands"); - static { - filter.add(new CardTypePredicate(CardType.LAND)); - filter.add(Predicates.not(new SupertypePredicate("Basic"))); - } - public Ruination(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{R}"); // Destroy all nonbasic lands. - this.getSpellAbility().addEffect(new DestroyAllEffect(filter)); + this.getSpellAbility().addEffect(new DestroyAllEffect(FilterLandPermanent.nonbasicLands())); } public Ruination(final Ruination card) { diff --git a/Mage.Sets/src/mage/cards/s/SkyshroudElite.java b/Mage.Sets/src/mage/cards/s/SkyshroudElite.java index 105a51e5e8..59179267e7 100644 --- a/Mage.Sets/src/mage/cards/s/SkyshroudElite.java +++ b/Mage.Sets/src/mage/cards/s/SkyshroudElite.java @@ -39,8 +39,6 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; import mage.filter.common.FilterLandPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.SupertypePredicate; /** * @@ -48,12 +46,6 @@ import mage.filter.predicate.mageobject.SupertypePredicate; */ public class SkyshroudElite extends CardImpl { - private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic land"); - - static { - filter.add(Predicates.not(new SupertypePredicate("Basic"))); - } - public SkyshroudElite(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}"); this.subtype.add("Elf"); @@ -63,7 +55,7 @@ public class SkyshroudElite extends CardImpl { // Skyshroud Elite gets +1/+2 as long as an opponent controls a nonbasic land. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( new BoostSourceEffect(1, 2, Duration.WhileOnBattlefield), - new OpponentControlsPermanentCondition(filter), + new OpponentControlsPermanentCondition(FilterLandPermanent.nonbasicLand()), "{this} gets +1/+2 as long as an opponent controls a nonbasic land"))); } diff --git a/Mage.Sets/src/mage/cards/t/TrailblazersBoots.java b/Mage.Sets/src/mage/cards/t/TrailblazersBoots.java index 3c11155460..43a25f8b6a 100644 --- a/Mage.Sets/src/mage/cards/t/TrailblazersBoots.java +++ b/Mage.Sets/src/mage/cards/t/TrailblazersBoots.java @@ -40,8 +40,6 @@ import mage.abilities.keyword.LandwalkAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.filter.common.FilterLandPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.SupertypePredicate; /** * @@ -54,7 +52,7 @@ public class TrailblazersBoots extends CardImpl { this.subtype.add("Equipment"); // Equipped creature has nonbasic landwalk. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(new NonbasicLandwalkAbility(), AttachmentType.EQUIPMENT))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(new LandwalkAbility(FilterLandPermanent.nonbasicLand()), AttachmentType.EQUIPMENT))); // Equip {2} this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2))); } @@ -68,25 +66,3 @@ public class TrailblazersBoots extends CardImpl { return new TrailblazersBoots(this); } } - -class NonbasicLandwalkAbility extends LandwalkAbility { - - private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic land"); - - static { - filter.add(Predicates.not(new SupertypePredicate("Basic"))); - } - - public NonbasicLandwalkAbility() { - super(filter); - } - - public NonbasicLandwalkAbility(final NonbasicLandwalkAbility ability) { - super(ability); - } - - @Override - public NonbasicLandwalkAbility copy() { - return new NonbasicLandwalkAbility(this); - } -} diff --git a/Mage/src/main/java/mage/filter/common/FilterLandPermanent.java b/Mage/src/main/java/mage/filter/common/FilterLandPermanent.java index 1fa06da6f1..3ce9089d11 100644 --- a/Mage/src/main/java/mage/filter/common/FilterLandPermanent.java +++ b/Mage/src/main/java/mage/filter/common/FilterLandPermanent.java @@ -30,8 +30,10 @@ package mage.filter.common; import mage.constants.CardType; import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.mageobject.SupertypePredicate; /** * @@ -53,6 +55,18 @@ public class FilterLandPermanent extends FilterPermanent { this.add(new CardTypePredicate(CardType.LAND)); this.add(new SubtypePredicate(subtype)); } + + public static FilterLandPermanent nonbasicLand() { + FilterLandPermanent filter = new FilterLandPermanent("nonbasic land"); + filter.add(Predicates.not(new SupertypePredicate("Basic"))); + return filter; + } + + public static FilterLandPermanent nonbasicLands() { + FilterLandPermanent filter = new FilterLandPermanent("nonbasic lands"); + filter.add(Predicates.not(new SupertypePredicate("Basic"))); + return filter; + } public FilterLandPermanent(final FilterLandPermanent filter) { super(filter);