[filters] Replaced TargetController condition with Predicate

This commit is contained in:
North 2012-07-16 20:55:58 +03:00
parent 021e2b59df
commit 4563e518a6
76 changed files with 235 additions and 191 deletions

View file

@ -46,6 +46,7 @@ import mage.choices.ChoiceImpl;
import mage.filter.common.FilterAttackingCreature;
import mage.filter.common.FilterBlockingCreature;
import mage.filter.common.FilterCreatureForCombat;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.draft.Draft;
import mage.game.match.Match;
@ -80,7 +81,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
private static Map<String, Serializable> staticOptions = new HashMap<String, Serializable>();
static {
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
replacementEffectChoice.setMessage("Choose replacement effect");
staticOptions.put("UI.right.btn.text", "Done");
}

View file

@ -34,6 +34,7 @@ import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.TargetPlayer;
import java.util.UUID;
@ -48,7 +49,7 @@ public class Dreadwaters extends CardImpl<Dreadwaters> {
private static final FilterLandPermanent filter = new FilterLandPermanent("lands you control");
static {
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public Dreadwaters(UUID ownerId) {

View file

@ -37,6 +37,7 @@ import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
@ -51,7 +52,7 @@ public class PeelFromReality extends CardImpl<PeelFromReality> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you don't control");
static {
filter.setTargetController(TargetController.NOT_YOU);
filter.add(new ControllerPredicate(TargetController.NOT_YOU));
}
public PeelFromReality(UUID ownerId) {

View file

@ -51,6 +51,7 @@ import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.watchers.common.CastFromHandWatcher;
/**
@ -60,7 +61,7 @@ public class MyojinOfSeeingWinds extends CardImpl<MyojinOfSeeingWinds> {
private static final FilterPermanent filter = new FilterPermanent("permanent you control");
static {
filter.setTargetOwner(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public MyojinOfSeeingWinds(UUID ownerId) {

View file

@ -34,6 +34,7 @@ import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -50,7 +51,7 @@ public class AlphaBrawl extends CardImpl<AlphaBrawl> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
static {
filter.setTargetController(Constants.TargetController.OPPONENT);
filter.add(new ControllerPredicate(Constants.TargetController.OPPONENT));
}
public AlphaBrawl(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
@ -56,7 +57,7 @@ public class ArchdemonOfGreed extends CardImpl<ArchdemonOfGreed> {
static {
filter.add(new SubtypePredicate("Human"));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public ArchdemonOfGreed(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.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
@ -58,7 +59,7 @@ public class DungeonGeists extends CardImpl<DungeonGeists> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
static {
filter.setTargetController(Constants.TargetController.OPPONENT);
filter.add(new ControllerPredicate(Constants.TargetController.OPPONENT));
}
public DungeonGeists(UUID ownerId) {

View file

@ -38,6 +38,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterNonTokenPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.WolfToken;
@ -77,7 +78,7 @@ class FeedThePackEffect extends OneShotEffect<FeedThePackEffect> {
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public FeedThePackEffect() {

View file

@ -40,6 +40,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.ControllerPredicate;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
@ -52,7 +53,7 @@ public class Helvault extends CardImpl<Helvault> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you don't control");
static {
filter.setTargetController(TargetController.NOT_YOU);
filter.add(new ControllerPredicate(TargetController.NOT_YOU));
}
public Helvault(UUID ownerId) {

View file

@ -38,9 +38,9 @@ import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.players.Player;
@ -79,7 +79,7 @@ class EmissaryOfHopeEffect extends OneShotEffect<EmissaryOfHopeEffect> {
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
EmissaryOfHopeEffect() {

View file

@ -37,6 +37,7 @@ import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -80,7 +81,7 @@ class DivineReckoningEffect extends OneShotEffect<DivineReckoningEffect> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
static {
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public DivineReckoningEffect() {

View file

@ -47,6 +47,7 @@ import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.WolfTokenWithDeathtouch;
@ -136,7 +137,7 @@ class GarrukTheVeilCursedEffect extends OneShotEffect<GarrukTheVeilCursedEffect>
static {
filterCreature.add(new CardTypePredicate(CardType.CREATURE));
filterCreature.setTargetController(Constants.TargetController.YOU);
filterCreature.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public GarrukTheVeilCursedEffect() {

View file

@ -35,6 +35,7 @@ import mage.Constants.TargetController;
import mage.abilities.effects.common.continious.BoostAllEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -45,7 +46,7 @@ public class HystericalBlindness extends CardImpl<HystericalBlindness> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures your opponents control");
static {
filter.setTargetController(TargetController.OPPONENT);
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public HystericalBlindness(UUID ownerId) {

View file

@ -41,6 +41,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -52,7 +53,7 @@ public class OneEyedScarecrow extends CardImpl<OneEyedScarecrow> {
static {
filter.add(new AbilityPredicate(FlyingAbility.class));
filter.setTargetController(TargetController.OPPONENT);
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public OneEyedScarecrow(UUID ownerId) {

View file

@ -34,6 +34,7 @@ import mage.Constants.TargetController;
import mage.abilities.effects.common.FightTargetsEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
@ -46,7 +47,7 @@ public class PreyUpon extends CardImpl<PreyUpon> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you don't control");
static {
filter.setTargetController(TargetController.NOT_YOU);
filter.add(new ControllerPredicate(TargetController.NOT_YOU));
}
public PreyUpon(UUID ownerId) {

View file

@ -39,6 +39,7 @@ import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -49,7 +50,7 @@ public class ScourgeOfGeierReach extends CardImpl<ScourgeOfGeierReach> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("");
static {
filter.setTargetController(TargetController.OPPONENT);
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public ScourgeOfGeierReach(UUID ownerId) {

View file

@ -37,6 +37,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -93,7 +94,7 @@ class TributeToHungerEffect extends OneShotEffect<TributeToHungerEffect> {
FilterControlledPermanent filter = new FilterControlledPermanent("creature");
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false);
if (target.canChoose(player.getId(), game)) {

View file

@ -37,6 +37,7 @@ import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import java.util.UUID;
@ -49,7 +50,7 @@ public class VampiricFury extends CardImpl<VampiricFury> {
static {
vampires.add(new SubtypePredicate("Vampire"));
vampires.setTargetController(Constants.TargetController.YOU);
vampires.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public VampiricFury(UUID ownerId) {

View file

@ -43,6 +43,7 @@ import mage.abilities.keyword.ShroudAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -54,7 +55,7 @@ public class ScionOfOona extends CardImpl<ScionOfOona> {
static {
filter.add(new SubtypePredicate("Faerie"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public ScionOfOona(UUID ownerId) {

View file

@ -41,6 +41,7 @@ import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.AttacksIfAbleTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -52,7 +53,7 @@ public class AlluringSiren extends CardImpl<AlluringSiren> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
static {
filter.setTargetController(TargetController.OPPONENT);
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public AlluringSiren(UUID ownerId) {

View file

@ -45,6 +45,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -58,7 +59,7 @@ public class ArmoredAscension extends CardImpl<ArmoredAscension> {
static {
filter.add(new SubtypePredicate("Plains"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public ArmoredAscension(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
@ -54,8 +55,8 @@ public class CapriciousEfreet extends CardImpl<CapriciousEfreet> {
private static final FilterNonlandPermanent filterNotControlled = new FilterNonlandPermanent("nonland permanent you don't control");
static {
filterControlled.setTargetController(TargetController.YOU);
filterNotControlled.setTargetController(TargetController.NOT_YOU);
filterControlled.add(new ControllerPredicate(TargetController.YOU));
filterNotControlled.add(new ControllerPredicate(TargetController.NOT_YOU));
}
public CapriciousEfreet(UUID ownerId) {

View file

@ -36,6 +36,7 @@ import mage.Constants.TargetController;
import mage.abilities.effects.common.PreventAllDamageToEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreatureOrPlayer;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -46,7 +47,7 @@ public class SafePassage extends CardImpl<SafePassage> {
private static final FilterCreatureOrPlayer filter = new FilterCreatureOrPlayer("you and creatures you control");
static {
filter.getCreatureFilter().setTargetController(TargetController.YOU);
filter.getCreatureFilter().add(new ControllerPredicate(TargetController.YOU));
filter.getPlayerFilter().setPlayerTarget(TargetController.YOU);
}

View file

@ -38,6 +38,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -90,7 +91,7 @@ class YawningFissureEffect extends OneShotEffect<YawningFissureEffect> {
public boolean apply(Game game, Ability source) {
FilterControlledPermanent filter = new FilterControlledPermanent("land you control");
filter.add(new CardTypePredicate(CardType.LAND));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
Set<UUID> opponents = game.getOpponents(source.getControllerId());
for (UUID opponentId : opponents) {

View file

@ -38,6 +38,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -74,7 +75,7 @@ class CorruptEffect extends OneShotEffect<CorruptEffect> {
static {
filter.add(new SubtypePredicate("Swamp"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public CorruptEffect() {

View file

@ -41,6 +41,7 @@ import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -52,7 +53,7 @@ public class EarthServant extends CardImpl<EarthServant> {
static {
filter.add(new SubtypePredicate("Mountain"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public EarthServant(UUID ownerId) {

View file

@ -44,6 +44,7 @@ import mage.abilities.effects.common.ReturnFromExileEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterAttackingCreature;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
@ -57,7 +58,7 @@ public class MystifyingMaze extends CardImpl<MystifyingMaze> {
private static final FilterAttackingCreature filter = new FilterAttackingCreature("attacking creature an opponent controls");
static {
filter.setTargetController(TargetController.OPPONENT);
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public MystifyingMaze(UUID ownerId) {

View file

@ -50,6 +50,7 @@ import mage.abilities.keyword.EnchantAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
@ -175,7 +176,7 @@ class NecroticPlagueEffect2 extends OneShotEffect<NecroticPlagueEffect2> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
static {
filter.setTargetController(TargetController.OPPONENT);
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public NecroticPlagueEffect2(UUID cardId) {

View file

@ -43,6 +43,7 @@ import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -56,7 +57,7 @@ public class QuagSickness extends CardImpl<QuagSickness> {
static {
filter.add(new SubtypePredicate("Swamp"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public QuagSickness(UUID ownerId) {

View file

@ -41,6 +41,7 @@ import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -53,7 +54,7 @@ public class SteelOverseer extends CardImpl<SteelOverseer> {
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public SteelOverseer(UUID ownerId) {

View file

@ -37,6 +37,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -76,9 +77,9 @@ class SmallpoxEffect extends OneShotEffect<SmallpoxEffect> {
static {
filterCreature.add(new CardTypePredicate(CardType.CREATURE));
filterCreature.setTargetController(Constants.TargetController.YOU);
filterCreature.add(new ControllerPredicate(Constants.TargetController.YOU));
filterLand.add(new CardTypePredicate(CardType.LAND));
filterLand.setTargetController(Constants.TargetController.YOU);
filterLand.add(new ControllerPredicate(Constants.TargetController.YOU));
}
SmallpoxEffect() {

View file

@ -35,6 +35,7 @@ import mage.Constants.Rarity;
import mage.abilities.effects.common.continious.BoostAllEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -45,7 +46,7 @@ public class CowerInFear extends CardImpl<CowerInFear> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures your opponents control");
static {
filter.setTargetController(Constants.TargetController.OPPONENT);
filter.add(new ControllerPredicate(Constants.TargetController.OPPONENT));
}
public CowerInFear(UUID ownerId) {

View file

@ -37,6 +37,7 @@ import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.SaprolingToken;
@ -74,7 +75,7 @@ class FungalSproutingEffect extends OneShotEffect<FungalSproutingEffect> {
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public FungalSproutingEffect() {

View file

@ -53,6 +53,7 @@ import mage.counters.CounterType;
import mage.filter.common.FilterLandCard;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.permanent.Permanent;
@ -127,7 +128,7 @@ class LilianaOfTheDarkRealmsEffect extends ContinuousEffectImpl<LilianaOfTheDark
FilterLandPermanent filter = new FilterLandPermanent("Swamps");
filter.add(new SubtypePredicate("Swamp"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
this.amount = game.getBattlefield().count(filter, source.getControllerId(), game);
Player player = game.getPlayer(source.getControllerId());

View file

@ -37,6 +37,7 @@ import mage.abilities.effects.common.continious.BoostAllEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -48,7 +49,7 @@ public class Mutilate extends CardImpl<Mutilate> {
static {
filter.add(new SubtypePredicate("Swamp"));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public Mutilate(UUID ownerId) {

View file

@ -41,6 +41,7 @@ import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -54,7 +55,7 @@ public class ThundermawHellkite extends CardImpl<ThundermawHellkite> {
static {
filter.add(new AbilityPredicate(FlyingAbility.class));
filter.setTargetController(Constants.TargetController.OPPONENT);
filter.add(new ControllerPredicate(Constants.TargetController.OPPONENT));
}
public ThundermawHellkite(UUID ownerId) {

View file

@ -38,6 +38,7 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -51,7 +52,7 @@ public class TimberpackWolf extends CardImpl<TimberpackWolf> {
static {
filter.add(new NamePredicate("Timberpack Wolf"));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public TimberpackWolf(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -50,7 +51,7 @@ public class NightmareLash extends CardImpl<NightmareLash> {
static {
filter.add(new SubtypePredicate("Swamp"));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public NightmareLash(UUID ownerId) {

View file

@ -41,6 +41,7 @@ import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.Token;
@ -55,7 +56,7 @@ public class ChancellorOfTheForge extends CardImpl<ChancellorOfTheForge> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures you control");
static {
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public ChancellorOfTheForge(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.effects.common.UntapTargetEffect;
import mage.abilities.keyword.FlashAbility;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledPermanent;
@ -52,7 +53,7 @@ public class DeceiverExarch extends CardImpl<DeceiverExarch> {
private static final FilterPermanent filter = new FilterPermanent("permanent an opponent controls");
static {
filter.setTargetController(TargetController.OPPONENT);
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public DeceiverExarch(UUID ownerId) {

View file

@ -42,6 +42,7 @@ import mage.abilities.keyword.LivingWeaponAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -53,7 +54,7 @@ public class Lashwrithe extends CardImpl<Lashwrithe> {
static {
filter.add(new SubtypePredicate("Swamp"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public Lashwrithe(UUID ownerId) {

View file

@ -43,6 +43,7 @@ import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.permanent.token.GolemToken;
import mage.target.common.TargetCreaturePermanent;
@ -57,7 +58,7 @@ public class VitalSplicer extends CardImpl<VitalSplicer> {
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.add(new SubtypePredicate("Golem"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public VitalSplicer(UUID ownerId) {

View file

@ -41,6 +41,7 @@ import mage.abilities.effects.common.continious.GainAbilityAllEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -52,7 +53,7 @@ public class FiresOfYavimaya extends CardImpl<FiresOfYavimaya> {
private final static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Creatures you control");
static {
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public FiresOfYavimaya(UUID ownerId) {

View file

@ -38,6 +38,7 @@ import mage.abilities.keyword.ReboundAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -90,7 +91,7 @@ class ConsumingVaporsEffect extends OneShotEffect<ConsumingVaporsEffect> {
FilterControlledPermanent filter = new FilterControlledPermanent("creature");
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false);
//A spell or ability could have removed the only legal target this player

View file

@ -41,6 +41,7 @@ import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -50,7 +51,7 @@ public class DarksteelJuggernaut extends CardImpl<DarksteelJuggernaut> {
private static final FilterArtifactPermanent filter = new FilterArtifactPermanent("artifacts you control");
static {
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public DarksteelJuggernaut (UUID ownerId) {

View file

@ -53,6 +53,7 @@ import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
@ -69,9 +70,9 @@ public class KothOfTheHammer extends CardImpl<KothOfTheHammer> {
static {
filter.add(new SubtypePredicate("Mountain"));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
filterCount.add(new SubtypePredicate("Mountain"));
filterCount.setTargetController(Constants.TargetController.YOU);
filterCount.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public KothOfTheHammer (UUID ownerId) {

View file

@ -41,6 +41,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.GainControlTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterEquipment;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
@ -52,10 +53,10 @@ import mage.target.TargetPermanent;
*/
public class OgreGeargrabber extends CardImpl<OgreGeargrabber> {
private static FilterEquipment filter = new FilterEquipment("Equipment an opponent controls");
private static final FilterEquipment filter = new FilterEquipment("Equipment an opponent controls");
static {
filter.setTargetController(TargetController.OPPONENT);
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public OgreGeargrabber(UUID ownerId) {

View file

@ -37,6 +37,7 @@ import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.predicate.permanent.TappedPredicate;
/**
@ -53,7 +54,7 @@ public class ToilToRenown extends CardImpl<ToilToRenown> {
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.CREATURE),
new CardTypePredicate(CardType.LAND)));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public ToilToRenown(UUID ownerId) {

View file

@ -41,6 +41,7 @@ import mage.cards.CardImpl;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -54,7 +55,7 @@ public class MasterOfEtherium extends CardImpl<MasterOfEtherium> {
static {
filterCounted.add(new CardTypePredicate(CardType.ARTIFACT));
filterBoosted.add(new CardTypePredicate(CardType.ARTIFACT));
filterBoosted.setTargetController(Constants.TargetController.YOU);
filterBoosted.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public MasterOfEtherium(UUID ownerId) {

View file

@ -38,6 +38,7 @@ import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -49,7 +50,7 @@ public class AkoumBattlesinger extends CardImpl<AkoumBattlesinger> {
static {
filter.add(new SubtypePredicate("Ally"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public AkoumBattlesinger(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -99,7 +100,7 @@ class ButcherOfMalakirEffect extends OneShotEffect<ButcherOfMalakirEffect> {
public boolean apply(Game game, Ability source) {
FilterControlledPermanent filter = new FilterControlledPermanent("creature you control");
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
Set<UUID> opponents = game.getOpponents(source.getControllerId());
for (UUID opponentId : opponents) {

View file

@ -45,6 +45,7 @@ import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -58,7 +59,7 @@ public class ClawsOfValakut extends CardImpl<ClawsOfValakut> {
static {
filter.add(new SubtypePredicate("Mountain"));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public ClawsOfValakut (UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.TargetPlayer;
/**
@ -52,7 +53,7 @@ public class HalimarExcavator extends CardImpl<HalimarExcavator> {
static {
filter.add(new SubtypePredicate("Ally"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public HalimarExcavator(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.TargetPlayer;
/**
@ -52,7 +53,7 @@ public class HagraDiabolist extends CardImpl<HagraDiabolist> {
static {
filter.add(new SubtypePredicate("Ally"));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public HagraDiabolist(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -51,7 +52,7 @@ public class HighlandBerserker extends CardImpl<HighlandBerserker> {
static {
filter.add(new SubtypePredicate("Ally"));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public HighlandBerserker(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -51,7 +52,7 @@ public class JoragaBard extends CardImpl<JoragaBard> {
static {
filter.add(new SubtypePredicate("Ally"));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public JoragaBard(UUID ownerId) {

View file

@ -39,6 +39,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.ControllerPredicate;
/**
*
@ -50,7 +51,7 @@ public class KazuulWarlord extends CardImpl<KazuulWarlord> {
static {
filter.add(new SubtypePredicate("Ally"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public KazuulWarlord(UUID ownerId) {

View file

@ -37,6 +37,7 @@ import mage.abilities.effects.common.SkipNextUntapTargetEffect;
import mage.abilities.effects.common.TapTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -48,7 +49,7 @@ public class KorHookmaster extends CardImpl<KorHookmaster> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
static {
filter.setTargetController(TargetController.OPPONENT);
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public KorHookmaster(UUID ownerId) {

View file

@ -36,6 +36,7 @@ import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -47,7 +48,7 @@ public class LandbindRitual extends CardImpl<LandbindRitual> {
static {
filter.add(new SubtypePredicate("Plains"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public LandbindRitual(UUID ownerId) {

View file

@ -36,6 +36,7 @@ import mage.abilities.effects.common.DiscardTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.TargetPlayer;
/**
@ -48,7 +49,7 @@ public class MindSludge extends CardImpl<MindSludge> {
static {
filter.add(new SubtypePredicate("Swamp"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public MindSludge(UUID ownerId) {

View file

@ -40,6 +40,7 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -52,7 +53,7 @@ public class MurasaPyromancer extends CardImpl<MurasaPyromancer> {
static {
filter.add(new SubtypePredicate("Ally"));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public MurasaPyromancer(UUID ownerId) {

View file

@ -39,6 +39,7 @@ import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -50,7 +51,7 @@ public class OnduCleric extends CardImpl<OnduCleric> {
static {
filter.add(new SubtypePredicate("Ally"));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public OnduCleric(UUID ownerId) {

View file

@ -37,6 +37,7 @@ import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
@ -49,7 +50,7 @@ public class PrimalBellow extends CardImpl<PrimalBellow> {
static {
filter.add(new SubtypePredicate("Forest"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}

View file

@ -40,6 +40,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -51,7 +52,7 @@ public class SeascapeAerialist extends CardImpl<SeascapeAerialist> {
static {
filter.add(new SubtypePredicate("Ally"));
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
}
public SeascapeAerialist(UUID ownerId) {

View file

@ -35,6 +35,7 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetCreatureOrPlayer;
import java.util.UUID;
@ -49,7 +50,7 @@ public class SpireBarrage extends CardImpl<SpireBarrage> {
static {
filter.add(new SubtypePredicate("Mountain"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public SpireBarrage(UUID ownerId) {

View file

@ -42,6 +42,7 @@ import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
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);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
filterTarget.add(new AbilityPredicate(FlyingAbility.class));
}

View file

@ -39,6 +39,7 @@ import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -50,7 +51,7 @@ public class TimbermawLarva extends CardImpl<TimbermawLarva> {
static {
filter.add(new SubtypePredicate("Forest"));
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}

View file

@ -35,6 +35,7 @@ import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.filter.FilterPermanent;
import mage.filter.FilterStackObject;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -87,7 +88,7 @@ public class CantTargetControlledEffect extends ReplacementEffectImpl<CantTarget
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.TARGET) {
filterTarget.setTargetController(TargetController.YOU);
filterTarget.add(new ControllerPredicate(TargetController.YOU));
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && filterTarget.match(permanent, source.getSourceId(), source.getControllerId(), game)) {
if (filterSource == null)

View file

@ -34,6 +34,7 @@ import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -79,7 +80,7 @@ public class SacrificeEffect extends OneShotEffect<SacrificeEffect>{
return false;
}
filter.setTargetController(Constants.TargetController.YOU);
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
int amount = count.calculate(game, source);
int realCount = game.getBattlefield().countAll(filter, player.getId(), game);

View file

@ -35,6 +35,7 @@ import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -114,7 +115,7 @@ class AnnihilatorEffect extends OneShotEffect<AnnihilatorEffect> {
player = game.getPlayer(permanent.getControllerId());
}
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
int amount = Math.min(count, game.getBattlefield().countAll(filter, player.getId(), game));
Target target = new TargetControlledPermanent(amount, amount, filter, false);

View file

@ -35,6 +35,7 @@ import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost;
import mage.abilities.effects.common.AttachEffect;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetLandPermanent;
/**
@ -48,7 +49,7 @@ public class FortifyAbility extends ActivatedAbilityImpl<FortifyAbility> {
private static final FilterLandPermanent filter = new FilterLandPermanent("land you control");
static {
filter.setTargetController(TargetController.YOU);
filter.add(new ControllerPredicate(TargetController.YOU));
}
public FortifyAbility(Zone zone, AttachEffect effect, Cost cost) {

View file

@ -31,9 +31,9 @@ package mage.filter;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.Constants.TargetController;
import mage.filter.predicate.ObjectPlayer;
import mage.filter.predicate.ObjectPlayerPredicate;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -43,11 +43,9 @@ import mage.game.permanent.Permanent;
* @author BetaSteward_at_googlemail.com
*/
public class FilterPermanent extends FilterObject<Permanent> {
protected List<ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>>> extraPredicates = new ArrayList<ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>>>();
protected List<ObjectPlayerPredicate<ObjectPlayer<Permanent>>> extraPredicates = new ArrayList<ObjectPlayerPredicate<ObjectPlayer<Permanent>>>();
protected List<UUID> controllerId = new ArrayList<UUID>();
protected boolean notController;
protected TargetController controller = TargetController.ANY;
protected TargetController owner = TargetController.ANY;
public FilterPermanent() {
super("permanent");
@ -57,9 +55,7 @@ public class FilterPermanent extends FilterObject<Permanent> {
super(filter);
this.controllerId = new ArrayList<UUID>(filter.controllerId);
this.notController = filter.notController;
this.controller = filter.controller;
this.owner = filter.owner;
this.extraPredicates = new ArrayList<ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>>>(extraPredicates);
this.extraPredicates = new ArrayList<ObjectPlayerPredicate<ObjectPlayer<Permanent>>>(extraPredicates);
}
public FilterPermanent(String name) {
@ -79,46 +75,12 @@ public class FilterPermanent extends FilterObject<Permanent> {
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
if (!this.match(permanent, game))
return notFilter;
if (controller != TargetController.ANY && playerId != null) {
switch(controller) {
case YOU:
if (!permanent.getControllerId().equals(playerId))
return notFilter;
break;
case OPPONENT:
if (!game.getOpponents(playerId).contains(permanent.getControllerId()))
return notFilter;
break;
case NOT_YOU:
if (permanent.getControllerId().equals(playerId))
return notFilter;
break;
}
}
if (owner != TargetController.ANY && playerId != null) {
switch(owner) {
case YOU:
if (!permanent.getOwnerId().equals(playerId))
return notFilter;
break;
case OPPONENT:
if (!game.getOpponents(playerId).contains(permanent.getOwnerId()))
return notFilter;
break;
case NOT_YOU:
if (permanent.getOwnerId().equals(playerId))
return notFilter;
break;
}
}
return false;
return Predicates.and(extraPredicates).apply(new ObjectSourcePlayer(permanent, sourceId, playerId), game);
}
public void add(ObjectSourcePlayerPredicate predicate) {
public void add(ObjectPlayerPredicate predicate) {
extraPredicates.add(predicate);
}
@ -130,20 +92,6 @@ public class FilterPermanent extends FilterObject<Permanent> {
this.notController = notController;
}
public void setTargetController(TargetController controller) {
this.controller = controller;
}
public void setTargetOwner(TargetController owner) {
this.owner = owner;
}
public boolean matchController(UUID testControllerId) {
if (controllerId.size() > 0 && controllerId.contains(testControllerId) == notController)
return false;
return true;
}
@Override
public FilterPermanent copy() {
return new FilterPermanent(this);

View file

@ -1,55 +0,0 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.filter;
import java.util.ArrayList;
import java.util.List;
import mage.filter.Filter.ComparisonScope;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class ListComparer<T> {
public boolean compare(List<T> list1, List<T> list2, ComparisonScope scope, boolean negate) {
if (scope == ComparisonScope.All) {
if (list2.containsAll(list1) == negate) {
return false;
}
}
else {
List<T> check = new ArrayList<T>(list1);
if (check.removeAll(list2) == negate) {
return false;
}
}
return true;
}
}

View file

@ -30,6 +30,7 @@ package mage.filter.common;
import mage.Constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -43,7 +44,7 @@ public class FilterControlledPermanent extends FilterPermanent {
public FilterControlledPermanent(String name) {
super(name);
this.controller = TargetController.YOU;
this.add(new ControllerPredicate(TargetController.YOU));
}
public FilterControlledPermanent(final FilterControlledPermanent filter) {

View file

@ -31,5 +31,5 @@ package mage.filter.predicate;
*
* @author North
*/
public interface ObjectSourcePlayerPredicate<T extends ObjectSourcePlayer> extends Predicate<T> {
public interface ObjectSourcePlayerPredicate<T extends ObjectSourcePlayer> extends ObjectPlayerPredicate<T> {
}

View file

@ -0,0 +1,80 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.filter.predicate.permanent;
import java.util.UUID;
import mage.Constants;
import mage.Constants.TargetController;
import mage.filter.predicate.ObjectPlayer;
import mage.filter.predicate.ObjectPlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author North
*/
public class ControllerPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
private Constants.TargetController controller;
public ControllerPredicate(TargetController controller) {
this.controller = controller;
}
@Override
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
Permanent permanent = input.getObject();
UUID playerId = input.getPlayerId();
switch (controller) {
case YOU:
if (permanent.getControllerId().equals(playerId)) {
return true;
}
break;
case OPPONENT:
if (game.getOpponents(playerId).contains(permanent.getControllerId())) {
return true;
}
break;
case NOT_YOU:
if (!permanent.getControllerId().equals(playerId)) {
return true;
}
break;
}
return true;
}
@Override
public String toString() {
return "TargetController(" + controller.toString() + ')';
}
}