add non-basic helpers to FilterLandPermanent

This commit is contained in:
Neil Gentleman 2016-07-17 14:27:14 -07:00
parent b919e5907b
commit 9a2d209cd8
10 changed files with 23 additions and 109 deletions

View file

@ -37,8 +37,6 @@ import mage.constants.Duration;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent; 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 { 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) { public BackToBasics(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}"); super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}");
// Nonbasic lands don't untap during their controllers' untap steps. // 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) { public BackToBasics(final BackToBasics card) {

View file

@ -35,8 +35,6 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.filter.common.FilterLandPermanent; 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 { 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) { public DestructiveFlow(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{B}{R}{G}"); super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{B}{R}{G}");
// At the beginning of each player's upkeep, that player sacrifices a nonbasic land. // 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)); TargetController.ANY, false));
} }

View file

@ -34,8 +34,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.common.FilterLandPermanent; 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); this.toughness = new MageInt(1);
// Nonbasic landwalk // Nonbasic landwalk
this.addAbility(new NonbasicLandwalkAbility()); this.addAbility(new LandwalkAbility(FilterLandPermanent.nonbasicLand()));
} }
public DryadSophisticate(final DryadSophisticate card) { public DryadSophisticate(final DryadSophisticate card) {
@ -63,25 +61,3 @@ public class DryadSophisticate extends CardImpl {
return new DryadSophisticate(this); 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);
}
}

View file

@ -40,9 +40,6 @@ import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterBasicLandCard; import mage.filter.common.FilterBasicLandCard;
import mage.filter.common.FilterLandPermanent; 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.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -74,11 +71,7 @@ public class FromTheAshes extends CardImpl {
class FromTheAshesEffect extends OneShotEffect { class FromTheAshesEffect extends OneShotEffect {
private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic lands"); private static final FilterLandPermanent filter = FilterLandPermanent.nonbasicLands();
static {
filter.add(new CardTypePredicate(CardType.LAND));
filter.add(Predicates.not(new SupertypePredicate("Basic")));
}
public FromTheAshesEffect() { public FromTheAshesEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);

View file

@ -35,8 +35,6 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.filter.common.FilterLandPermanent; import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
@ -66,11 +64,7 @@ public class PriceOfProgress extends CardImpl {
class PriceOfProgressEffect extends OneShotEffect { class PriceOfProgressEffect extends OneShotEffect {
private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic lands"); private static final FilterLandPermanent filter = FilterLandPermanent.nonbasicLands();
static {
filter.add(Predicates.not(new SupertypePredicate("Basic")));
}
public PriceOfProgressEffect() { public PriceOfProgressEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);

View file

@ -39,8 +39,6 @@ import mage.constants.Outcome;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent; import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
@ -69,11 +67,7 @@ public class PrimalOrder extends CardImpl {
class PrimalOrderDamageTargetEffect extends OneShotEffect{ class PrimalOrderDamageTargetEffect extends OneShotEffect{
private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic lands"); private static final FilterLandPermanent filter = FilterLandPermanent.nonbasicLands();
static {
filter.add(Predicates.not(new SupertypePredicate("Basic")));
}
public PrimalOrderDamageTargetEffect() public PrimalOrderDamageTargetEffect()
{ {

View file

@ -33,9 +33,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.common.FilterLandPermanent; 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 { 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) { public Ruination(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{R}"); super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{R}");
// Destroy all nonbasic lands. // Destroy all nonbasic lands.
this.getSpellAbility().addEffect(new DestroyAllEffect(filter)); this.getSpellAbility().addEffect(new DestroyAllEffect(FilterLandPermanent.nonbasicLands()));
} }
public Ruination(final Ruination card) { public Ruination(final Ruination card) {

View file

@ -39,8 +39,6 @@ import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent; 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 { 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) { public SkyshroudElite(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}"); super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}");
this.subtype.add("Elf"); 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. // Skyshroud Elite gets +1/+2 as long as an opponent controls a nonbasic land.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new BoostSourceEffect(1, 2, Duration.WhileOnBattlefield), 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"))); "{this} gets +1/+2 as long as an opponent controls a nonbasic land")));
} }

View file

@ -40,8 +40,6 @@ import mage.abilities.keyword.LandwalkAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.filter.common.FilterLandPermanent; 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"); this.subtype.add("Equipment");
// Equipped creature has nonbasic landwalk. // 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} // Equip {2}
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2))); this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2)));
} }
@ -68,25 +66,3 @@ public class TrailblazersBoots extends CardImpl {
return new TrailblazersBoots(this); 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);
}
}

View file

@ -30,8 +30,10 @@ package mage.filter.common;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
/** /**
* *
@ -54,6 +56,18 @@ public class FilterLandPermanent extends FilterPermanent {
this.add(new SubtypePredicate(subtype)); 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) { public FilterLandPermanent(final FilterLandPermanent filter) {
super(filter); super(filter);
} }