From 0d2053c6342ccf1c756cfa0a8a7b08b6a5acf068 Mon Sep 17 00:00:00 2001 From: North Date: Thu, 12 Jul 2012 20:09:34 +0300 Subject: [PATCH] [filters] Replaced abilities condition with Predicate --- .../mage/sets/apocalypse/BloodfireDwarf.java | 5 +-- .../sets/avacynrestored/EatenBySpiders.java | 3 +- .../sets/avacynrestored/FavorableWinds.java | 3 +- .../mage/sets/avacynrestored/Thunderbolt.java | 3 +- .../sets/championsofkamigawa/Earthshaker.java | 6 ++-- .../sets/championsofkamigawa/GaleForce.java | 3 +- .../RyuseiTheFallingStar.java | 5 +-- .../mage/sets/conflux/ScattershotArcher.java | 3 +- .../sets/darkascension/CrushingVines.java | 3 +- .../mage/sets/guildpact/TiborAndLumia.java | 5 +-- .../mage/sets/innistrad/DaybreakRanger.java | 3 +- .../mage/sets/innistrad/GeistcatchersRig.java | 3 +- .../mage/sets/innistrad/OneEyedScarecrow.java | 3 +- .../mage/sets/innistrad/RollingTemblor.java | 5 +-- .../mage/sets/innistrad/RunicRepetition.java | 5 ++- .../src/mage/sets/lorwyn/HurlyBurly.java | 7 +++-- .../src/mage/sets/magic2010/Earthquake.java | 5 +-- .../src/mage/sets/magic2010/Windstorm.java | 3 +- .../src/mage/sets/magic2011/AirServant.java | 3 +- .../src/mage/sets/magic2011/Plummet.java | 3 +- .../sets/magic2012/StingerflingSpider.java | 3 +- .../sets/magic2013/ThundermawHellkite.java | 3 +- .../mage/sets/mirrodin/KrarkClanShaman.java | 5 +-- .../sets/mirrodinbesieged/PistusStrike.java | 7 +++-- .../sets/morningtide/LysAlanaBowmaster.java | 3 +- .../mage/sets/newphyrexia/CorrosiveGale.java | 3 +- .../mage/sets/onslaught/SilklashSpider.java | 3 +- .../mage/sets/ravnika/ElvishSkysweeper.java | 3 +- .../riseoftheeldrazi/GravitationalShift.java | 17 +++++----- .../riseoftheeldrazi/GrotagSiegeRunner.java | 3 +- .../mage/sets/riseoftheeldrazi/LeafArrow.java | 3 +- .../riseoftheeldrazi/OvergrownBattlement.java | 3 +- .../StalwartShieldBearers.java | 3 +- .../sets/riseoftheeldrazi/VentSentinel.java | 3 +- .../mage/sets/scarsofmirrodin/CorpseCur.java | 5 ++- .../scarsofmirrodin/HandOfThePraetors.java | 6 ++-- .../sets/scarsofmirrodin/WingPuncture.java | 3 +- .../src/mage/sets/tempest/NeedleStorm.java | 3 +- .../src/mage/sets/tenth/FemerefArchers.java | 3 +- Mage.Sets/src/mage/sets/tenth/Quicksand.java | 5 +-- .../sets/zendikar/MerfolkSeastalkers.java | 5 +-- .../mage/sets/zendikar/OranRiefRecluse.java | 3 +- .../mage/sets/zendikar/SeismicShudder.java | 5 +-- .../src/mage/sets/zendikar/TajuruArcher.java | 3 +- Mage/src/mage/filter/FilterObject.java | 31 ------------------- .../common/FilterCreatureForAttack.java | 5 +-- 46 files changed, 113 insertions(+), 105 deletions(-) diff --git a/Mage.Sets/src/mage/sets/apocalypse/BloodfireDwarf.java b/Mage.Sets/src/mage/sets/apocalypse/BloodfireDwarf.java index 5b1e30f1c9..3499f6b26a 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/BloodfireDwarf.java +++ b/Mage.Sets/src/mage/sets/apocalypse/BloodfireDwarf.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/EatenBySpiders.java b/Mage.Sets/src/mage/sets/avacynrestored/EatenBySpiders.java index 4de169fdb8..e3080f6dbb 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/EatenBySpiders.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/EatenBySpiders.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/FavorableWinds.java b/Mage.Sets/src/mage/sets/avacynrestored/FavorableWinds.java index 00eccdecf1..01d7dd3c03 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/FavorableWinds.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/FavorableWinds.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/Thunderbolt.java b/Mage.Sets/src/mage/sets/avacynrestored/Thunderbolt.java index 1683b033de..01f6e219e3 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/Thunderbolt.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/Thunderbolt.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/Earthshaker.java b/Mage.Sets/src/mage/sets/championsofkamigawa/Earthshaker.java index 5b07393c75..3be850c322 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/Earthshaker.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/Earthshaker.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/GaleForce.java b/Mage.Sets/src/mage/sets/championsofkamigawa/GaleForce.java index c9b3e757cf..50f8970b09 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/GaleForce.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/GaleForce.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/RyuseiTheFallingStar.java b/Mage.Sets/src/mage/sets/championsofkamigawa/RyuseiTheFallingStar.java index d45bfb696f..2e710791ed 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/RyuseiTheFallingStar.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/RyuseiTheFallingStar.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/conflux/ScattershotArcher.java b/Mage.Sets/src/mage/sets/conflux/ScattershotArcher.java index 8d52eea83b..a9c4089fdb 100644 --- a/Mage.Sets/src/mage/sets/conflux/ScattershotArcher.java +++ b/Mage.Sets/src/mage/sets/conflux/ScattershotArcher.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/darkascension/CrushingVines.java b/Mage.Sets/src/mage/sets/darkascension/CrushingVines.java index 7c2a91159b..63b25dccc7 100644 --- a/Mage.Sets/src/mage/sets/darkascension/CrushingVines.java +++ b/Mage.Sets/src/mage/sets/darkascension/CrushingVines.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/guildpact/TiborAndLumia.java b/Mage.Sets/src/mage/sets/guildpact/TiborAndLumia.java index 2942d7d979..8c55596652 100644 --- a/Mage.Sets/src/mage/sets/guildpact/TiborAndLumia.java +++ b/Mage.Sets/src/mage/sets/guildpact/TiborAndLumia.java @@ -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 { 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); } diff --git a/Mage.Sets/src/mage/sets/innistrad/DaybreakRanger.java b/Mage.Sets/src/mage/sets/innistrad/DaybreakRanger.java index a02761e6a5..554a9a77b6 100644 --- a/Mage.Sets/src/mage/sets/innistrad/DaybreakRanger.java +++ b/Mage.Sets/src/mage/sets/innistrad/DaybreakRanger.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/innistrad/GeistcatchersRig.java b/Mage.Sets/src/mage/sets/innistrad/GeistcatchersRig.java index 2d69001af3..ca0dad1491 100644 --- a/Mage.Sets/src/mage/sets/innistrad/GeistcatchersRig.java +++ b/Mage.Sets/src/mage/sets/innistrad/GeistcatchersRig.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/innistrad/OneEyedScarecrow.java b/Mage.Sets/src/mage/sets/innistrad/OneEyedScarecrow.java index 7ba2d837df..463118414d 100644 --- a/Mage.Sets/src/mage/sets/innistrad/OneEyedScarecrow.java +++ b/Mage.Sets/src/mage/sets/innistrad/OneEyedScarecrow.java @@ -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 { 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); } diff --git a/Mage.Sets/src/mage/sets/innistrad/RollingTemblor.java b/Mage.Sets/src/mage/sets/innistrad/RollingTemblor.java index fd0a771a35..ffbff5762c 100644 --- a/Mage.Sets/src/mage/sets/innistrad/RollingTemblor.java +++ b/Mage.Sets/src/mage/sets/innistrad/RollingTemblor.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/innistrad/RunicRepetition.java b/Mage.Sets/src/mage/sets/innistrad/RunicRepetition.java index 7a59630fb5..e9cd8f2491 100644 --- a/Mage.Sets/src/mage/sets/innistrad/RunicRepetition.java +++ b/Mage.Sets/src/mage/sets/innistrad/RunicRepetition.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/lorwyn/HurlyBurly.java b/Mage.Sets/src/mage/sets/lorwyn/HurlyBurly.java index f19875f8f2..89d93cc61a 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/HurlyBurly.java +++ b/Mage.Sets/src/mage/sets/lorwyn/HurlyBurly.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/magic2010/Earthquake.java b/Mage.Sets/src/mage/sets/magic2010/Earthquake.java index fb82a3233e..8718f19006 100644 --- a/Mage.Sets/src/mage/sets/magic2010/Earthquake.java +++ b/Mage.Sets/src/mage/sets/magic2010/Earthquake.java @@ -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 { 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() { diff --git a/Mage.Sets/src/mage/sets/magic2010/Windstorm.java b/Mage.Sets/src/mage/sets/magic2010/Windstorm.java index 23c1cb4f61..6665af7064 100644 --- a/Mage.Sets/src/mage/sets/magic2010/Windstorm.java +++ b/Mage.Sets/src/mage/sets/magic2010/Windstorm.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/magic2011/AirServant.java b/Mage.Sets/src/mage/sets/magic2011/AirServant.java index 8fcf1fcc2d..9ab5e6caa1 100644 --- a/Mage.Sets/src/mage/sets/magic2011/AirServant.java +++ b/Mage.Sets/src/mage/sets/magic2011/AirServant.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/magic2011/Plummet.java b/Mage.Sets/src/mage/sets/magic2011/Plummet.java index 6cfaa70d4d..e2a99a8e4a 100644 --- a/Mage.Sets/src/mage/sets/magic2011/Plummet.java +++ b/Mage.Sets/src/mage/sets/magic2011/Plummet.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/magic2012/StingerflingSpider.java b/Mage.Sets/src/mage/sets/magic2012/StingerflingSpider.java index fa68340a7c..e3303fbad5 100644 --- a/Mage.Sets/src/mage/sets/magic2012/StingerflingSpider.java +++ b/Mage.Sets/src/mage/sets/magic2012/StingerflingSpider.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/magic2013/ThundermawHellkite.java b/Mage.Sets/src/mage/sets/magic2013/ThundermawHellkite.java index 244431f335..0077b9be78 100644 --- a/Mage.Sets/src/mage/sets/magic2013/ThundermawHellkite.java +++ b/Mage.Sets/src/mage/sets/magic2013/ThundermawHellkite.java @@ -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 { 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); } diff --git a/Mage.Sets/src/mage/sets/mirrodin/KrarkClanShaman.java b/Mage.Sets/src/mage/sets/mirrodin/KrarkClanShaman.java index e1fd6f67d6..8db4b02976 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/KrarkClanShaman.java +++ b/Mage.Sets/src/mage/sets/mirrodin/KrarkClanShaman.java @@ -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 { 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))); } diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/PistusStrike.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/PistusStrike.java index def7eaa174..b4b4dbb8cf 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/PistusStrike.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/PistusStrike.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/morningtide/LysAlanaBowmaster.java b/Mage.Sets/src/mage/sets/morningtide/LysAlanaBowmaster.java index b066360250..f5878cdfd0 100644 --- a/Mage.Sets/src/mage/sets/morningtide/LysAlanaBowmaster.java +++ b/Mage.Sets/src/mage/sets/morningtide/LysAlanaBowmaster.java @@ -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 { static { filterElf.add(new SubtypePredicate("Elf")); - filterFlying.getAbilities().add(FlyingAbility.getInstance()); + filterFlying.add(new AbilityPredicate(FlyingAbility.class)); } public LysAlanaBowmaster(UUID ownerId) { diff --git a/Mage.Sets/src/mage/sets/newphyrexia/CorrosiveGale.java b/Mage.Sets/src/mage/sets/newphyrexia/CorrosiveGale.java index 06361ded6b..cdfd8f2662 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/CorrosiveGale.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/CorrosiveGale.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/onslaught/SilklashSpider.java b/Mage.Sets/src/mage/sets/onslaught/SilklashSpider.java index 2b5393b0d4..516ae41f9e 100644 --- a/Mage.Sets/src/mage/sets/onslaught/SilklashSpider.java +++ b/Mage.Sets/src/mage/sets/onslaught/SilklashSpider.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/ravnika/ElvishSkysweeper.java b/Mage.Sets/src/mage/sets/ravnika/ElvishSkysweeper.java index d8547a9c91..47eb415f58 100644 --- a/Mage.Sets/src/mage/sets/ravnika/ElvishSkysweeper.java +++ b/Mage.Sets/src/mage/sets/ravnika/ElvishSkysweeper.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/GravitationalShift.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/GravitationalShift.java index 0eb3def153..7e4fb573b3 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/GravitationalShift.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/GravitationalShift.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/GrotagSiegeRunner.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/GrotagSiegeRunner.java index 9d313a31b7..aac7398004 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/GrotagSiegeRunner.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/GrotagSiegeRunner.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/LeafArrow.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/LeafArrow.java index e75b0b13eb..19da629bf7 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/LeafArrow.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/LeafArrow.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/OvergrownBattlement.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/OvergrownBattlement.java index 06ded54003..e99ed3a882 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/OvergrownBattlement.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/OvergrownBattlement.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/StalwartShieldBearers.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/StalwartShieldBearers.java index 4f0e9fbd5e..c7d3017cd0 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/StalwartShieldBearers.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/StalwartShieldBearers.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/VentSentinel.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/VentSentinel.java index eda1254c9e..d53efdde66 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/VentSentinel.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/VentSentinel.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/CorpseCur.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/CorpseCur.java index 66f624caa6..030a6fe254 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/CorpseCur.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/CorpseCur.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/HandOfThePraetors.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/HandOfThePraetors.java index f6150ded30..f4e0cf7cb7 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/HandOfThePraetors.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/HandOfThePraetors.java @@ -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 { 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); } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/WingPuncture.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/WingPuncture.java index bdc8a3eb46..9d980bee82 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/WingPuncture.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/WingPuncture.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/tempest/NeedleStorm.java b/Mage.Sets/src/mage/sets/tempest/NeedleStorm.java index 098da068d8..10e66f6e97 100644 --- a/Mage.Sets/src/mage/sets/tempest/NeedleStorm.java +++ b/Mage.Sets/src/mage/sets/tempest/NeedleStorm.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/tenth/FemerefArchers.java b/Mage.Sets/src/mage/sets/tenth/FemerefArchers.java index 862f22f95a..112da6f55e 100644 --- a/Mage.Sets/src/mage/sets/tenth/FemerefArchers.java +++ b/Mage.Sets/src/mage/sets/tenth/FemerefArchers.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/tenth/Quicksand.java b/Mage.Sets/src/mage/sets/tenth/Quicksand.java index fbed96831d..c498403e8d 100644 --- a/Mage.Sets/src/mage/sets/tenth/Quicksand.java +++ b/Mage.Sets/src/mage/sets/tenth/Quicksand.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/zendikar/MerfolkSeastalkers.java b/Mage.Sets/src/mage/sets/zendikar/MerfolkSeastalkers.java index 4714ac6482..491a118227 100644 --- a/Mage.Sets/src/mage/sets/zendikar/MerfolkSeastalkers.java +++ b/Mage.Sets/src/mage/sets/zendikar/MerfolkSeastalkers.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/zendikar/OranRiefRecluse.java b/Mage.Sets/src/mage/sets/zendikar/OranRiefRecluse.java index e17185dca1..7a05e7bf40 100644 --- a/Mage.Sets/src/mage/sets/zendikar/OranRiefRecluse.java +++ b/Mage.Sets/src/mage/sets/zendikar/OranRiefRecluse.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/zendikar/SeismicShudder.java b/Mage.Sets/src/mage/sets/zendikar/SeismicShudder.java index 14e0f7f655..a48a306705 100644 --- a/Mage.Sets/src/mage/sets/zendikar/SeismicShudder.java +++ b/Mage.Sets/src/mage/sets/zendikar/SeismicShudder.java @@ -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 { 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) { diff --git a/Mage.Sets/src/mage/sets/zendikar/TajuruArcher.java b/Mage.Sets/src/mage/sets/zendikar/TajuruArcher.java index 7a79aa3dad..c49b55379f 100644 --- a/Mage.Sets/src/mage/sets/zendikar/TajuruArcher.java +++ b/Mage.Sets/src/mage/sets/zendikar/TajuruArcher.java @@ -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 { 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) { diff --git a/Mage/src/mage/filter/FilterObject.java b/Mage/src/mage/filter/FilterObject.java index a3f9b6b9a0..ca09a278d1 100644 --- a/Mage/src/mage/filter/FilterObject.java +++ b/Mage/src/mage/filter/FilterObject.java @@ -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> extends FilterImpl implements Filter { - protected Abilities abilities; - protected boolean notAbilities; protected List cardType = new ArrayList(); protected ComparisonScope scopeCardType = ComparisonScope.Any; protected List notCardType = new ArrayList(); @@ -71,14 +65,11 @@ public class FilterObject> ex public FilterObject(String name) { super(name); - abilities = new AbilitiesImpl(); 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> ex return notFilter; } - if (abilities.size() > 0) { - List test = new ArrayList(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 getCardType() { return this.cardType; } diff --git a/Mage/src/mage/filter/common/FilterCreatureForAttack.java b/Mage/src/mage/filter/common/FilterCreatureForAttack.java index 235b634d55..3b68b81353 100644 --- a/Mage/src/mage/filter/common/FilterCreatureForAttack.java +++ b/Mage/src/mage/filter/common/FilterCreatureForAttack.java @@ -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