[filters] Replaced abilities condition with Predicate

This commit is contained in:
North 2012-07-12 20:09:34 +03:00
parent c59087e827
commit 0d2053c634
46 changed files with 113 additions and 105 deletions

View file

@ -42,6 +42,8 @@ import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
* @author Loki
@ -51,8 +53,7 @@ public class BloodfireDwarf extends CardImpl<BloodfireDwarf> {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature without flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.setNotAbilities(true);
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
}
public BloodfireDwarf(UUID ownerId) {

View file

@ -37,6 +37,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
@ -50,7 +51,7 @@ public class EatenBySpiders extends CardImpl<EatenBySpiders> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public EatenBySpiders(UUID ownerId) {

View file

@ -35,6 +35,7 @@ import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import java.util.UUID;
@ -47,7 +48,7 @@ public class FavorableWinds extends CardImpl<FavorableWinds> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public FavorableWinds(UUID ownerId) {

View file

@ -35,6 +35,7 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
@ -47,7 +48,7 @@ public class Thunderbolt extends CardImpl<Thunderbolt> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public Thunderbolt(UUID ownerId) {

View file

@ -33,7 +33,6 @@ import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.DamageAllEffect;
@ -41,6 +40,8 @@ import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterSpiritOrArcaneCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
* @author Loki
@ -51,8 +52,7 @@ public class Earthshaker extends CardImpl<Earthshaker> {
private final static FilterCreaturePermanent creatureFilter = new FilterCreaturePermanent("creature without flying");
static {
creatureFilter.getAbilities().add((Ability) FlyingAbility.getInstance());
creatureFilter.setNotAbilities(true);
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
}
public Earthshaker(UUID ownerId) {

View file

@ -36,6 +36,7 @@ import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
* @author Loki
@ -45,7 +46,7 @@ public class GaleForce extends CardImpl<GaleForce> {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public GaleForce(UUID ownerId) {

View file

@ -35,6 +35,8 @@ import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import java.util.UUID;
@ -46,8 +48,7 @@ public class RyuseiTheFallingStar extends CardImpl<RyuseiTheFallingStar> {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature without flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.setNotAbilities(true);
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
}
public RyuseiTheFallingStar(UUID ownerID) {

View file

@ -38,6 +38,7 @@ import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
@ -48,7 +49,7 @@ public class ScattershotArcher extends CardImpl<ScattershotArcher> {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public ScattershotArcher(UUID ownerId) {

View file

@ -35,6 +35,7 @@ import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetArtifactPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -47,7 +48,7 @@ public class CrushingVines extends CardImpl<CrushingVines> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public CrushingVines(UUID ownerId) {

View file

@ -40,6 +40,8 @@ import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.FilterSpell;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -55,8 +57,7 @@ public class TiborAndLumia extends CardImpl<TiborAndLumia> {
static {
filterBlue.setUseColor(true);
filterBlue.getColor().setBlue(true);
filter.getAbilities().add(FlyingAbility.getInstance());
filter.setNotAbilities(true);
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
filterRed.setUseColor(true);
filterRed.getColor().setRed(true);
}

View file

@ -46,6 +46,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -57,7 +58,7 @@ public class DaybreakRanger extends CardImpl<DaybreakRanger> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public DaybreakRanger(UUID ownerId) {

View file

@ -37,6 +37,7 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -48,7 +49,7 @@ public class GeistcatchersRig extends CardImpl<GeistcatchersRig> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public GeistcatchersRig(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.keyword.DefenderAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
@ -50,7 +51,7 @@ public class OneEyedScarecrow extends CardImpl<OneEyedScarecrow> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures with flying your opponents control");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
filter.setTargetController(TargetController.OPPONENT);
}

View file

@ -37,6 +37,8 @@ import mage.abilities.keyword.FlashbackAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
@ -47,8 +49,7 @@ public class RollingTemblor extends CardImpl<RollingTemblor> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature without flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.setNotAbilities(true);
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
}
public RollingTemblor(UUID ownerId) {

View file

@ -31,12 +31,11 @@ import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.TargetController;
import mage.Constants.TimingRule;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.CardImpl;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCardInExile;
/**
@ -49,7 +48,7 @@ public class RunicRepetition extends CardImpl<RunicRepetition> {
static {
filter.setTargetOwner(TargetController.YOU);
filter.getAbilities().add(new FlashbackAbility(new ManaCostsImpl("{0}"), TimingRule.INSTANT));
filter.add(new AbilityPredicate(FlashbackAbility.class));
}
public RunicRepetition(UUID ownerId) {

View file

@ -34,6 +34,8 @@ import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import java.util.UUID;
@ -47,9 +49,8 @@ public class HurlyBurly extends CardImpl<HurlyBurly> {
private final static FilterCreaturePermanent filterWithFlying = new FilterCreaturePermanent("creature with flying");
static {
filterWithoutFlying.getAbilities().add(FlyingAbility.getInstance());
filterWithoutFlying.setNotAbilities(true);
filterWithFlying.getAbilities().add(FlyingAbility.getInstance());
filterWithoutFlying.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
filterWithFlying.add(new AbilityPredicate(FlyingAbility.class));
}
public HurlyBurly(UUID ownerId) {

View file

@ -37,6 +37,8 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -69,8 +71,7 @@ class EarthquakeEffect extends OneShotEffect<EarthquakeEffect> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.setNotAbilities(true);
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
}
public EarthquakeEffect() {

View file

@ -35,6 +35,7 @@ import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
@ -45,7 +46,7 @@ public class Windstorm extends CardImpl<Windstorm> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public Windstorm(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -51,7 +52,7 @@ public class AirServant extends CardImpl<AirServant> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public AirServant(UUID ownerId) {

View file

@ -36,6 +36,7 @@ import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -47,7 +48,7 @@ public class Plummet extends CardImpl<Plummet> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public Plummet(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.ReachAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -50,7 +51,7 @@ public class StingerflingSpider extends CardImpl<StingerflingSpider> {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public StingerflingSpider(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -52,7 +53,7 @@ public class ThundermawHellkite extends CardImpl<ThundermawHellkite> {
final static FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures with flying your opponents control");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
filter.setTargetController(Constants.TargetController.OPPONENT);
}

View file

@ -41,6 +41,8 @@ import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetControlledPermanent;
/**
@ -54,8 +56,7 @@ public class KrarkClanShaman extends CardImpl<KrarkClanShaman> {
static {
filterSacrificed.getCardType().add(CardType.ARTIFACT);
filterSacrificed.setScopeCardType(Filter.ComparisonScope.Any);
filterTargetedCreatures.getAbilities().add(FlyingAbility.getInstance());
filterTargetedCreatures.setNotAbilities(true);
filterTargetedCreatures.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
}

View file

@ -33,13 +33,14 @@ import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -54,7 +55,7 @@ public class PistusStrike extends CardImpl<PistusStrike> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public PistusStrike(UUID ownerId) {

View file

@ -39,6 +39,7 @@ import mage.abilities.keyword.ReachAbility;
import mage.cards.CardImpl;
import mage.filter.FilterSpell;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetCreaturePermanent;
@ -53,7 +54,7 @@ public class LysAlanaBowmaster extends CardImpl<LysAlanaBowmaster> {
static {
filterElf.add(new SubtypePredicate("Elf"));
filterFlying.getAbilities().add(FlyingAbility.getInstance());
filterFlying.add(new AbilityPredicate(FlyingAbility.class));
}
public LysAlanaBowmaster(UUID ownerId) {

View file

@ -35,6 +35,7 @@ import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
@ -45,7 +46,7 @@ public class CorrosiveGale extends CardImpl<CorrosiveGale> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public CorrosiveGale(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.ReachAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
@ -50,7 +51,7 @@ public class SilklashSpider extends CardImpl<SilklashSpider> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public SilklashSpider(UUID ownerId) {

View file

@ -41,6 +41,7 @@ import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
@ -53,7 +54,7 @@ public class ElvishSkysweeper extends CardImpl<ElvishSkysweeper> {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public ElvishSkysweeper(UUID ownerId) {

View file

@ -29,14 +29,16 @@ package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continious.BoostAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.abilities.keyword.FlyingAbility;
import mage.Constants.Duration;
import mage.abilities.effects.common.continious.BoostAllEffect;
import mage.abilities.common.SimpleStaticAbility;
import mage.Constants.Zone;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
@ -48,9 +50,8 @@ public class GravitationalShift extends CardImpl<GravitationalShift> {
private final static FilterCreaturePermanent filter2 = new FilterCreaturePermanent("Creatures without flying");
static {
filter1.getAbilities().add(FlyingAbility.getInstance());
filter2.getAbilities().add(FlyingAbility.getInstance());
filter2.setNotAbilities(true);
filter1.add(new AbilityPredicate(FlyingAbility.class));
filter2.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
}
public GravitationalShift(UUID ownerId) {

View file

@ -42,6 +42,7 @@ import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.DefenderAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -56,7 +57,7 @@ public class GrotagSiegeRunner extends CardImpl<GrotagSiegeRunner> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with defender");
static {
filter.getAbilities().add(DefenderAbility.getInstance());
filter.add(new AbilityPredicate(DefenderAbility.class));
}
public GrotagSiegeRunner(UUID ownerId) {

View file

@ -34,6 +34,7 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -45,7 +46,7 @@ public class LeafArrow extends CardImpl<LeafArrow> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public LeafArrow(UUID ownerId) {

View file

@ -37,6 +37,7 @@ import mage.abilities.keyword.DefenderAbility;
import mage.abilities.mana.DynamicManaAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
@ -47,7 +48,7 @@ public class OvergrownBattlement extends CardImpl<OvergrownBattlement> {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature with defender you control");
static {
filter.getAbilities().add(DefenderAbility.getInstance());
filter.add(new AbilityPredicate(DefenderAbility.class));
}
public OvergrownBattlement(UUID ownerId) {

View file

@ -38,6 +38,7 @@ import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.keyword.DefenderAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
@ -48,7 +49,7 @@ public class StalwartShieldBearers extends CardImpl<StalwartShieldBearers> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with defender");
static {
filter.getAbilities().add(DefenderAbility.getInstance());
filter.add(new AbilityPredicate(DefenderAbility.class));
}
public StalwartShieldBearers(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.DefenderAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.TargetPlayer;
/**
@ -49,7 +50,7 @@ import mage.target.TargetPlayer;
public class VentSentinel extends CardImpl<VentSentinel> {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creatures with defender you control");
static{
filter.getAbilities().add(DefenderAbility.getInstance());
filter.add(new AbilityPredicate(DefenderAbility.class));
}
public VentSentinel(UUID ownerId) {

View file

@ -38,6 +38,7 @@ import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.keyword.InfectAbility;
import mage.cards.CardImpl;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCardInYourGraveyard;
/**
@ -49,9 +50,7 @@ public class CorpseCur extends CardImpl<CorpseCur> {
private static final FilterCard filter = new FilterCard("creature card with infect from your graveyard");
static {
filter.getAbilities().add(InfectAbility.getInstance());
filter.setNotAbilities(false);
filter.add(new AbilityPredicate(InfectAbility.class));
}
public CorpseCur (UUID ownerId) {

View file

@ -45,6 +45,7 @@ import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.common.SpellCastTriggeredAbility;
import mage.filter.Filter;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
@ -56,9 +57,8 @@ public class HandOfThePraetors extends CardImpl<HandOfThePraetors> {
private static final FilterSpell filterSpell = new FilterSpell("a creature spell with infect");
static {
filter.getAbilities().add(InfectAbility.getInstance());
filter.setNotAbilities(false);
filterSpell.getAbilities().add(InfectAbility.getInstance());
filter.add(new AbilityPredicate(InfectAbility.class));
filterSpell.add(new AbilityPredicate(InfectAbility.class));
filterSpell.getCardType().add(CardType.CREATURE);
filterSpell.setScopeCardType(Filter.ComparisonScope.Any);
}

View file

@ -36,6 +36,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
@ -50,7 +51,7 @@ public class WingPuncture extends CardImpl<WingPuncture> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public WingPuncture(UUID ownerId) {

View file

@ -35,6 +35,7 @@ import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
* @author Loki
@ -44,7 +45,7 @@ public class NeedleStorm extends CardImpl<NeedleStorm> {
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public NeedleStorm(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterAttackingCreature;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -51,7 +52,7 @@ public class FemerefArchers extends CardImpl<FemerefArchers> {
private final static FilterAttackingCreature filter = new FilterAttackingCreature("attacking creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public FemerefArchers(UUID ownerId) {

View file

@ -40,6 +40,8 @@ import mage.abilities.keyword.FlyingAbility;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterAttackingCreature;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -51,8 +53,7 @@ public class Quicksand extends CardImpl<Quicksand> {
private static final FilterAttackingCreature filter = new FilterAttackingCreature("attacking creature without flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.setNotAbilities(true);
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
}
public Quicksand(UUID ownerId) {

View file

@ -39,6 +39,8 @@ import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.IslandwalkAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -50,8 +52,7 @@ public class MerfolkSeastalkers extends CardImpl<MerfolkSeastalkers> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature without flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.setNotAbilities(true);
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
}
public MerfolkSeastalkers(UUID ownerId) {

View file

@ -42,6 +42,7 @@ import mage.abilities.keyword.KickerAbility;
import mage.abilities.keyword.ReachAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -53,7 +54,7 @@ public class OranRiefRecluse extends CardImpl<OranRiefRecluse> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public OranRiefRecluse(UUID ownerId) {

View file

@ -34,6 +34,8 @@ import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
@ -44,8 +46,7 @@ public class SeismicShudder extends CardImpl<SeismicShudder> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature without flying");
static {
filter.getAbilities().add(FlyingAbility.getInstance());
filter.setNotAbilities(true);
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
}
public SeismicShudder(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetCreaturePermanent;
@ -55,7 +56,7 @@ public class TajuruArcher extends CardImpl<TajuruArcher> {
static {
filter.add(new SubtypePredicate("Ally"));
filter.setTargetController(Constants.TargetController.YOU);
filterTarget.getAbilities().add(FlyingAbility.getInstance());
filterTarget.add(new AbilityPredicate(FlyingAbility.class));
}
public TajuruArcher(UUID ownerId) {

View file

@ -31,10 +31,6 @@ package mage.filter;
import mage.Constants.CardType;
import mage.MageObject;
import mage.ObjectColor;
import mage.abilities.Abilities;
import mage.abilities.AbilitiesImpl;
import mage.abilities.Ability;
import mage.abilities.keyword.ChangelingAbility;
import mage.game.Game;
import java.util.ArrayList;
@ -46,8 +42,6 @@ import java.util.List;
* @author North
*/
public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> extends FilterImpl<E, T> implements Filter<E> {
protected Abilities<Ability> abilities;
protected boolean notAbilities;
protected List<CardType> cardType = new ArrayList<CardType>();
protected ComparisonScope scopeCardType = ComparisonScope.Any;
protected List<CardType> notCardType = new ArrayList<CardType>();
@ -71,14 +65,11 @@ public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> ex
public FilterObject(String name) {
super(name);
abilities = new AbilitiesImpl<Ability>();
color = new ObjectColor();
}
public FilterObject(FilterObject filter) {
super(filter);
this.abilities = filter.abilities.copy();
this.notAbilities = filter.notAbilities;
this.cardType.addAll(filter.cardType);
this.notCardType.addAll(filter.notCardType);
this.scopeCardType = filter.scopeCardType;
@ -129,31 +120,9 @@ public class FilterObject<E extends MageObject, T extends FilterObject<E, T>> ex
return notFilter;
}
if (abilities.size() > 0) {
List<Ability> test = new ArrayList<Ability>(abilities);
for (Ability ability: object.getAbilities()) {
for (Ability abilityTest: test) {
if (ability == abilityTest || ability.getClass().equals(abilityTest.getClass())) {
test.remove(abilityTest);
break;
}
}
}
if (test.isEmpty() == notAbilities)
return notFilter;
}
return !notFilter;
}
public Abilities getAbilities() {
return this.abilities;
}
public void setNotAbilities(boolean notAbilities) {
this.notAbilities = notAbilities;
}
public List<CardType> getCardType() {
return this.cardType;
}

View file

@ -29,6 +29,8 @@
package mage.filter.common;
import mage.abilities.keyword.DefenderAbility;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -50,8 +52,7 @@ public class FilterCreatureForAttack extends FilterCreaturePermanent<FilterCreat
this.useBlocking = true;
this.tapped = false;
this.useTapped = true;
this.abilities.add(DefenderAbility.getInstance());
this.notAbilities = true;
this.add(Predicates.not(new AbilityPredicate(DefenderAbility.class)));
}
public FilterCreatureForAttack(final FilterCreatureForAttack filter) {