[filters] Replaced Another condition with Predicate

This commit is contained in:
North 2012-07-15 17:18:33 +03:00
parent d66c172952
commit 021e2b59df
22 changed files with 100 additions and 49 deletions

View file

@ -37,6 +37,7 @@ import mage.abilities.effects.common.SacrificeEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import java.util.UUID;
@ -49,7 +50,7 @@ public class DemonicTaskmaster extends CardImpl<DemonicTaskmaster> {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a creature other than Demonic Taskmaster");
static {
filter.setAnother(true);
filter.add(new AnotherPredicate());
}
public DemonicTaskmaster(UUID ownerId) {

View file

@ -37,6 +37,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.UndyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
@ -46,10 +47,10 @@ import java.util.UUID;
*/
public class DemonlordOfAshmouth extends CardImpl<DemonlordOfAshmouth> {
private static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(" another creature");
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(" another creature");
static {
filter.setAnother(true);
filter.add(new AnotherPredicate());
}
public DemonlordOfAshmouth(UUID ownerId) {

View file

@ -39,6 +39,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -79,10 +80,10 @@ public class Fettergeist extends CardImpl<Fettergeist> {
class FettergeistUnlessPaysEffect extends OneShotEffect<FettergeistUnlessPaysEffect> {
private static FilterCreaturePermanent filter = new FilterCreaturePermanent();
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.setAnother(true);
filter.add(new AnotherPredicate());
}
public FettergeistUnlessPaysEffect() {

View file

@ -36,6 +36,7 @@ import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import java.util.UUID;
@ -46,10 +47,10 @@ import java.util.UUID;
*/
public class GoldnightRedeemer extends CardImpl<GoldnightRedeemer> {
private static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("other creature you control");
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("other creature you control");
static {
filter.setAnother(true);
filter.add(new AnotherPredicate());
}
public GoldnightRedeemer(UUID ownerId) {

View file

@ -36,6 +36,7 @@ import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetControlledCreaturePermanent;
@ -77,7 +78,7 @@ class HavengulSkaabAbility extends TriggeredAbilityImpl<HavengulSkaabAbility> {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature you control");
static {
filter.setAnother(true);
filter.add(new AnotherPredicate());
}
public HavengulSkaabAbility() {

View file

@ -40,6 +40,7 @@ import mage.abilities.effects.RestrictionEffect;
import mage.abilities.keyword.ShroudAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -68,7 +69,7 @@ public class HisokasGuard extends CardImpl<HisokasGuard> {
// {1}{U}, {T}: Target creature you control other than Hisoka's Guard has shroud for as long as Hisoka's Guard remains tapped. (It can't be the target of spells or abilities.)
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
filter.setAnother(true);
filter.add(new AnotherPredicate());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new HisokasGuardGainAbilityTargetEffect(), new ManaCostsImpl("{1}{U}"));
ability.addCost(new TapSourceCost());
Target target = new TargetControlledCreaturePermanent(1, 1, filter, true, true);

View file

@ -48,6 +48,7 @@ import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.watchers.common.CastFromHandWatcher;
/**
@ -57,7 +58,7 @@ public class MyojinOfCleansingFire extends CardImpl<MyojinOfCleansingFire> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("other creatures");
static {
filter.setAnother(true);
filter.add(new AnotherPredicate());
}
public MyojinOfCleansingFire(UUID ownerId) {

View file

@ -27,6 +27,7 @@
*/
package mage.sets.innistrad;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
@ -34,14 +35,13 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.Target;
import mage.target.TargetPermanent;
import java.util.UUID;
import mage.abilities.effects.common.ExileTargetForSourceEffect;
import mage.abilities.effects.common.ReturnFromExileForSourceEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.Target;
import mage.target.TargetPermanent;
/**
* @author nantuko
@ -50,7 +50,7 @@ public class FiendHunter extends CardImpl<FiendHunter> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.setAnother(true);
filter.add(new AnotherPredicate());
}
public FiendHunter(UUID ownerId) {

View file

@ -45,6 +45,7 @@ import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetControlledCreaturePermanent;
@ -59,7 +60,7 @@ public class GrimgrinCorpseBorn extends CardImpl<GrimgrinCorpseBorn> {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature");
static {
filter.setAnother(true);
filter.add(new AnotherPredicate());
}
public GrimgrinCorpseBorn(UUID ownerId) {

View file

@ -45,6 +45,7 @@ import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -58,7 +59,7 @@ public class MikaeusTheLunarch extends CardImpl<MikaeusTheLunarch> {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
static {
filter.setAnother(true);
filter.add(new AnotherPredicate());
}
public MikaeusTheLunarch(UUID ownerId) {

View file

@ -45,6 +45,7 @@ import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -57,7 +58,7 @@ public class OliviaVoldaren extends CardImpl<OliviaVoldaren> {
private static final FilterCreaturePermanent vampireFilter = new FilterCreaturePermanent("Vampire");
static {
filter.setAnother(true);
filter.add(new AnotherPredicate());
vampireFilter.add(new SubtypePredicate("Vampire"));
}

View file

@ -41,6 +41,7 @@ import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
@ -56,7 +57,7 @@ public class MadAuntie extends CardImpl<MadAuntie> {
static {
filter1.add(new SubtypePredicate("Goblin"));
filter1.setAnother(true);
filter1.add(new AnotherPredicate());
filter2.add(new SubtypePredicate("Goblin"));
}

View file

@ -42,6 +42,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -107,7 +108,7 @@ class XathridDemonEffect extends OneShotEffect<XathridDemonEffect> {
}
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature other than " + sourcePermanent.getName());
filter.setAnother(true);
filter.add(new AnotherPredicate());
Target target = new TargetControlledCreaturePermanent(1, 1, filter, true, true);
if (target.canChoose(source.getSourceId(), player.getId(), game)) {

View file

@ -41,6 +41,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.Target;
import mage.target.TargetPermanent;
@ -58,7 +59,7 @@ public class AegisAngel extends CardImpl<AegisAngel> {
this.toughness = new MageInt(5);
this.addAbility(FlyingAbility.getInstance());
FilterPermanent filter = new FilterPermanent("another target permanent");
filter.setAnother(true);
filter.add(new AnotherPredicate());
Ability ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Constants.Duration.WhileOnBattlefield), false);
Target target = new TargetPermanent(filter);
target.setRequired(true);

View file

@ -40,6 +40,7 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
@ -52,7 +53,7 @@ public class Cryptoplasm extends CardImpl<Cryptoplasm> {
final static FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.setAnother(true);
filter.add(new AnotherPredicate());
}
public Cryptoplasm(UUID ownerId) {

View file

@ -43,6 +43,7 @@ import mage.game.events.GameEvent;
import mage.game.permanent.token.Token;
import java.util.UUID;
import mage.filter.predicate.permanent.AnotherPredicate;
/**
*
@ -92,7 +93,7 @@ class ThopterAssemblyTriggeredAbility extends TriggeredAbilityImpl<ThopterAssemb
if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) {
FilterPermanent filter = new FilterPermanent();
filter.add(new SubtypePredicate("Thopter"));
filter.setAnother(true);
filter.add(new AnotherPredicate());
if (!game.getBattlefield().contains(filter, controllerId, 1, game)) {
return true;
}

View file

@ -39,6 +39,7 @@ import mage.abilities.effects.common.ExileTargetForSourceEffect;
import mage.abilities.effects.common.ReturnFromExileForSourceEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.Target;
import mage.target.TargetPermanent;
@ -48,10 +49,10 @@ import mage.target.TargetPermanent;
*/
public class OblivionRing extends CardImpl<OblivionRing> {
private static FilterNonlandPermanent anotherNonlandPermanent = new FilterNonlandPermanent("another nonland permanent");
private static final FilterNonlandPermanent anotherNonlandPermanent = new FilterNonlandPermanent("another nonland permanent");
static {
anotherNonlandPermanent.setAnother(true);
anotherNonlandPermanent.add(new AnotherPredicate());
}
public OblivionRing(UUID ownerId) {

View file

@ -42,6 +42,7 @@ import mage.abilities.effects.common.MayTapOrUntapTargetEffect;
import mage.abilities.effects.common.UntapSourceEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -50,11 +51,10 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class TideforceElemental extends CardImpl<TideforceElemental> {
// private final static String text = "You may tap or untap another target creature";
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature");
static {
filter.setAnother(true);
filter.add(new AnotherPredicate());
}
public TideforceElemental(UUID ownerId) {

View file

@ -39,6 +39,7 @@ import mage.abilities.effects.common.ExileTargetForSourceEffect;
import mage.abilities.effects.common.ReturnFromExileForSourceEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.Target;
import mage.target.TargetPermanent;
@ -53,7 +54,7 @@ public class JourneyToNowhere extends CardImpl<JourneyToNowhere> {
this.expansionSetCode = "ZEN";
this.color.setWhite(true);
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.setAnother(true);
filter.add(new AnotherPredicate());
Ability ability1 = new EntersBattlefieldTriggeredAbility(new ExileTargetForSourceEffect("Journey to Nowhere exile"), false);
Target target = new TargetPermanent(filter);
target.setRequired(true);