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.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) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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