partially refactor TargetCreaturePermanent constructors

This commit is contained in:
theelk801 2025-06-19 16:00:31 -04:00
parent 80500b5b94
commit 3e65021150
99 changed files with 724 additions and 911 deletions

View file

@ -1,11 +1,12 @@
package mage.utils.testers; package mage.utils.testers;
import mage.constants.SubType; import mage.constants.ComparisonType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.ManaValuePredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetPermanentOrPlayer; import mage.target.common.TargetPermanentOrPlayer;
/** /**
@ -79,12 +80,14 @@ abstract class BaseTestableDialog implements TestableDialog {
return new TargetPermanentOrPlayer(min, max).withNotTarget(notTarget); return new TargetPermanentOrPlayer(min, max).withNotTarget(notTarget);
} }
static Target createImpossibleTarget(int min, int max) { private static final FilterPermanent impossibleFilter = new FilterPermanent();
return createImpossibleTarget(min, max, false);
static {
impossibleFilter.add(new ManaValuePredicate(ComparisonType.OR_LESS, -1));
} }
private static Target createImpossibleTarget(int min, int max, boolean notTarget) { static Target createImpossibleTarget(int min, int max) {
return new TargetCreaturePermanent(min, max, new FilterCreaturePermanent(SubType.TROOPER, "rare type"), notTarget); return new TargetPermanent(min, max, impossibleFilter);
} }
@Override @Override

View file

@ -1,21 +1,21 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author weirddan455 * @author weirddan455
*/ */
public final class AirCultElemental extends CardImpl { public final class AirCultElemental extends CardImpl {
@ -38,7 +38,7 @@ public final class AirCultElemental extends CardImpl {
// Whirlwind When Air-Cult Elemental enters the battlefield, return up to one other target creature to its owner's hand. // Whirlwind When Air-Cult Elemental enters the battlefield, return up to one other target creature to its owner's hand.
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect()); Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect());
ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false)); ability.addTarget(new TargetPermanent(0, 1, filter));
this.addAbility(ability.withFlavorWord("Whirlwind")); this.addAbility(ability.withFlavorWord("Whirlwind"));
} }

View file

@ -8,7 +8,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.other.AnotherTargetPredicate; import mage.filter.predicate.other.AnotherTargetPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import mage.target.targetpointer.EachTargetPointer; import mage.target.targetpointer.EachTargetPointer;
import mage.target.targetpointer.SecondTargetPointer; import mage.target.targetpointer.SecondTargetPointer;
import mage.target.targetpointer.ThirdTargetPointer; import mage.target.targetpointer.ThirdTargetPointer;
@ -35,28 +35,22 @@ public final class ArmTheCathars extends CardImpl {
// Until end of turn, target creature gets +3/+3, up to one other target creature gets +2/+2, and up to one other target creature gets +1/+1. Those creatures gain vigilance until end of turn. // Until end of turn, target creature gets +3/+3, up to one other target creature gets +2/+2, and up to one other target creature gets +1/+1. Those creatures gain vigilance until end of turn.
this.getSpellAbility().addEffect(new BoostTargetEffect(3, 3) this.getSpellAbility().addEffect(new BoostTargetEffect(3, 3)
.setText("until end of turn, target creature gets +3/+3")); .setText("until end of turn, target creature gets +3/+3"));
TargetCreaturePermanent target1 = new TargetCreaturePermanent(filter1); this.getSpellAbility().addTarget(new TargetPermanent(filter1).setTargetTag(1).withChooseHint("+3/+3"));
target1.setTargetTag(1);
this.getSpellAbility().addTarget(target1.withChooseHint("+3/+3"));
this.getSpellAbility().addEffect(new BoostTargetEffect(2, 2) this.getSpellAbility().addEffect(new BoostTargetEffect(2, 2)
.setTargetPointer(new SecondTargetPointer()) .setTargetPointer(new SecondTargetPointer())
.setText(", up to one other target creature gets +2/+2")); .setText(", up to one other target creature gets +2/+2"));
TargetCreaturePermanent target2 = new TargetCreaturePermanent(0, 1, filter2, false); this.getSpellAbility().addTarget(new TargetPermanent(0, 1, filter2).setTargetTag(2).withChooseHint("+2/+2"));
target2.setTargetTag(2);
this.getSpellAbility().addTarget(target2.withChooseHint("+2/+2"));
this.getSpellAbility().addEffect(new BoostTargetEffect(1, 1) this.getSpellAbility().addEffect(new BoostTargetEffect(1, 1)
.setTargetPointer(new ThirdTargetPointer()) .setTargetPointer(new ThirdTargetPointer())
.setText(", and up to one other target creature gets +1/+1")); .setText(", and up to one other target creature gets +1/+1"));
TargetCreaturePermanent target3 = new TargetCreaturePermanent(0, 1, filter3, false); this.getSpellAbility().addTarget(new TargetPermanent(0, 1, filter3).setTargetTag(3).withChooseHint("+1/+1"));
target3.setTargetTag(3);
this.getSpellAbility().addTarget(target3.withChooseHint("+1/+1"));
this.getSpellAbility().addEffect( this.getSpellAbility().addEffect(
new GainAbilityTargetEffect(VigilanceAbility.getInstance()) new GainAbilityTargetEffect(VigilanceAbility.getInstance())
.setTargetPointer(new EachTargetPointer()) .setTargetPointer(new EachTargetPointer())
.setText("Those creatures gain vigilance until end of turn")); .setText("Those creatures gain vigilance until end of turn"));
} }
private ArmTheCathars(final ArmTheCathars card) { private ArmTheCathars(final ArmTheCathars card) {

View file

@ -13,7 +13,7 @@ import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.TappedPredicate; import mage.filter.predicate.permanent.TappedPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
@ -28,7 +28,6 @@ public final class AtraxiWarden extends CardImpl {
filter.add(TappedPredicate.TAPPED); filter.add(TappedPredicate.TAPPED);
} }
public AtraxiWarden(UUID ownerId, CardSetInfo setInfo) { public AtraxiWarden(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}");
@ -42,7 +41,7 @@ public final class AtraxiWarden extends CardImpl {
// When Atraxi Warden enters the battlefield, exile up to one target tapped creature. // When Atraxi Warden enters the battlefield, exile up to one target tapped creature.
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetEffect()); Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetEffect());
ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false)); ability.addTarget(new TargetPermanent(0, 1, filter));
this.addAbility(ability); this.addAbility(ability);
// Suspend 5--{1}{W} // Suspend 5--{1}{W}

View file

@ -10,7 +10,7 @@ import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
@ -18,13 +18,13 @@ import java.util.UUID;
* @author Merlingilb * @author Merlingilb
*/ */
public class Betray extends CardImpl { public class Betray extends CardImpl {
public Betray(UUID ownerId, CardSetInfo setInfo) { public Betray(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}");
//Target creature an opponent controls deals damage to its controller equal to that creature's power. //Target creature an opponent controls deals damage to its controller equal to that creature's power.
this.getSpellAbility().addEffect(new BetrayEffect()); this.getSpellAbility().addEffect(new BetrayEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(1, 1, this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE));
StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE, false));
} }
private Betray(final Betray card) { private Betray(final Betray card) {

View file

@ -11,8 +11,8 @@ import mage.filter.predicate.other.AnotherTargetPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.Target; import mage.target.Target;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -35,7 +35,7 @@ public final class BetrayalAtTheVault extends CardImpl {
// Target creature you control deals damage equal to its power to each of two other target creatures. // Target creature you control deals damage equal to its power to each of two other target creatures.
this.getSpellAbility().addEffect(new BetrayalAtTheVaultEffect()); this.getSpellAbility().addEffect(new BetrayalAtTheVaultEffect());
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent().setTargetTag(1)); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent().setTargetTag(1));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2, 2, filter, false).setTargetTag(2)); this.getSpellAbility().addTarget(new TargetPermanent(2, filter).setTargetTag(2));
} }
private BetrayalAtTheVault(final BetrayalAtTheVault card) { private BetrayalAtTheVault(final BetrayalAtTheVault card) {
@ -81,4 +81,4 @@ class BetrayalAtTheVaultEffect extends OneShotEffect {
.forEach(p -> p.damage(creature.getPower().getValue(), creature.getId(), source, game)); .forEach(p -> p.damage(creature.getPower().getValue(), creature.getId(), source, game));
return true; return true;
} }
} }

View file

@ -2,7 +2,6 @@ package mage.cards.b;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.GainLifeTargetEffect; import mage.abilities.effects.common.GainLifeTargetEffect;
import mage.abilities.effects.common.SacrificeEffect; import mage.abilities.effects.common.SacrificeEffect;
import mage.abilities.effects.common.UntapTargetEffect; import mage.abilities.effects.common.UntapTargetEffect;
@ -10,10 +9,7 @@ import mage.abilities.keyword.EscalateAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetController;
import mage.filter.FilterPlayer;
import mage.filter.common.FilterAttackingCreature; import mage.filter.common.FilterAttackingCreature;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
@ -24,14 +20,6 @@ import java.util.UUID;
*/ */
public final class BlessedAlliance extends CardImpl { public final class BlessedAlliance extends CardImpl {
private static final FilterPlayer filterSacrifice = new FilterPlayer("opponent to sacrifice an attacking creature");
private static final FilterCreaturePermanent filterCreature = new FilterCreaturePermanent("creatures to untap");
private static final FilterPlayer filterGainLife = new FilterPlayer("player to gain life");
static {
filterSacrifice.add(TargetController.OPPONENT.getPlayerPredicate());
}
public BlessedAlliance(UUID ownerId, CardSetInfo setInfo) { public BlessedAlliance(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
@ -43,21 +31,17 @@ public final class BlessedAlliance extends CardImpl {
this.getSpellAbility().getModes().setMaxModes(3); this.getSpellAbility().getModes().setMaxModes(3);
// Target player gains 4 life. // Target player gains 4 life.
Effect effect = new GainLifeTargetEffect(4); this.getSpellAbility().addEffect(new GainLifeTargetEffect(4));
effect.setText("Target player gains 4 life"); this.getSpellAbility().addTarget(new TargetPlayer().withChooseHint("player gains 4 life"));
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetPlayer(1, 1, false, filterGainLife).withChooseHint("player gains 4 life"));
// Untap up to two target creatures. // Untap up to two target creatures.
effect = new UntapTargetEffect(); Mode mode = new Mode(new UntapTargetEffect());
effect.setText("Untap up to two target creatures"); mode.addTarget(new TargetCreaturePermanent(0, 2).withChooseHint("untap"));
Mode mode = new Mode(effect);
mode.addTarget(new TargetCreaturePermanent(0, 2, filterCreature, false).withChooseHint("untap"));
this.getSpellAbility().addMode(mode); this.getSpellAbility().addMode(mode);
// Target opponent sacrifices an attacking creature. // Target opponent sacrifices an attacking creature.
mode = new Mode(new SacrificeEffect(new FilterAttackingCreature(), 1, "Target opponent")); mode = new Mode(new SacrificeEffect(new FilterAttackingCreature(), 1, "Target opponent"));
mode.addTarget(new TargetPlayer(1, 1, false, filterSacrifice).withChooseHint("sacrifices an attacking creature")); mode.addTarget(new TargetPlayer().withChooseHint("sacrifices an attacking creature"));
this.getSpellAbility().addMode(mode); this.getSpellAbility().addMode(mode);
} }

View file

@ -1,24 +1,24 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.*;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.other.AnotherTargetPredicate; import mage.filter.predicate.other.AnotherTargetPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetOpponentsCreaturePermanent; import mage.target.common.TargetOpponentsCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author weirddan455 * @author weirddan455
*/ */
public final class BlueDragon extends CardImpl { public final class BlueDragon extends CardImpl {
@ -43,19 +43,9 @@ public final class BlueDragon extends CardImpl {
// Lightning Breath When Blue Dragon enters the battlefield, until your next turn, target creature an opponent controls gets -3/-0, up to one other target creature gets -2/-0, and up to one other target creature gets -1/-0. // Lightning Breath When Blue Dragon enters the battlefield, until your next turn, target creature an opponent controls gets -3/-0, up to one other target creature gets -2/-0, and up to one other target creature gets -1/-0.
Ability ability = new EntersBattlefieldTriggeredAbility(new BlueDragonEffect()); Ability ability = new EntersBattlefieldTriggeredAbility(new BlueDragonEffect());
ability.addTarget(new TargetOpponentsCreaturePermanent().setTargetTag(1).withChooseHint("-3/-0"));
Target target = new TargetOpponentsCreaturePermanent(); ability.addTarget(new TargetPermanent(0, 1, filter2).setTargetTag(2).withChooseHint("-2/-0"));
target.setTargetTag(1); ability.addTarget(new TargetPermanent(0, 1, filter3).setTargetTag(3).withChooseHint("-1/-0"));
ability.addTarget(target.withChooseHint("-3/-0"));
target = new TargetCreaturePermanent(0, 1, filter2, false);
target.setTargetTag(2);
ability.addTarget(target.withChooseHint("-2/-0"));
target = new TargetCreaturePermanent(0, 1, filter3, false);
target.setTargetTag(3);
ability.addTarget(target.withChooseHint("-1/-0"));
this.addAbility(ability.withFlavorWord("Lightning Breath")); this.addAbility(ability.withFlavorWord("Lightning Breath"));
} }

View file

@ -16,6 +16,7 @@ import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -30,8 +31,8 @@ public final class BreakingOfTheFellowship extends CardImpl {
// Target creature an opponent controls deals damage equal to its power to another target creature that player controls. // Target creature an opponent controls deals damage equal to its power to another target creature that player controls.
this.getSpellAbility().addEffect(new BreakingOfTheFellowshipEffect()); this.getSpellAbility().addEffect(new BreakingOfTheFellowshipEffect());
this.getSpellAbility().addTarget(new BreakingOfTheFellowshipFirstTarget(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE)); this.getSpellAbility().addTarget(new BreakingOfTheFellowshipFirstTarget());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("another target creature that player controls"))); this.getSpellAbility().addTarget(new TargetPermanent(new FilterCreaturePermanent("another target creature that player controls")));
// The Ring tempts you. // The Ring tempts you.
this.getSpellAbility().addEffect(new TheRingTemptsYouEffect()); this.getSpellAbility().addEffect(new TheRingTemptsYouEffect());
@ -78,10 +79,10 @@ class BreakingOfTheFellowshipEffect extends OneShotEffect {
} }
class BreakingOfTheFellowshipFirstTarget extends TargetCreaturePermanent { class BreakingOfTheFellowshipFirstTarget extends TargetPermanent {
public BreakingOfTheFellowshipFirstTarget(FilterCreaturePermanent filter) { public BreakingOfTheFellowshipFirstTarget() {
super(1, 1, filter, false); super(1, 1, StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE, false);
} }
private BreakingOfTheFellowshipFirstTarget(final BreakingOfTheFellowshipFirstTarget target) { private BreakingOfTheFellowshipFirstTarget(final BreakingOfTheFellowshipFirstTarget target) {

View file

@ -1,7 +1,5 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID;
import mage.abilities.effects.common.TapTargetEffect; import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.keyword.HorsemanshipAbility; import mage.abilities.keyword.HorsemanshipAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -10,26 +8,27 @@ import mage.constants.CardType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate; import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*/ */
public final class BrokenDam extends CardImpl { public final class BrokenDam extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures without horsemanship");
static { static {
filter.add(Predicates.not(new AbilityPredicate(HorsemanshipAbility.class))); filter.add(Predicates.not(new AbilityPredicate(HorsemanshipAbility.class)));
} }
public BrokenDam(UUID ownerId, CardSetInfo setInfo) { public BrokenDam(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{U}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{U}");
// Tap one or two target creatures without horsemanship. // Tap one or two target creatures without horsemanship.
this.getSpellAbility().addEffect(new TapTargetEffect("tap one or two target creatures without horsemanship")); this.getSpellAbility().addEffect(new TapTargetEffect("tap one or two target creatures without horsemanship"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(1, 2, filter, false)); this.getSpellAbility().addTarget(new TargetPermanent(1, 2, filter));
} }
private BrokenDam(final BrokenDam card) { private BrokenDam(final BrokenDam card) {

View file

@ -1,23 +1,19 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.PersistAbility; import mage.abilities.keyword.PersistAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class CauldronOfSouls extends CardImpl { public final class CauldronOfSouls extends CardImpl {
@ -26,12 +22,13 @@ public final class CauldronOfSouls extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}");
// {tap}: Choose any number of target creatures. Each of those creatures gains persist until end of turn. // {tap}: Choose any number of target creatures. Each of those creatures gains persist until end of turn.
Effect effect = new GainAbilityTargetEffect(new PersistAbility(), Duration.EndOfTurn); Ability ability = new SimpleActivatedAbility(
effect.setText("choose any number of target creatures. Each of those creatures gains persist until end of turn"); new GainAbilityTargetEffect(new PersistAbility(), Duration.EndOfTurn)
Ability ability = new SimpleActivatedAbility(effect, new TapSourceCost()); .setText("choose any number of target creatures. Each of those creatures gains persist until end of turn"),
ability.addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, StaticFilters.FILTER_PERMANENT_CREATURE, false)); new TapSourceCost()
);
ability.addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE));
this.addAbility(ability); this.addAbility(ability);
} }
private CauldronOfSouls(final CauldronOfSouls card) { private CauldronOfSouls(final CauldronOfSouls card) {

View file

@ -16,7 +16,6 @@ import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.Objects; import java.util.Objects;
import java.util.UUID; import java.util.UUID;
@ -67,9 +66,9 @@ public final class CloudsLimitBreak extends CardImpl {
} }
} }
class CloudsLimitBreakTarget extends TargetCreaturePermanent { class CloudsLimitBreakTarget extends TargetPermanent {
private static final FilterCreaturePermanent filter private static final FilterPermanent filter
= new FilterCreaturePermanent("tapped creatures with different controllers"); = new FilterCreaturePermanent("tapped creatures with different controllers");
CloudsLimitBreakTarget() { CloudsLimitBreakTarget() {

View file

@ -1,30 +1,34 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterTeamCreaturePermanent; import mage.filter.common.FilterTeamCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class ComboAttack extends CardImpl { public final class ComboAttack extends CardImpl {
private static final FilterPermanent filter = new FilterTeamCreaturePermanent("creatures your team controls");
public ComboAttack(UUID ownerId, CardSetInfo setInfo) { public ComboAttack(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");
// Two target creatures your team controls each deal damage equal to their power to target creature. // Two target creatures your team controls each deal damage equal to their power to target creature.
this.getSpellAbility().addEffect(new ComboAttackEffect()); this.getSpellAbility().addEffect(new ComboAttackEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2, 2, new FilterTeamCreaturePermanent(), false)); this.getSpellAbility().addTarget(new TargetPermanent(2, filter));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(1)); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
} }
private ComboAttack(final ComboAttack card) { private ComboAttack(final ComboAttack card) {

View file

@ -14,8 +14,8 @@ import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID; import java.util.UUID;
@ -79,10 +79,10 @@ class CulturalExchangeEffect extends OneShotEffect {
if (creaturesToSwitch == 0) { if (creaturesToSwitch == 0) {
return true; return true;
} }
TargetCreaturePermanent target1 = new TargetCreaturePermanent(0, creaturesToSwitch, filter1, true); TargetPermanent target1 = new TargetPermanent(0, creaturesToSwitch, filter1, true);
if (target1.choose(Outcome.Benefit, controller.getId(), source.getSourceId(), source, game)) { if (target1.choose(Outcome.Benefit, controller.getId(), source.getSourceId(), source, game)) {
int otherToSwitch = target1.getTargets().size(); int otherToSwitch = target1.getTargets().size();
TargetCreaturePermanent target2 = new TargetCreaturePermanent(otherToSwitch, otherToSwitch, filter2, true); TargetPermanent target2 = new TargetPermanent(otherToSwitch, otherToSwitch, filter2, true);
if (target2.choose(Outcome.Benefit, controller.getId(), source.getSourceId(), source, game)) { if (target2.choose(Outcome.Benefit, controller.getId(), source.getSourceId(), source, game)) {
for (UUID creatureId : target1.getTargets()) { for (UUID creatureId : target1.getTargets()) {
Permanent creature = game.getPermanent(creatureId); Permanent creature = game.getPermanent(creatureId);

View file

@ -3,8 +3,6 @@ package mage.cards.c;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.delayed.ReflexiveTriggeredAbility; import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateRoleAttachedTargetEffect;
import mage.abilities.effects.common.FightTargetsEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
@ -13,11 +11,9 @@ import mage.constants.RoleType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetOpponentsCreaturePermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.util.GameLog;
import java.util.UUID; import java.util.UUID;
@ -64,24 +60,15 @@ class CurseOfTheWerefoxEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent target = game.getPermanent(source.getFirstTarget()); Permanent target = game.getPermanent(source.getFirstTarget());
if (target == null) { if (target == null || !RoleType.MONSTER.createToken(target, game, source).getLastAddedTokenIds().isEmpty()) {
return false;
}
boolean didCreate =
new CreateRoleAttachedTargetEffect(RoleType.MONSTER)
.setTargetPointer(new FixedTarget(target, game))
.apply(game, source);
if (!didCreate) {
return false; return false;
} }
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility( ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(
new CurseOfTheWerefoxFightEffect(), false, new CurseOfTheWerefoxFightEffect().setTargetPointer(new FixedTarget(target.getId(), game)),
"that creature fights up to one target creature you don't control" false, "that creature fights up to one target creature you don't control"
); );
ability.getEffects().setTargetPointer(new FixedTarget(target.getId(), game)); ability.addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL));
ability.addTarget(new TargetCreaturePermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, false));
game.fireReflexiveTriggeredAbility(ability, source); game.fireReflexiveTriggeredAbility(ability, source);
return true; return true;
} }

View file

@ -1,4 +1,3 @@
package mage.cards.c; package mage.cards.c;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -14,26 +13,22 @@ import mage.filter.predicate.Predicates;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import mage.util.functions.EmptyCopyApplier; import mage.util.functions.EmptyCopyApplier;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class Cytoshape extends CardImpl { public final class Cytoshape extends CardImpl {
public Cytoshape(UUID ownerId, CardSetInfo setInfo) { public Cytoshape(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}{U}");
// Choose a nonlegendary creature on the battlefield. Target creature becomes a copy of that creature until end of turn. // Choose a nonlegendary creature on the battlefield. Target creature becomes a copy of that creature until end of turn.
this.getSpellAbility().addEffect(new CytoshapeEffect()); this.getSpellAbility().addEffect(new CytoshapeEffect());
this.getSpellAbility().addTarget(new TargetPermanent().withChooseHint("to become a copy"));
FilterCreaturePermanent filter = new FilterCreaturePermanent("target creature that will become a copy");
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
} }
private Cytoshape(final Cytoshape card) { private Cytoshape(final Cytoshape card) {
@ -53,9 +48,11 @@ class CytoshapeEffect extends OneShotEffect {
static { static {
filter.add(Predicates.not(SuperType.LEGENDARY.getPredicate())); filter.add(Predicates.not(SuperType.LEGENDARY.getPredicate()));
} }
CytoshapeEffect() { CytoshapeEffect() {
super(Outcome.Copy); super(Outcome.Copy);
this.staticText = "Choose a nonlegendary creature on the battlefield. Target creature becomes a copy of that creature until end of turn."; this.staticText = "Choose a nonlegendary creature on the battlefield. " +
"Target creature becomes a copy of that creature until end of turn.";
} }
private CytoshapeEffect(final CytoshapeEffect effect) { private CytoshapeEffect(final CytoshapeEffect effect) {
@ -69,7 +66,7 @@ class CytoshapeEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability ability) { public boolean apply(Game game, Ability ability) {
Target target = new TargetCreaturePermanent(1, 1, filter, true); Target target = new TargetPermanent(1, 1, filter, true);
target.choose(Outcome.Copy, ability.getControllerId(), ability, game); target.choose(Outcome.Copy, ability.getControllerId(), ability, game);
Permanent copyFrom = game.getPermanent(target.getFirstTarget()); Permanent copyFrom = game.getPermanent(target.getFirstTarget());
if (copyFrom != null) { if (copyFrom != null) {

View file

@ -1,19 +1,22 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.Target; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;
/** /**
*
* @author LoneFox * @author LoneFox
*/ */
public final class DeadRingers extends CardImpl { public final class DeadRingers extends CardImpl {
@ -23,7 +26,7 @@ public final class DeadRingers extends CardImpl {
// Destroy two target nonblack creatures unless either one is a color the other isn't. They can't be regenerated. // Destroy two target nonblack creatures unless either one is a color the other isn't. They can't be regenerated.
this.getSpellAbility().addEffect(new DeadRingersEffect()); this.getSpellAbility().addEffect(new DeadRingersEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2, 2, StaticFilters.FILTER_PERMANENT_CREATURE_NON_BLACK, false)); this.getSpellAbility().addTarget(new TargetPermanent(2, StaticFilters.FILTER_PERMANENT_CREATURE_NON_BLACK));
} }
private DeadRingers(final DeadRingers card) { private DeadRingers(final DeadRingers card) {
@ -36,11 +39,11 @@ public final class DeadRingers extends CardImpl {
} }
} }
class DeadRingersEffect extends DestroyTargetEffect { class DeadRingersEffect extends OneShotEffect {
DeadRingersEffect() { DeadRingersEffect() {
super(true); super(Outcome.DestroyPermanent);
staticText = "Destroy two target nonblack creatures unless either one is a color the other isn't. They can't be regenerated."; staticText = "destroy two target nonblack creatures unless either one is a color the other isn't. They can't be regenerated.";
} }
private DeadRingersEffect(final DeadRingersEffect effect) { private DeadRingersEffect(final DeadRingersEffect effect) {
@ -54,17 +57,23 @@ class DeadRingersEffect extends DestroyTargetEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Target target = source.getTargets().get(0); List<Permanent> permanents = this
if (target != null .getTargetPointer()
&& target.getTargets().size() > 1) { .getTargets(game, source)
Permanent first = game.getPermanentOrLKIBattlefield(target.getTargets().get(0)); .stream()
Permanent second = game.getPermanentOrLKIBattlefield(target.getTargets().get(1)); .map(game::getPermanent)
if (first != null .filter(Objects::nonNull)
&& second != null .collect(Collectors.toList());
&& first.getColor(game).equals(second.getColor(game))) { if (permanents.size() < 2) {
return super.apply(game, source); return false;
}
} }
return false; Permanent first = permanents.get(0);
Permanent second = permanents.get(1);
if (!first.getColor(game).equals(second.getColor(game))) {
return false;
}
first.destroy(source, game, true);
second.destroy(source, game, true);
return true;
} }
} }

View file

@ -18,8 +18,8 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.DefendingPlayerControlsSourceAttackingPredicate; import mage.filter.predicate.permanent.DefendingPlayerControlsSourceAttackingPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID; import java.util.UUID;
@ -51,7 +51,7 @@ public final class DecimatorBeetle extends CardImpl {
// Whenever Decimator Beetle attacks, remove a -1/-1 counter from target creature you control and put a -1/-1 counter on up to one target creature defending player controls. // Whenever Decimator Beetle attacks, remove a -1/-1 counter from target creature you control and put a -1/-1 counter on up to one target creature defending player controls.
ability = new AttacksTriggeredAbility(new DecimatorBeetleEffect(), false); ability = new AttacksTriggeredAbility(new DecimatorBeetleEffect(), false);
ability.addTarget(new TargetControlledCreaturePermanent()); ability.addTarget(new TargetControlledCreaturePermanent());
ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false)); ability.addTarget(new TargetPermanent(0, 1, filter));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -19,7 +19,7 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.token.TreasureToken; import mage.game.permanent.token.TreasureToken;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
@ -51,7 +51,7 @@ public final class DihadaBinderOfWills extends CardImpl {
ability.addEffect(new GainAbilityTargetEffect( ability.addEffect(new GainAbilityTargetEffect(
IndestructibleAbility.getInstance(), Duration.UntilYourNextTurn IndestructibleAbility.getInstance(), Duration.UntilYourNextTurn
).setText(", and indestructible until your next turn.")); ).setText(", and indestructible until your next turn."));
ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false)); ability.addTarget(new TargetPermanent(0, 1, filter));
this.addAbility(ability); this.addAbility(ability);
// -3: Reveal the top four cards of your library. // -3: Reveal the top four cards of your library.

View file

@ -1,7 +1,5 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import mage.abilities.effects.common.FightTargetsEffect; import mage.abilities.effects.common.FightTargetsEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -9,35 +7,31 @@ import mage.constants.CardType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.other.AnotherTargetPredicate; import mage.filter.predicate.other.AnotherTargetPredicate;
import mage.filter.predicate.permanent.BlockingPredicate; import mage.filter.predicate.permanent.BlockingPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class DissensionInTheRanks extends CardImpl { public final class DissensionInTheRanks extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("blocking creature"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("blocking creature");
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("another target blocking creature");
static { static {
filter.add(BlockingPredicate.instance); filter.add(BlockingPredicate.instance);
filter2.add(new AnotherTargetPredicate(2));
filter2.add(BlockingPredicate.instance);
} }
public DissensionInTheRanks(UUID ownerId, CardSetInfo setInfo) { public DissensionInTheRanks(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{R}{R}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{R}{R}");
// Target blocking creature fights another target blocking creature. // Target blocking creature fights another target blocking creature.
this.getSpellAbility().addEffect(new FightTargetsEffect(false)); this.getSpellAbility().addEffect(new FightTargetsEffect(false));
TargetCreaturePermanent target = new TargetCreaturePermanent(1, 1, filter, false); this.getSpellAbility().addTarget(new TargetPermanent(filter).setTargetTag(1));
target.setTargetTag(1); this.getSpellAbility().addTarget(new TargetPermanent(filter2).setTargetTag(2));
this.getSpellAbility().addTarget(target);
FilterCreaturePermanent filter2 = new FilterCreaturePermanent("another target blocking creature");
filter2.add(new AnotherTargetPredicate(2));
filter2.add(BlockingPredicate.instance);
TargetCreaturePermanent target2 = new TargetCreaturePermanent(filter2);
target2.setTargetTag(2);
this.getSpellAbility().addTarget(target2);
} }
private DissensionInTheRanks(final DissensionInTheRanks card) { private DissensionInTheRanks(final DissensionInTheRanks card) {

View file

@ -12,21 +12,20 @@ import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public final class DoOrDie extends CardImpl { public final class DoOrDie extends CardImpl {
public DoOrDie(UUID ownerId, CardSetInfo setInfo) { public DoOrDie(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{B}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}");
// Separate all creatures target player controls into two piles. Destroy all creatures in the pile of that player's choice. They can't be regenerated. // Separate all creatures target player controls into two piles. Destroy all creatures in the pile of that player's choice. They can't be regenerated.
this.getSpellAbility().addEffect(new DoOrDieEffect()); this.getSpellAbility().addEffect(new DoOrDieEffect());
@ -68,7 +67,7 @@ class DoOrDieEffect extends OneShotEffect {
} }
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures to put in the first pile"); FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures to put in the first pile");
filter.add(new ControllerIdPredicate(targetPlayer.getId())); filter.add(new ControllerIdPredicate(targetPlayer.getId()));
TargetCreaturePermanent creatures = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true); TargetPermanent creatures = new TargetPermanent(0, Integer.MAX_VALUE, filter, true);
List<Permanent> pile1 = new ArrayList<>(); List<Permanent> pile1 = new ArrayList<>();
if (player.choose(Outcome.Neutral, creatures, source, game)) { if (player.choose(Outcome.Neutral, creatures, source, game)) {
List<UUID> targets = creatures.getTargets(); List<UUID> targets = creatures.getTargets();

View file

@ -1,7 +1,5 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
@ -20,12 +18,13 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.AttackingPredicate; import mage.filter.predicate.permanent.AttackingPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.SecondTargetPointer; import mage.target.targetpointer.SecondTargetPointer;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class DomineeringWill extends CardImpl { public final class DomineeringWill extends CardImpl {
@ -37,13 +36,12 @@ public final class DomineeringWill extends CardImpl {
} }
public DomineeringWill(UUID ownerId, CardSetInfo setInfo) { public DomineeringWill(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}");
// Target player gains control of up to three target nonattacking creatures until end of turn. Untap those creatures. They block this turn if able. // Target player gains control of up to three target nonattacking creatures until end of turn. Untap those creatures. They block this turn if able.
this.getSpellAbility().addEffect(new DomineeringWillEffect()); this.getSpellAbility().addEffect(new DomineeringWillEffect());
this.getSpellAbility().addTarget(new TargetPlayer()); this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 3, filter, false)); this.getSpellAbility().addTarget(new TargetPermanent(0, 3, filter));
} }
private DomineeringWill(final DomineeringWill card) { private DomineeringWill(final DomineeringWill card) {

View file

@ -1,8 +1,5 @@
package mage.cards.d; package mage.cards.d;
import java.util.Objects;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -10,26 +7,24 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class Duneblast extends CardImpl { public final class Duneblast extends CardImpl {
public Duneblast(UUID ownerId, CardSetInfo setInfo) { public Duneblast(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{W}{B}{G}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{W}{B}{G}");
// Choose up to one creature. Destroy the rest. // Choose up to one creature. Destroy the rest.
this.getSpellAbility().addEffect(new DuneblastEffect()); this.getSpellAbility().addEffect(new DuneblastEffect());
} }
private Duneblast(final Duneblast card) { private Duneblast(final Duneblast card) {
@ -61,20 +56,22 @@ class DuneblastEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller == null) {
Target target = new TargetCreaturePermanent(0,1,new FilterCreaturePermanent("creature to keep"), true); return false;
target.setRequired(true);
Permanent creatureToKeep = null;
if (controller.choose(outcome, target, source, game)) {
creatureToKeep = game.getPermanent(target.getFirstTarget());
}
for(Permanent creature: game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, source.getControllerId(), source, game)) {
if (!Objects.equals(creature, creatureToKeep)) {
creature.destroy(source, game, false);
}
}
return true;
} }
return false; Target target = new TargetCreaturePermanent(0, 1);
target.withNotTarget(true);
target.withChooseHint("to keep");
target.setRequired(true);
controller.choose(outcome, target, source, game);
Permanent creatureToKeep = game.getPermanent(target.getFirstTarget());
for (Permanent creature : game.getBattlefield().getActivePermanents(
StaticFilters.FILTER_PERMANENT_CREATURES, source.getControllerId(), source, game
)) {
if (!creature.equals(creatureToKeep)) {
creature.destroy(source, game, false);
}
}
return true;
} }
} }

View file

@ -1,16 +1,16 @@
package mage.cards.f; package mage.cards.f;
import java.util.List; import mage.MageInt;
import java.util.UUID; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SagaAbility; import mage.abilities.common.SagaAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.constants.*;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate; import mage.filter.predicate.mageobject.PowerPredicate;
@ -18,11 +18,14 @@ import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetOpponent; import mage.target.common.TargetOpponent;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author weirddan455 * @author weirddan455
*/ */
public final class FallOfTheImpostor extends CardImpl { public final class FallOfTheImpostor extends CardImpl {
@ -77,33 +80,35 @@ class FallOfTheImpostorEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Player opponent = game.getPlayer(source.getFirstTarget()); Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
if (controller != null && opponent != null) { if (controller == null || opponent == null) {
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents( return false;
StaticFilters.FILTER_PERMANENT_CREATURE, opponent.getId(), game
);
Integer maxPower = null;
for (Permanent permanent : permanents) {
if (permanent != null) {
int power = permanent.getPower().getValue();
if (maxPower == null || power > maxPower) {
maxPower = power;
}
}
}
if (maxPower != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new ControllerIdPredicate(opponent.getId()));
filter.add(new PowerPredicate(ComparisonType.EQUAL_TO, maxPower));
TargetCreaturePermanent target = new TargetCreaturePermanent(1, 1, filter, true);
controller.chooseTarget(outcome, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
controller.moveCardsToExile(permanent, source, game, true, null, null);
return true;
}
}
} }
return false; List<Permanent> permanents = game.getBattlefield().getActivePermanents(
StaticFilters.FILTER_CONTROLLED_CREATURE, opponent.getId(), game
);
Permanent permanent;
switch (permanents.size()) {
case 0:
return false;
case 1:
permanent = permanents.get(0);
break;
default:
int power = permanents
.stream()
.map(MageObject::getPower)
.mapToInt(MageInt::getValue)
.max()
.orElse(Integer.MIN_VALUE);
FilterPermanent filter = new FilterCreaturePermanent();
filter.add(new ControllerIdPredicate(opponent.getId()));
filter.add(new PowerPredicate(ComparisonType.OR_GREATER, power));
TargetPermanent target = new TargetPermanent(filter);
target.withNotTarget(true);
controller.chooseTarget(outcome, target, source, game);
permanent = game.getPermanent(target.getFirstTarget());
}
return permanent != null && controller.moveCards(permanent, Zone.EXILED, source, game);
} }
} }

View file

@ -17,8 +17,8 @@ import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.UUID; import java.util.UUID;
@ -36,7 +36,7 @@ public final class FeralEncounter extends CardImpl {
DelayedTriggeredAbility delayed = new FeralEncounterDelayedTriggeredAbility(); DelayedTriggeredAbility delayed = new FeralEncounterDelayedTriggeredAbility();
delayed.addTarget(new TargetControlledCreaturePermanent()); delayed.addTarget(new TargetControlledCreaturePermanent());
delayed.addTarget(new TargetCreaturePermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, false)); delayed.addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL));
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(delayed)); this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(delayed));
} }

View file

@ -1,9 +1,9 @@
package mage.cards.f; package mage.cards.f;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.combat.CantAttackAllEffect; import mage.abilities.effects.common.combat.CantAttackAllEffect;
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
@ -18,7 +18,7 @@ import mage.filter.predicate.permanent.PermanentReferenceInCollectionPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -26,13 +26,12 @@ import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
*
* @author LevelX2 & L_J * @author LevelX2 & L_J
*/ */
public final class FightOrFlight extends CardImpl { public final class FightOrFlight extends CardImpl {
public FightOrFlight(UUID ownerId, CardSetInfo setInfo) { public FightOrFlight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{W}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
// At the beginning of combat on each opponents turn, separate all creatures that player controls into two piles. Only creatures in the pile of their choice can attack this turn. // At the beginning of combat on each opponents turn, separate all creatures that player controls into two piles. Only creatures in the pile of their choice can attack this turn.
this.addAbility(new BeginningOfCombatTriggeredAbility(TargetController.OPPONENT, new FightOrFlightEffect(), false)); this.addAbility(new BeginningOfCombatTriggeredAbility(TargetController.OPPONENT, new FightOrFlightEffect(), false));
@ -73,7 +72,7 @@ class FightOrFlightEffect extends OneShotEffect {
} }
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures to put in the first pile"); FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures to put in the first pile");
filter.add(new ControllerIdPredicate(targetPlayer.getId())); filter.add(new ControllerIdPredicate(targetPlayer.getId()));
TargetCreaturePermanent creatures = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true); TargetPermanent creatures = new TargetPermanent(0, Integer.MAX_VALUE, filter, true);
List<Permanent> pile1 = new ArrayList<>(); List<Permanent> pile1 = new ArrayList<>();
if (player.choose(Outcome.Neutral, creatures, source, game)) { if (player.choose(Outcome.Neutral, creatures, source, game)) {
List<UUID> targets = creatures.getTargets(); List<UUID> targets = creatures.getTargets();

View file

@ -10,12 +10,11 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.StaticFilters;
import mage.filter.predicate.other.AnotherTargetPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.util.functions.EmptyCopyApplier; import mage.util.functions.EmptyCopyApplier;
import java.util.UUID; import java.util.UUID;
@ -25,18 +24,14 @@ import java.util.UUID;
*/ */
public final class FleetingReflection extends CardImpl { public final class FleetingReflection extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("other target creature");
static {
filter.add(new AnotherTargetPredicate(2));
}
public FleetingReflection(UUID ownerId, CardSetInfo setInfo) { public FleetingReflection(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Target creature you control gains hexproof until end of turn. Untap that creature. Until end of turn, it becomes a copy of up to one other target creature. // Target creature you control gains hexproof until end of turn. Untap that creature. Until end of turn, it becomes a copy of up to one other target creature.
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent().setTargetTag(1)); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent().setTargetTag(1));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1, filter, false).setTargetTag(2)); this.getSpellAbility().addTarget(new TargetPermanent(
0, 1, StaticFilters.FILTER_ANOTHER_CREATURE_TARGET_2
).setTargetTag(2));
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(HexproofAbility.getInstance(), Duration.EndOfTurn)); this.getSpellAbility().addEffect(new GainAbilityTargetEffect(HexproofAbility.getInstance(), Duration.EndOfTurn));
this.getSpellAbility().addEffect(new UntapTargetEffect().setText("Untap that creature")); this.getSpellAbility().addEffect(new UntapTargetEffect().setText("Untap that creature"));
this.getSpellAbility().addEffect(new FleetingReflectionEffect()); this.getSpellAbility().addEffect(new FleetingReflectionEffect());

View file

@ -1,6 +1,5 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -13,7 +12,6 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.UnblockedPredicate; import mage.filter.predicate.permanent.UnblockedPredicate;
import mage.game.Game; import mage.game.Game;
@ -21,11 +19,12 @@ import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
*
* @author emerald000 * @author emerald000
*/ */
public final class Forcefield extends CardImpl { public final class Forcefield extends CardImpl {
@ -74,7 +73,7 @@ class ForcefieldEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game); MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) { if (controller != null && sourceObject != null) {
Target target = new TargetCreaturePermanent(1, 1, filter, true); Target target = new TargetPermanent(1, 1, filter, true);
if (controller.choose(Outcome.PreventDamage, target, source, game)) { if (controller.choose(Outcome.PreventDamage, target, source, game)) {
Permanent creature = game.getPermanent(target.getFirstTarget()); Permanent creature = game.getPermanent(target.getFirstTarget());
if (creature != null) { if (creature != null) {

View file

@ -2,22 +2,24 @@ package mage.cards.f;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SpellCastAllTriggeredAbility; import mage.abilities.common.SpellCastAllTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -35,9 +37,9 @@ public final class ForgottenAncient extends CardImpl {
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// Whenever a player casts a spell, you may put a +1/+1 counter on Forgotten Ancient. // Whenever a player casts a spell, you may put a +1/+1 counter on Forgotten Ancient.
Effect effect = new AddCountersSourceEffect(CounterType.P1P1.createInstance()); this.addAbility(new SpellCastAllTriggeredAbility(
Ability ability = new SpellCastAllTriggeredAbility(effect, true); new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true
this.addAbility(ability); ));
// At the beginning of your upkeep, you may move any number of +1/+1 counters from Forgotten Ancient onto other creatures. // At the beginning of your upkeep, you may move any number of +1/+1 counters from Forgotten Ancient onto other creatures.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ForgottenAncientEffect(), true)); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ForgottenAncientEffect(), true));
@ -56,7 +58,7 @@ public final class ForgottenAncient extends CardImpl {
class ForgottenAncientEffect extends OneShotEffect { class ForgottenAncientEffect extends OneShotEffect {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature"); private static final FilterPermanent filter = new FilterCreaturePermanent("another creature");
static { static {
filter.add(AnotherPredicate.instance); filter.add(AnotherPredicate.instance);
@ -98,7 +100,7 @@ class ForgottenAncientEffect extends OneShotEffect {
List<CounterMovement> counterMovements = new ArrayList<>(); List<CounterMovement> counterMovements = new ArrayList<>();
do { do {
Target target = new TargetCreaturePermanent(1, 1, filter, true); Target target = new TargetPermanent(1, 1, filter, true);
if (!target.canChoose(controller.getId(), source, game)) { if (!target.canChoose(controller.getId(), source, game)) {
break; break;
} }

View file

@ -1,8 +1,5 @@
package mage.cards.f; package mage.cards.f;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -14,7 +11,6 @@ import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -22,8 +18,11 @@ import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class Fumble extends CardImpl { public final class Fumble extends CardImpl {
@ -80,11 +79,12 @@ class FumbleEffect extends OneShotEffect {
} }
} }
} }
new ReturnToHandTargetEffect().apply(game, source); new ReturnToHandTargetEffect().apply(game, source);
if (!attachments.isEmpty()) { if (!attachments.isEmpty()) {
Target target = new TargetCreaturePermanent(1, 1, StaticFilters.FILTER_PERMANENT_CREATURE, true); Target target = new TargetCreaturePermanent();
target.withNotTarget(true);
Permanent newCreature = null; Permanent newCreature = null;
if (player.choose(Outcome.BoostCreature, target, source, game)) { if (player.choose(Outcome.BoostCreature, target, source, game)) {
newCreature = game.getPermanent(target.getFirstTarget()); newCreature = game.getPermanent(target.getFirstTarget());

View file

@ -15,7 +15,7 @@ import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
@ -45,10 +45,11 @@ public final class GargosViciousWatcher extends CardImpl {
this.addAbility(new SimpleStaticAbility(new SpellsCostReductionControllerEffect(filter, 4))); this.addAbility(new SimpleStaticAbility(new SpellsCostReductionControllerEffect(filter, 4)));
// Whenever a creature you control becomes the target of a spell, Gargos, Vicious Watcher fights up to one target creature you don't control. // Whenever a creature you control becomes the target of a spell, Gargos, Vicious Watcher fights up to one target creature you don't control.
TriggeredAbility ability = new BecomesTargetAnyTriggeredAbility(new FightTargetSourceEffect(), TriggeredAbility ability = new BecomesTargetAnyTriggeredAbility(
StaticFilters.FILTER_CONTROLLED_A_CREATURE, StaticFilters.FILTER_SPELL_A, new FightTargetSourceEffect(), StaticFilters.FILTER_CONTROLLED_A_CREATURE,
SetTargetPointer.NONE, false); StaticFilters.FILTER_SPELL_A, SetTargetPointer.NONE, false
ability.addTarget(new TargetCreaturePermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, false)); );
ability.addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -18,6 +18,7 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.TokenImpl;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -46,7 +47,7 @@ public final class GideonBattleForged extends CardImpl {
// +2: Up to one target creature an opponent controls attacks Gideon, Battle-Forged during its controller's next turn if able. // +2: Up to one target creature an opponent controls attacks Gideon, Battle-Forged during its controller's next turn if able.
LoyaltyAbility loyaltyAbility = new LoyaltyAbility(new GideonBattleForgedAttacksIfAbleTargetEffect(Duration.Custom), 2); LoyaltyAbility loyaltyAbility = new LoyaltyAbility(new GideonBattleForgedAttacksIfAbleTargetEffect(Duration.Custom), 2);
loyaltyAbility.addTarget(new TargetCreaturePermanent(0, 1, filter, false)); loyaltyAbility.addTarget(new TargetPermanent(0, 1, filter));
this.addAbility(loyaltyAbility); this.addAbility(loyaltyAbility);
// +1: Until your next turn, target creature gains indestructible. Untap that creature. // +1: Until your next turn, target creature gains indestructible. Untap that creature.

View file

@ -1,7 +1,5 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -12,17 +10,17 @@ import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.filter.StaticFilters; import mage.constants.SubType;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetOpponentsCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class GildedDrake extends CardImpl { public final class GildedDrake extends CardImpl {
@ -36,11 +34,12 @@ public final class GildedDrake extends CardImpl {
// Flying // Flying
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// When Gilded Drake enters the battlefield, exchange control of Gilded Drake and up to one target creature an opponent controls. If you don't make an exchange, sacrifice Gilded Drake. // When Gilded Drake enters the battlefield, exchange control of Gilded Drake and up to one target creature an opponent controls. If you don't make an exchange, sacrifice Gilded Drake.
// This ability can't be countered except by spells and abilities. // This ability can't be countered except by spells and abilities.
Ability ability = new EntersBattlefieldTriggeredAbility(new GildedDrakeEffect()); Ability ability = new EntersBattlefieldTriggeredAbility(new GildedDrakeEffect());
ability.setCanFizzle(false); ability.setCanFizzle(false);
ability.addTarget(new TargetCreaturePermanent(0, 1, StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE, false)); ability.addTarget(new TargetOpponentsCreaturePermanent(0, 1));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,8 +1,5 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ExileTargetEffect; import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.keyword.AftermathAbility; import mage.abilities.keyword.AftermathAbility;
@ -11,34 +8,40 @@ import mage.cards.SplitCard;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SpellAbilityType; import mage.constants.SpellAbilityType;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class GrindDust extends SplitCard { public final class GrindDust extends SplitCard {
private static final FilterPermanent filter = new FilterCreaturePermanent("creatures that have -1/-1 counters on them");
static {
filter.add(CounterType.M1M1.getPredicate());
}
public GrindDust(UUID ownerId, CardSetInfo setInfo) { public GrindDust(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, new CardType[]{CardType.SORCERY}, "{1}{B}", "{3}{W}", SpellAbilityType.SPLIT_AFTERMATH); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, new CardType[]{CardType.SORCERY}, "{1}{B}", "{3}{W}", SpellAbilityType.SPLIT_AFTERMATH);
// Grind // Grind
// Put a -1/-1 counter on each of up to two target creatures. // Put a -1/-1 counter on each of up to two target creatures.
Effect effect = new AddCountersTargetEffect(CounterType.M1M1.createInstance()); this.getLeftHalfCard().getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.M1M1.createInstance())
effect.setText("Put a -1/-1 counter on each of up to two target creatures"); .setText("Put a -1/-1 counter on each of up to two target creatures"));
getLeftHalfCard().getSpellAbility().addEffect(effect); this.getLeftHalfCard().getSpellAbility().addTarget(new TargetCreaturePermanent(0, 2));
getLeftHalfCard().getSpellAbility().addTarget(new TargetCreaturePermanent(0, 2));
// Dust // Dust
// Aftermath // Aftermath
getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true)); this.getRightHalfCard().addAbility(new AftermathAbility().setRuleAtTheTop(true));
// Exile any number of target creatures that have -1/-1 counters on them.
getRightHalfCard().getSpellAbility().addEffect(new ExileTargetEffect());
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures that have -1/-1 counters on them");
filter.add(CounterType.M1M1.getPredicate());
getRightHalfCard().getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, false));
// Exile any number of target creatures that have -1/-1 counters on them.
this.getRightHalfCard().getSpellAbility().addEffect(new ExileTargetEffect());
this.getRightHalfCard().getSpellAbility().addTarget(new TargetPermanent(0, Integer.MAX_VALUE, filter));
} }
private GrindDust(final GrindDust card) { private GrindDust(final GrindDust card) {

View file

@ -1,7 +1,5 @@
package mage.cards.h; package mage.cards.h;
import java.util.UUID;
import mage.abilities.effects.common.DamageAllEffect; import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.effects.common.continuous.SetBasePowerToughnessTargetEffect; import mage.abilities.effects.common.continuous.SetBasePowerToughnessTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -9,41 +7,33 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent; import mage.target.TargetPermanent;
import mage.filter.predicate.other.AnotherTargetPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.SecondTargetPointer; import mage.target.targetpointer.SecondTargetPointer;
import java.util.UUID;
/** /**
*
* @author weirddan455 * @author weirddan455
*/ */
public final class HostileTakeover extends CardImpl { public final class HostileTakeover extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("other target creature");
static {
filter.add(new AnotherTargetPredicate(2));
}
public HostileTakeover(UUID ownerId, CardSetInfo setInfo) { public HostileTakeover(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}{B}{R}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}{B}{R}");
// Up to one target creature has base power and toughness 1/1 until end of turn. Up to one other target creature has base power and toughness 4/4 until end of turn. Then Hostile Takeover deals 3 damage to each creature. // Up to one target creature has base power and toughness 1/1 until end of turn. Up to one other target creature has base power and toughness 4/4 until end of turn. Then Hostile Takeover deals 3 damage to each creature.
this.getSpellAbility().addEffect(new SetBasePowerToughnessTargetEffect(1, 1, Duration.EndOfTurn)); this.getSpellAbility().addEffect(new SetBasePowerToughnessTargetEffect(1, 1, Duration.EndOfTurn));
TargetCreaturePermanent target1 = new TargetCreaturePermanent(0, 1); this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1).setTargetTag(1).withChooseHint("1/1"));
target1.setTargetTag(1);
this.getSpellAbility().addTarget(target1.withChooseHint("1/1"));
this.getSpellAbility().addEffect(new SetBasePowerToughnessTargetEffect(4, 4, Duration.EndOfTurn) this.getSpellAbility().addEffect(new SetBasePowerToughnessTargetEffect(4, 4, Duration.EndOfTurn)
.setTargetPointer(new SecondTargetPointer()) .setTargetPointer(new SecondTargetPointer())
.setText("up to one other target creature has base power and toughness 4/4 until end of turn")); .setText("up to one other target creature has base power and toughness 4/4 until end of turn"));
TargetCreaturePermanent target2 = new TargetCreaturePermanent(0, 1, filter, false); this.getSpellAbility().addTarget(new TargetPermanent(
target2.setTargetTag(2); 0, 1, StaticFilters.FILTER_ANOTHER_CREATURE_TARGET_2
this.getSpellAbility().addTarget(target2.withChooseHint("4/4")); ).setTargetTag(2).withChooseHint("4/4"));
this.getSpellAbility().addEffect(new DamageAllEffect(
this.getSpellAbility().addEffect(new DamageAllEffect(3, StaticFilters.FILTER_PERMANENT_CREATURE) 3, StaticFilters.FILTER_PERMANENT_CREATURE
.concatBy("Then")); ).concatBy("Then"));
} }
private HostileTakeover(final HostileTakeover card) { private HostileTakeover(final HostileTakeover card) {

View file

@ -7,10 +7,16 @@ import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -20,14 +26,8 @@ import java.util.UUID;
*/ */
public final class HuatliDinosaurKnight extends CardImpl { public final class HuatliDinosaurKnight extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Dinosaur you control"); private static final FilterPermanent filter = new FilterControlledPermanent(SubType.DINOSAUR);
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("Dinosaurs"); private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent(SubType.DINOSAUR, "Dinosaurs");
static {
filter.add(SubType.DINOSAUR.getPredicate());
filter.add(TargetController.YOU.getControllerPredicate());
filter2.add(SubType.DINOSAUR.getPredicate());
}
public HuatliDinosaurKnight(UUID ownerId, CardSetInfo setInfo) { public HuatliDinosaurKnight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{R}{W}"); super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{R}{W}");
@ -41,12 +41,12 @@ public final class HuatliDinosaurKnight extends CardImpl {
Ability ability = new LoyaltyAbility(new AddCountersTargetEffect(CounterType.P1P1.createInstance(2)) Ability ability = new LoyaltyAbility(new AddCountersTargetEffect(CounterType.P1P1.createInstance(2))
.setText("Put two +1/+1 counters on up to one target Dinosaur you control."), 2 .setText("Put two +1/+1 counters on up to one target Dinosaur you control."), 2
); );
ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false)); ability.addTarget(new TargetPermanent(0, 1, filter));
this.addAbility(ability); this.addAbility(ability);
// -3: Target Dinosaur you control deals damage equal to its power to target creature you don't control. // -3: Target Dinosaur you control deals damage equal to its power to target creature you don't control.
ability = new LoyaltyAbility(new DamageWithPowerFromOneToAnotherTargetEffect(), -3); ability = new LoyaltyAbility(new DamageWithPowerFromOneToAnotherTargetEffect(), -3);
ability.addTarget(new TargetCreaturePermanent(filter)); ability.addTarget(new TargetPermanent(filter));
ability.addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL)); ability.addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL));
this.addAbility(ability); this.addAbility(ability);

View file

@ -3,26 +3,26 @@ package mage.cards.i;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CopyEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect; import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.filter.predicate.permanent.TokenPredicate; import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
import java.util.UUID; import java.util.UUID;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.common.CopyEffect;
import mage.util.CardUtil;
/** /**
* @author spjspj * @author spjspj
@ -32,6 +32,7 @@ public final class IdentityThief extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("target nontoken creature"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("target nontoken creature");
static { static {
filter.add(AnotherPredicate.instance);
filter.add(TokenPredicate.FALSE); filter.add(TokenPredicate.FALSE);
} }
@ -44,8 +45,8 @@ public final class IdentityThief extends CardImpl {
// Whenever Identity Thief attacks, you may exile another target nontoken creature. // Whenever Identity Thief attacks, you may exile another target nontoken creature.
// If you do, Identity Thief becomes a copy of that creature until end of turn. // If you do, Identity Thief becomes a copy of that creature until end of turn.
// Return the exiled card to the battlefield under its owner's control at the beginning of the next end step. // Return the exiled card to the battlefield under its owner's control at the beginning of the next end step.
Ability ability = new IdentityThiefAbility(); Ability ability = new AttacksTriggeredAbility(new IdentityThiefEffect(), true);
ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false)); ability.addTarget(new TargetPermanent(0, 1, filter));
this.addAbility(ability); this.addAbility(ability);
} }
@ -101,26 +102,28 @@ class IdentityThiefEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent targetPermanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (controller != null if (controller == null || targetPermanent == null) {
&& targetPermanent != null return false;
&& sourcePermanent != null) {
ContinuousEffect copyEffect = new CopyEffect(Duration.EndOfTurn, targetPermanent, source.getSourceId());
copyEffect.setTargetPointer(new FixedTarget(sourcePermanent.getId(), game));
game.addEffect(copyEffect, source);
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
if (controller.moveCardsToExile(targetPermanent, source, game, true, exileZoneId, sourcePermanent.getName())) {
Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, true);
effect.setText("Return the exiled card to the battlefield under its owner's control at the beginning of the next end step");
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);
}
return true;
} }
return false; controller.moveCardsToExile(
targetPermanent, source, game, true,
CardUtil.getExileZoneId(game, source),
CardUtil.getSourceName(game, source)
);
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, true)
.setText("Return the exiled card to the battlefield under its owner's control at the beginning of the next end step")
.setTargetPointer(new FixedTarget(source.getFirstTarget(), game))
), source);
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
if (sourcePermanent != null) {
game.addEffect(new CopyEffect(
Duration.EndOfTurn, targetPermanent, source.getSourceId()
).setTargetPointer(new FixedTarget(sourcePermanent.getId(), game)), source);
}
return true;
} }
@Override @Override

View file

@ -14,6 +14,7 @@ import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicate; import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
@ -23,6 +24,7 @@ import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.Target; import mage.target.Target;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetadjustment.XTargetsCountAdjuster; import mage.target.targetadjustment.XTargetsCountAdjuster;
@ -34,7 +36,7 @@ import java.util.UUID;
*/ */
public final class IllithidHarvester extends AdventureCard { public final class IllithidHarvester extends AdventureCard {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("tapped nontoken creatures"); private static final FilterPermanent filter = new FilterCreaturePermanent("tapped nontoken creatures");
static { static {
filter.add(TappedPredicate.TAPPED); filter.add(TappedPredicate.TAPPED);
@ -50,7 +52,7 @@ public final class IllithidHarvester extends AdventureCard {
// Ceremorphosis When Illithid Harvester enters the battlefield, turn any number // Ceremorphosis When Illithid Harvester enters the battlefield, turn any number
// of target tapped nontoken creatures face down. They're 2/2 Horror creatures. // of target tapped nontoken creatures face down. They're 2/2 Horror creatures.
Ability ability = new EntersBattlefieldTriggeredAbility(new IllithidHarvesterEffect()); Ability ability = new EntersBattlefieldTriggeredAbility(new IllithidHarvesterEffect());
ability.addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, false)); ability.addTarget(new TargetPermanent(0, Integer.MAX_VALUE, filter));
this.addAbility(ability.withFlavorWord("Ceremorphosis")); this.addAbility(ability.withFlavorWord("Ceremorphosis"));
// Plant Tadpoles // Plant Tadpoles

View file

@ -1,40 +1,36 @@
package mage.cards.i; package mage.cards.i;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.common.SourceOnBattlefieldCondition; import mage.abilities.costs.Cost;
import mage.abilities.condition.common.SourceRemainsInZoneCondition; import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SacrificeControllerEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect; import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetOpponent; import mage.target.common.TargetOpponent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class InfernalDenizen extends CardImpl { public final class InfernalDenizen extends CardImpl {
@ -50,11 +46,11 @@ public final class InfernalDenizen extends CardImpl {
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new InfernalDenizenEffect())); this.addAbility(new BeginningOfUpkeepTriggeredAbility(new InfernalDenizenEffect()));
// {tap}: Gain control of target creature for as long as Infernal Denizen remains on the battlefield. // {tap}: Gain control of target creature for as long as Infernal Denizen remains on the battlefield.
ConditionalContinuousEffect effect = new ConditionalContinuousEffect( Ability ability = new SimpleActivatedAbility(
new GainControlTargetEffect(Duration.Custom, true), new GainControlTargetEffect(Duration.UntilSourceLeavesBattlefield, true)
new SourceRemainsInZoneCondition(Zone.BATTLEFIELD), .setText("gain control of target creature for as long as {this} remains on the battlefield"),
"gain control of target creature for as long as {this} remains on the battlefield"); new TapSourceCost()
Ability ability = new SimpleActivatedAbility(effect, new TapSourceCost()); );
ability.addTarget(new TargetCreaturePermanent()); ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability); this.addAbility(ability);
} }
@ -71,12 +67,7 @@ public final class InfernalDenizen extends CardImpl {
class InfernalDenizenEffect extends OneShotEffect { class InfernalDenizenEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterPermanent(); private static final FilterPermanent filter = new FilterControlledPermanent(SubType.SWAMP);
static {
filter.add(SubType.SWAMP.getPredicate());
filter.add(TargetController.YOU.getControllerPredicate());
}
InfernalDenizenEffect() { InfernalDenizenEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
@ -96,41 +87,36 @@ class InfernalDenizenEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanent(source.getSourceId()); Cost cost = new SacrificeTargetCost(filter);
Player player = game.getPlayer(source.getControllerId()); if (cost.canPay(source, source, source.getControllerId(), game)
if (player != null) { && cost.pay(source, game, source, source.getControllerId(), true)) {
DynamicValue swamps = new PermanentsOnBattlefieldCount(filter); return true;
boolean canSac = swamps.calculate(game, source, this) > 1;
Effect effect = new SacrificeControllerEffect(filter, 2, "Sacrifice two Swamps");
effect.apply(game, source);
if (!canSac) {
if (creature != null) {
creature.tap(source, game);
}
TargetOpponent targetOpp = new TargetOpponent(true);
if (targetOpp.canChoose(player.getId(), source, game)
&& targetOpp.choose(Outcome.Detriment, player.getId(), source.getSourceId(), source, game)) {
Player opponent = game.getPlayer(targetOpp.getFirstTarget());
if (opponent != null) {
FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature controlled by " + player.getLogName());
filter2.add(new ControllerIdPredicate(player.getId()));
TargetCreaturePermanent targetCreature = new TargetCreaturePermanent(1, 1, filter2, true);
targetCreature.setTargetController(opponent.getId());
if (targetCreature.canChoose(source.getControllerId(), source, game)
&& opponent.chooseUse(Outcome.GainControl, "Gain control of a creature?", source, game)
&& opponent.chooseTarget(Outcome.GainControl, targetCreature, source, game)) {
ConditionalContinuousEffect giveEffect = new ConditionalContinuousEffect(
new GainControlTargetEffect(Duration.Custom, true, opponent.getId()),
SourceOnBattlefieldCondition.instance,
"");
giveEffect.setTargetPointer(new FixedTarget(targetCreature.getFirstTarget(), game));
game.addEffect(giveEffect, source);
return true;
}
}
}
}
} }
return false; Permanent creature = source.getSourcePermanentIfItStillExists(game);
if (creature == null) {
return false;
}
creature.tap(source, game);
TargetPlayer targetPlayer = new TargetOpponent(true);
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return true;
}
player.choose(outcome, targetPlayer, source, game);
Player opponent = game.getPlayer(targetPlayer.getFirstTarget());
if (opponent == null) {
return true;
}
FilterPermanent filterPermanent = new FilterCreaturePermanent("creature controlled by " + player.getName());
filterPermanent.add(new ControllerIdPredicate(player.getId()));
TargetPermanent target = new TargetPermanent(0, 1, filterPermanent, true);
opponent.choose(outcome, target, source, game);
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
game.addEffect(new GainControlTargetEffect(
Duration.UntilSourceLeavesBattlefield, true, opponent.getId()
).setTargetPointer(new FixedTarget(permanent, game)), source);
}
return true;
} }
} }

View file

@ -1,7 +1,5 @@
package mage.cards.j; package mage.cards.j;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility; import mage.abilities.LoyaltyAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
@ -10,14 +8,15 @@ import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class JaceIngeniousMindMage extends CardImpl { public final class JaceIngeniousMindMage extends CardImpl {
@ -38,7 +37,7 @@ public final class JaceIngeniousMindMage extends CardImpl {
// -9: Gain control of up to three target creatures. // -9: Gain control of up to three target creatures.
Ability ability = new LoyaltyAbility(new GainControlTargetEffect(Duration.Custom), -9); Ability ability = new LoyaltyAbility(new GainControlTargetEffect(Duration.Custom), -9);
ability.addTarget(new TargetCreaturePermanent(0, 3, StaticFilters.FILTER_PERMANENT_CREATURES, false)); ability.addTarget(new TargetCreaturePermanent(0, 3));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -15,7 +15,7 @@ import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
@ -67,7 +67,7 @@ class JaddiLifestriderEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int tappedAmount = 0; int tappedAmount = 0;
Player you = game.getPlayer(source.getControllerId()); Player you = game.getPlayer(source.getControllerId());
TargetCreaturePermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true); TargetPermanent target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true);
if (target.canChoose(source.getControllerId(), source, game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), source, game)) { if (target.canChoose(source.getControllerId(), source, game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), source, game)) {
for (UUID creatureId : target.getTargets()) { for (UUID creatureId : target.getTargets()) {
Permanent creature = game.getPermanent(creatureId); Permanent creature = game.getPermanent(creatureId);

View file

@ -1,16 +1,14 @@
package mage.cards.j; package mage.cards.j;
import java.util.UUID;
import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author LoneFox * @author LoneFox
*/ */
public final class JaggedLightning extends CardImpl { public final class JaggedLightning extends CardImpl {
@ -20,7 +18,7 @@ public final class JaggedLightning extends CardImpl {
// Jagged Lightning deals 3 damage to each of two target creatures. // Jagged Lightning deals 3 damage to each of two target creatures.
this.getSpellAbility().addEffect(new DamageTargetEffect(3, true, "each of two target creatures")); this.getSpellAbility().addEffect(new DamageTargetEffect(3, true, "each of two target creatures"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2, 2, StaticFilters.FILTER_PERMANENT_CREATURE, false)); this.getSpellAbility().addTarget(new TargetCreaturePermanent(2));
} }
private JaggedLightning(final JaggedLightning card) { private JaggedLightning(final JaggedLightning card) {

View file

@ -1,7 +1,6 @@
package mage.cards.j; package mage.cards.j;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
@ -15,10 +14,11 @@ import mage.constants.Duration;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author Styxo * @author Styxo
*/ */
public final class JediStarfighter extends CardImpl { public final class JediStarfighter extends CardImpl {
@ -27,11 +27,11 @@ public final class JediStarfighter extends CardImpl {
static { static {
filter.add(SubType.JEDI.getPredicate()); filter.add(SubType.JEDI.getPredicate());
filter.add(TargetController.YOU.getControllerPredicate()); filter.add(TargetController.YOU.getControllerPredicate());
} }
public JediStarfighter(UUID ownerId, CardSetInfo setInfo) { public JediStarfighter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{2}{W}{W}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}{W}{W}");
this.subtype.add(SubType.JEDI); this.subtype.add(SubType.JEDI);
this.subtype.add(SubType.STARSHIP); this.subtype.add(SubType.STARSHIP);
this.power = new MageInt(2); this.power = new MageInt(2);
@ -42,7 +42,7 @@ public final class JediStarfighter extends CardImpl {
// When Jedi Starfighter enters the battlefield, up to two Jedi creatures you control gain spaceflight until end of turn. // When Jedi Starfighter enters the battlefield, up to two Jedi creatures you control gain spaceflight until end of turn.
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect(SpaceflightAbility.getInstance(), Duration.EndOfTurn)); EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect(SpaceflightAbility.getInstance(), Duration.EndOfTurn));
ability.addTarget(new TargetCreaturePermanent(0, 2, filter, true)); ability.addTarget(new TargetPermanent(0, 2, filter, true));
this.addAbility(ability); this.addAbility(ability);
// Meditate {1}{W} // Meditate {1}{W}

View file

@ -1,7 +1,5 @@
package mage.cards.j; package mage.cards.j;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -11,13 +9,13 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public final class JoragaAuxiliary extends CardImpl { public final class JoragaAuxiliary extends CardImpl {
@ -29,7 +27,7 @@ public final class JoragaAuxiliary extends CardImpl {
} }
public JoragaAuxiliary(UUID ownerId, CardSetInfo setInfo) { public JoragaAuxiliary(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{W}");
this.subtype.add(SubType.ELF); this.subtype.add(SubType.ELF);
this.subtype.add(SubType.SOLDIER); this.subtype.add(SubType.SOLDIER);
this.subtype.add(SubType.ALLY); this.subtype.add(SubType.ALLY);
@ -38,7 +36,7 @@ public final class JoragaAuxiliary extends CardImpl {
// {4}{G}{W}: Support 2. (Put a +1/+1 counter on each of up to two other target creatures.) // {4}{G}{W}: Support 2. (Put a +1/+1 counter on each of up to two other target creatures.)
Ability ability = new SimpleActivatedAbility(new SupportEffect(this, 2, true), new ManaCostsImpl<>("{4}{G}{W}")); Ability ability = new SimpleActivatedAbility(new SupportEffect(this, 2, true), new ManaCostsImpl<>("{4}{G}{W}"));
ability.addTarget(new TargetCreaturePermanent(0, 2, filter, false)); ability.addTarget(new TargetPermanent(0, 2, filter));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,24 +1,24 @@
package mage.cards.j; package mage.cards.j;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.constants.SubType; import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class JubilantMascot extends CardImpl { public final class JubilantMascot extends CardImpl {
@ -43,7 +43,7 @@ public final class JubilantMascot extends CardImpl {
.setText("support 2"), .setText("support 2"),
new ManaCostsImpl<>("{3}{W}") new ManaCostsImpl<>("{3}{W}")
)); ));
ability.addTarget(new TargetCreaturePermanent(0, 2, filter, false)); ability.addTarget(new TargetPermanent(0, 2, filter));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -13,7 +13,6 @@ import mage.abilities.effects.common.discard.DiscardEachPlayerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
@ -27,8 +26,6 @@ import java.util.UUID;
*/ */
public final class KayaGhostAssassin extends CardImpl { public final class KayaGhostAssassin extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("target creature to exile. Choose no targets to exile Kaya.");
public KayaGhostAssassin(UUID ownerId, CardSetInfo setInfo) { public KayaGhostAssassin(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{B}"); super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{B}");
this.supertype.add(SuperType.LEGENDARY); this.supertype.add(SuperType.LEGENDARY);
@ -39,21 +36,17 @@ public final class KayaGhostAssassin extends CardImpl {
// 0: Exile Kaya, Ghost Assassin or up to one target creature. Return that card to the battlefield under its owner's control at the beginning of your next upkeep. // 0: Exile Kaya, Ghost Assassin or up to one target creature. Return that card to the battlefield under its owner's control at the beginning of your next upkeep.
// You lose 2 life. // You lose 2 life.
Ability ability = new LoyaltyAbility(new KayaGhostAssassinEffect(), 0); Ability ability = new LoyaltyAbility(new KayaGhostAssassinEffect(), 0);
ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false)); ability.addTarget(new TargetCreaturePermanent(0, 1).withChooseHint("Choose no targets to exile Kaya"));
this.addAbility(ability); this.addAbility(ability);
// -1: Each opponent loses 2 life and you gain 2 life. // -1: Each opponent loses 2 life and you gain 2 life.
ability = new LoyaltyAbility(new LoseLifeOpponentsEffect(2), -1); ability = new LoyaltyAbility(new LoseLifeOpponentsEffect(2), -1);
Effect effect = new GainLifeEffect(2); ability.addEffect(new GainLifeEffect(2).setText("and you gain 2 life"));
effect.setText("and you gain 2 life");
ability.addEffect(effect);
this.addAbility(ability); this.addAbility(ability);
// -2: Each opponent discards a card and you draw a card. // -2: Each opponent discards a card and you draw a card.
ability = new LoyaltyAbility(new DiscardEachPlayerEffect(TargetController.OPPONENT), -2); ability = new LoyaltyAbility(new DiscardEachPlayerEffect(TargetController.OPPONENT), -2);
effect = new DrawCardSourceControllerEffect(1); ability.addEffect(new DrawCardSourceControllerEffect(1).setText("and you draw a card"));
effect.setText("and you draw a card");
ability.addEffect(effect);
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,6 +1,5 @@
package mage.cards.k; package mage.cards.k;
import mage.MageObject;
import mage.MageObjectReference; import mage.MageObjectReference;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility; import mage.abilities.LoyaltyAbility;
@ -22,21 +21,20 @@ import mage.game.Game;
import mage.game.command.emblems.KayaTheInexorableEmblem; import mage.game.command.emblems.KayaTheInexorableEmblem;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent; import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.SpiritWhiteToken; import mage.game.permanent.token.SpiritWhiteToken;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetNonlandPermanent; import mage.target.common.TargetNonlandPermanent;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author weirddan455 * @author weirddan455
*/ */
public final class KayaTheInexorable extends CardImpl { public final class KayaTheInexorable extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nontoken creature"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nontoken creature");
static { static {
filter.add(TokenPredicate.FALSE); filter.add(TokenPredicate.FALSE);
} }
@ -52,7 +50,7 @@ public final class KayaTheInexorable extends CardImpl {
LoyaltyAbility ability = new LoyaltyAbility(new AddCountersTargetEffect(CounterType.GHOSTFORM.createInstance()), 1); LoyaltyAbility ability = new LoyaltyAbility(new AddCountersTargetEffect(CounterType.GHOSTFORM.createInstance()), 1);
ability.addEffect(new GainAbilityTargetEffect(new KayaTheInexorableTriggeredAbility(), Duration.WhileOnBattlefield, ability.addEffect(new GainAbilityTargetEffect(new KayaTheInexorableTriggeredAbility(), Duration.WhileOnBattlefield,
"It gains \"When this creature dies or is put into exile, return it to its owner's hand and create a 1/1 white Spirit creature token with flying.\"")); "It gains \"When this creature dies or is put into exile, return it to its owner's hand and create a 1/1 white Spirit creature token with flying.\""));
ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false)); ability.addTarget(new TargetPermanent(0, 1, filter));
this.addAbility(ability); this.addAbility(ability);
// 3: Exile target nonland permanent. // 3: Exile target nonland permanent.

View file

@ -6,7 +6,6 @@ import mage.abilities.common.AttacksEachCombatStaticAbility;
import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount; import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.TapTargetEffect; import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.FirstStrikeAbility;
@ -23,7 +22,7 @@ import mage.filter.predicate.permanent.DefendingPlayerControlsSourceAttackingPre
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
@ -58,11 +57,9 @@ public final class KyloRen extends CardImpl {
// Whenever Kylo Ren attacks, it gets +1/+0 for each creature in your graveyard and you may tap target creature defending player controls. // Whenever Kylo Ren attacks, it gets +1/+0 for each creature in your graveyard and you may tap target creature defending player controls.
CardsInControllerGraveyardCount value = new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_CREATURE); CardsInControllerGraveyardCount value = new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_CREATURE);
Effect effect = new BoostSourceEffect(value, StaticValue.get(0), Duration.WhileOnBattlefield); Ability ability = new AttacksTriggeredAbility(new BoostSourceEffect(value, StaticValue.get(0), Duration.WhileOnBattlefield).setText("it gets +1/+0 for each creature in your graveyard"));
effect.setText("it gets +1/+0 for each creature in your graveyard");
Ability ability = new AttacksTriggeredAbility(effect, false);
ability.addEffect(new KyloRenTapTargetEffect()); ability.addEffect(new KyloRenTapTargetEffect());
ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false)); ability.addTarget(new TargetPermanent(0, 1, filter));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -10,13 +10,15 @@ import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.filter.common.FilterCreaturePermanent; import mage.constants.Duration;
import mage.filter.predicate.permanent.TappedPredicate; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.SoldierLifelinkToken; import mage.game.permanent.token.SoldierLifelinkToken;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
@ -57,13 +59,6 @@ public final class LedevChampion extends CardImpl {
class LedevChampionEffect extends OneShotEffect { class LedevChampionEffect extends OneShotEffect {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("untapped creatures you control");
static {
filter.add(TargetController.YOU.getControllerPredicate());
filter.add(TappedPredicate.UNTAPPED);
}
public LedevChampionEffect() { public LedevChampionEffect() {
super(Outcome.GainLife); super(Outcome.GainLife);
staticText = "you may tap any number of untapped creatures you control. " staticText = "you may tap any number of untapped creatures you control. "
@ -76,16 +71,14 @@ class LedevChampionEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
TargetPermanent target = new TargetPermanent(0, Integer.MAX_VALUE, StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURES, true);
target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), source, game);
int tappedAmount = 0; int tappedAmount = 0;
TargetCreaturePermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true); for (UUID creatureId : target.getTargets()) {
if (target.canChoose(source.getControllerId(), source, game) Permanent creature = game.getPermanent(creatureId);
&& target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), source, game)) { if (creature != null) {
for (UUID creatureId : target.getTargets()) { creature.tap(source, game);
Permanent creature = game.getPermanent(creatureId); tappedAmount++;
if (creature != null) {
creature.tap(source, game);
tappedAmount++;
}
} }
} }
if (tappedAmount > 0) { if (tappedAmount > 0) {

View file

@ -44,7 +44,7 @@ public final class LilianaTheNecromancer extends CardImpl {
// 7: Destroy up to two target creatures. Put up to two creature cards from graveyards onto the battlefield under your control. // 7: Destroy up to two target creatures. Put up to two creature cards from graveyards onto the battlefield under your control.
ability = new LoyaltyAbility(new DestroyTargetEffect(), -7); ability = new LoyaltyAbility(new DestroyTargetEffect(), -7);
ability.addTarget(new TargetCreaturePermanent(0, 2, StaticFilters.FILTER_PERMANENT_CREATURES, false)); ability.addTarget(new TargetCreaturePermanent(0, 2));
ability.addEffect(new LilianaTheNecromancerEffect()); ability.addEffect(new LilianaTheNecromancerEffect());
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -5,6 +5,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.SecondTargetPointer; import mage.target.targetpointer.SecondTargetPointer;
@ -18,12 +19,11 @@ public final class MabelsMettle extends CardImpl {
public MabelsMettle(UUID ownerId, CardSetInfo setInfo) { public MabelsMettle(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
// Target creature gets +2/+2 until end of turn. Up to one other target creature gets +1/+1 until end of turn. // Target creature gets +2/+2 until end of turn. Up to one other target creature gets +1/+1 until end of turn.
this.getSpellAbility().addEffect(new BoostTargetEffect(2, 2)); this.getSpellAbility().addEffect(new BoostTargetEffect(2, 2));
this.getSpellAbility().addTarget(new TargetCreaturePermanent().setTargetTag(1)); this.getSpellAbility().addTarget(new TargetCreaturePermanent().setTargetTag(1));
this.getSpellAbility().addEffect(new BoostTargetEffect(1, 1).setTargetPointer(new SecondTargetPointer())); this.getSpellAbility().addEffect(new BoostTargetEffect(1, 1).setTargetPointer(new SecondTargetPointer()));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1, StaticFilters.FILTER_ANOTHER_CREATURE_TARGET_2, false).setTargetTag(2)); this.getSpellAbility().addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_ANOTHER_CREATURE_TARGET_2).setTargetTag(2));
} }
private MabelsMettle(final MabelsMettle card) { private MabelsMettle(final MabelsMettle card) {

View file

@ -17,7 +17,7 @@ import mage.constants.SuperType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
@ -52,7 +52,7 @@ public final class MarthaJones extends CardImpl {
); );
ability.addEffect(new CantBeBlockedTargetEffect() ability.addEffect(new CantBeBlockedTargetEffect()
.setText("and up to one other target creature can't be blocked this turn")); .setText("and up to one other target creature can't be blocked this turn"));
ability.addTarget(new TargetCreaturePermanent(0, 1, filterOther, false)); ability.addTarget(new TargetPermanent(0, 1, filterOther));
this.addAbility(ability); this.addAbility(ability);
// Doctor's companion // Doctor's companion

View file

@ -1,11 +1,9 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility; import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility;
import mage.constants.SubType;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureAllEffect; import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureAllEffect;
@ -14,6 +12,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicate; import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
@ -21,10 +20,11 @@ import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.permanent.PermanentIdPredicate; import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class MasterOfTheVeil extends CardImpl { public final class MasterOfTheVeil extends CardImpl {
@ -48,7 +48,7 @@ public final class MasterOfTheVeil extends CardImpl {
// When Master of the Veil is turned face up, you may turn target creature with a morph ability face down. // When Master of the Veil is turned face up, you may turn target creature with a morph ability face down.
Ability ability = new TurnedFaceUpSourceTriggeredAbility(new MasterOfTheVeilEffect(), false, true); Ability ability = new TurnedFaceUpSourceTriggeredAbility(new MasterOfTheVeilEffect(), false, true);
ability.addTarget(new TargetCreaturePermanent(1, 1, filter, false)); ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -21,7 +21,7 @@ import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import mage.watchers.common.ControlCombatRedundancyWatcher; import mage.watchers.common.ControlCombatRedundancyWatcher;
@ -107,7 +107,7 @@ class MasterWarcraftChooseAttackersEffect extends ContinuousRuleModifyingEffectI
if (controller == null || attackingPlayer == null || attackingPlayer.getAvailableAttackers(game).isEmpty()) { if (controller == null || attackingPlayer == null || attackingPlayer.getAvailableAttackers(game).isEmpty()) {
return false; // the attack declaration resumes for the active player as normal return false; // the attack declaration resumes for the active player as normal
} }
Target target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true); Target target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true);
if (!controller.chooseTarget(Outcome.Benefit, target, source, game)) { if (!controller.chooseTarget(Outcome.Benefit, target, source, game)) {
return false; // the attack declaration resumes for the active player as normal return false; // the attack declaration resumes for the active player as normal
} }

View file

@ -1,16 +1,15 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class MischiefAndMayhem extends CardImpl { public final class MischiefAndMayhem extends CardImpl {
@ -20,7 +19,7 @@ public final class MischiefAndMayhem extends CardImpl {
// Up to two target creatures each get +4/+4 until end of turn. // Up to two target creatures each get +4/+4 until end of turn.
this.getSpellAbility().addEffect(new BoostTargetEffect(4, 4, Duration.EndOfTurn)); this.getSpellAbility().addEffect(new BoostTargetEffect(4, 4, Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 2, StaticFilters.FILTER_PERMANENT_CREATURES, false)); this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 2));
} }
private MischiefAndMayhem(final MischiefAndMayhem card) { private MischiefAndMayhem(final MischiefAndMayhem card) {

View file

@ -14,7 +14,7 @@ import mage.game.Controllable;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import mage.target.targetpointer.EachTargetPointer; import mage.target.targetpointer.EachTargetPointer;
import java.util.Collection; import java.util.Collection;
@ -67,7 +67,7 @@ enum ModifyMemoryCondition implements Condition {
} }
} }
class ModifyMemoryTarget extends TargetCreaturePermanent { class ModifyMemoryTarget extends TargetPermanent {
private static final FilterCreaturePermanent filter private static final FilterCreaturePermanent filter
= new FilterCreaturePermanent("creatures controlled by different players"); = new FilterCreaturePermanent("creatures controlled by different players");

View file

@ -15,6 +15,7 @@ import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -31,7 +32,6 @@ public final class Mutiny extends CardImpl {
this.getSpellAbility().addEffect(new MutinyEffect()); this.getSpellAbility().addEffect(new MutinyEffect());
this.getSpellAbility().addTarget(new MutinyFirstTarget(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE)); this.getSpellAbility().addTarget(new MutinyFirstTarget(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("another target creature that player controls"))); this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("another target creature that player controls")));
} }
private Mutiny(final Mutiny card) { private Mutiny(final Mutiny card) {
@ -75,7 +75,7 @@ class MutinyEffect extends OneShotEffect {
} }
class MutinyFirstTarget extends TargetCreaturePermanent { class MutinyFirstTarget extends TargetPermanent {
public MutinyFirstTarget(FilterCreaturePermanent filter) { public MutinyFirstTarget(FilterCreaturePermanent filter) {
super(1, 1, filter, false); super(1, 1, filter, false);

View file

@ -1,6 +1,5 @@
package mage.cards.n; package mage.cards.n;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -13,11 +12,12 @@ import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetOpponentsCreaturePermanent;
import mage.target.targetpointer.SecondTargetPointer; import mage.target.targetpointer.SecondTargetPointer;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class NissasJudgment extends CardImpl { public final class NissasJudgment extends CardImpl {
@ -32,7 +32,7 @@ public final class NissasJudgment extends CardImpl {
// Choose up to one target creature an opponent controls. Each creature you control with a +1/+1 counter on it deals damage equal to its power to that creature. // Choose up to one target creature an opponent controls. Each creature you control with a +1/+1 counter on it deals damage equal to its power to that creature.
effect = new NissasJudgmentEffect(); effect = new NissasJudgmentEffect();
effect.setTargetPointer(new SecondTargetPointer()); // First target is used by Support effect.setTargetPointer(new SecondTargetPointer()); // First target is used by Support
getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1, StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE, false)); getSpellAbility().addTarget(new TargetOpponentsCreaturePermanent(0, 1));
getSpellAbility().addEffect(effect); getSpellAbility().addEffect(effect);
} }

View file

@ -16,8 +16,8 @@ import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.SecondTargetPointer; import mage.target.targetpointer.SecondTargetPointer;
import java.util.UUID; import java.util.UUID;
@ -37,7 +37,7 @@ public final class PhantomBlade extends CardImpl {
ability.addTarget(new TargetControlledCreaturePermanent(0, 1).setTargetTag(1)); ability.addTarget(new TargetControlledCreaturePermanent(0, 1).setTargetTag(1));
ability.addEffect(new DestroyTargetEffect().setTargetPointer(new SecondTargetPointer())); ability.addEffect(new DestroyTargetEffect().setTargetPointer(new SecondTargetPointer()));
ability.addTarget(new TargetCreaturePermanent(0, 1, StaticFilters.FILTER_ANOTHER_CREATURE_TARGET_2, false).setTargetTag(2)); ability.addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_ANOTHER_CREATURE_TARGET_2).setTargetTag(2));
this.addAbility(ability); this.addAbility(ability);
// Equipped creature gets +1/+1 and has menace. // Equipped creature gets +1/+1 and has menace.

View file

@ -8,12 +8,12 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.util.functions.EmptyCopyApplier; import mage.util.functions.EmptyCopyApplier;
@ -31,9 +31,8 @@ public final class PolymorphousRush extends CardImpl {
this.addAbility(new StriveAbility("{1}{U}")); this.addAbility(new StriveAbility("{1}{U}"));
// Choose a creature on the battlefield. Any number of target creatures you control each become a copy of that creature until end of turn. // Choose a creature on the battlefield. Any number of target creatures you control each become a copy of that creature until end of turn.
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, StaticFilters.FILTER_PERMANENT_CREATURE_CONTROLLED, false));
this.getSpellAbility().addEffect(new PolymorphousRushCopyEffect()); this.getSpellAbility().addEffect(new PolymorphousRushCopyEffect());
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE));
} }
private PolymorphousRush(final PolymorphousRush card) { private PolymorphousRush(final PolymorphousRush card) {

View file

@ -21,6 +21,7 @@ import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ManaValuePredicate; import mage.filter.predicate.mageobject.ManaValuePredicate;
import mage.game.Game; import mage.game.Game;
import mage.target.TargetPermanent;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.common.TargetCardInYourGraveyard; import mage.target.common.TargetCardInYourGraveyard;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
@ -37,13 +38,12 @@ public final class ProfaneCommand extends CardImpl {
public ProfaneCommand(UUID ownerId, CardSetInfo setInfo) { public ProfaneCommand(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{B}{B}");
DynamicValue xValue = GetXValue.instance;
// Choose two - // Choose two -
this.getSpellAbility().getModes().setMinModes(2); this.getSpellAbility().getModes().setMinModes(2);
this.getSpellAbility().getModes().setMaxModes(2); this.getSpellAbility().getModes().setMaxModes(2);
// * Target player loses X life. // * Target player loses X life.
this.getSpellAbility().addEffect(new LoseLifeTargetEffect(xValue)); this.getSpellAbility().addEffect(new LoseLifeTargetEffect(GetXValue.instance));
this.getSpellAbility().addTarget(new TargetPlayer()); this.getSpellAbility().addTarget(new TargetPlayer());
// * Return target creature card with converted mana cost X or less from your graveyard to the battlefield. // * Return target creature card with converted mana cost X or less from your graveyard to the battlefield.
@ -52,15 +52,13 @@ public final class ProfaneCommand extends CardImpl {
this.getSpellAbility().addMode(mode); this.getSpellAbility().addMode(mode);
// * Target creature gets -X/-X until end of turn. // * Target creature gets -X/-X until end of turn.
DynamicValue minusValue = new SignInversionDynamicValue(xValue); DynamicValue minusValue = new SignInversionDynamicValue(GetXValue.instance);
mode = new Mode(new BoostTargetEffect(minusValue, minusValue, Duration.EndOfTurn)); mode = new Mode(new BoostTargetEffect(minusValue, minusValue, Duration.EndOfTurn));
mode.addTarget(new TargetCreaturePermanent()); mode.addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addMode(mode); this.getSpellAbility().addMode(mode);
// * Up to X target creatures gain fear until end of turn. // * Up to X target creatures gain fear until end of turn.
Effect effect = new GainAbilityTargetEffect(FearAbility.getInstance(), Duration.EndOfTurn); mode = new Mode(new GainAbilityTargetEffect(FearAbility.getInstance(), Duration.EndOfTurn).setText("Up to X target creatures gain fear until end of turn"));
effect.setText("Up to X target creatures gain fear until end of turn");
mode = new Mode(effect);
mode.addTarget(new TargetCreaturePermanent(0, 1)); mode.addTarget(new TargetCreaturePermanent(0, 1));
this.getSpellAbility().addMode(mode); this.getSpellAbility().addMode(mode);
@ -95,8 +93,8 @@ enum ProfaneCommandAdjuster implements TargetAdjuster {
if (effect instanceof GainAbilityTargetEffect) { if (effect instanceof GainAbilityTargetEffect) {
mode.getTargets().clear(); mode.getTargets().clear();
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures gain fear until end of turn"); FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures gain fear until end of turn");
mode.addTarget(new TargetCreaturePermanent(0, xValue, filter, false)); mode.addTarget(new TargetPermanent(0, xValue, filter));
} }
} }
} }
} }

View file

@ -1,7 +1,5 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.FirstStrikeAbility;
@ -12,11 +10,13 @@ import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.other.AnotherTargetPredicate; import mage.filter.predicate.other.AnotherTargetPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.SecondTargetPointer; import mage.target.targetpointer.SecondTargetPointer;
import java.util.UUID;
/** /**
*
* @author weirddan455 * @author weirddan455
*/ */
public final class RallyManeuver extends CardImpl { public final class RallyManeuver extends CardImpl {
@ -31,25 +31,22 @@ public final class RallyManeuver extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}");
// Target creature gets +2/+0 and gains first strike until end of turn. Up to one other target creature gets +0/+2 and gains lifelink until end of turn. // Target creature gets +2/+0 and gains first strike until end of turn. Up to one other target creature gets +0/+2 and gains lifelink until end of turn.
TargetCreaturePermanent target = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(new TargetCreaturePermanent().setTargetTag(1).withChooseHint("+2/+0 and first strike"));
target.setTargetTag(1);
this.getSpellAbility().addTarget(target.withChooseHint("+2/+0 and first strike"));
this.getSpellAbility().addEffect(new BoostTargetEffect(2, 0).setText("Target creature gets +2/+0")); this.getSpellAbility().addEffect(new BoostTargetEffect(2, 0).setText("Target creature gets +2/+0"));
this.getSpellAbility().addEffect(new GainAbilityTargetEffect( this.getSpellAbility().addEffect(new GainAbilityTargetEffect(
FirstStrikeAbility.getInstance(), Duration.EndOfTurn, "and gains first strike until end of turn" FirstStrikeAbility.getInstance(), Duration.EndOfTurn,
"and gains first strike until end of turn"
)); ));
this.getSpellAbility().addTarget(new TargetPermanent(0, 1, filter2)
target = new TargetCreaturePermanent(0, 1, filter2, false); .setTargetTag(2).withChooseHint("+0/+2 and lifelink"));
target.setTargetTag(2);
this.getSpellAbility().addTarget(target.withChooseHint("+0/+2 and lifelink"));
this.getSpellAbility().addEffect(new BoostTargetEffect(0, 2) this.getSpellAbility().addEffect(new BoostTargetEffect(0, 2)
.setText("Up to one other target creature gets +0/+2") .setText("Up to one other target creature gets +0/+2")
.setTargetPointer(new SecondTargetPointer()) .setTargetPointer(new SecondTargetPointer())
); );
this.getSpellAbility().addEffect( this.getSpellAbility().addEffect(new GainAbilityTargetEffect(
new GainAbilityTargetEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn, "and gains lifelink until end of turn") LifelinkAbility.getInstance(), Duration.EndOfTurn,
.setTargetPointer(new SecondTargetPointer()) "and gains lifelink until end of turn"
); ).setTargetPointer(new SecondTargetPointer()));
} }
private RallyManeuver(final RallyManeuver card) { private RallyManeuver(final RallyManeuver card) {

View file

@ -12,12 +12,11 @@ import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author notgreat * @author notgreat
*/ */
public final class RavenousTyrannosaurus extends CardImpl { public final class RavenousTyrannosaurus extends CardImpl {
@ -27,6 +26,7 @@ public final class RavenousTyrannosaurus extends CardImpl {
static { static {
filter.add(AnotherPredicate.instance); filter.add(AnotherPredicate.instance);
} }
public RavenousTyrannosaurus(UUID ownerId, CardSetInfo setInfo) { public RavenousTyrannosaurus(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{G}");
this.subtype.add(SubType.DINOSAUR); this.subtype.add(SubType.DINOSAUR);
@ -39,7 +39,7 @@ public final class RavenousTyrannosaurus extends CardImpl {
// Whenever Ravenous Tyrannosaurus attacks, it deals damage equal to its power to up to one other target creature. Excess damage is dealt to that creature's controller instead. // Whenever Ravenous Tyrannosaurus attacks, it deals damage equal to its power to up to one other target creature. Excess damage is dealt to that creature's controller instead.
Ability ability = new AttacksTriggeredAbility(new DamageWithExcessEffect(SourcePermanentPowerValue.NOT_NEGATIVE) Ability ability = new AttacksTriggeredAbility(new DamageWithExcessEffect(SourcePermanentPowerValue.NOT_NEGATIVE)
.setText("it deals damage equal to its power to up to one other target creature. Excess damage is dealt to that creature's controller instead.")); .setText("it deals damage equal to its power to up to one other target creature. Excess damage is dealt to that creature's controller instead."));
ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false)); ability.addTarget(new TargetPermanent(0, 1, filter));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -13,7 +13,7 @@ import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
@ -36,7 +36,7 @@ public final class RazorgrassInvoker extends CardImpl {
// {8}: Razorgrass Invoker and up to one other target creature each get +3/+3 until end of turn. // {8}: Razorgrass Invoker and up to one other target creature each get +3/+3 until end of turn.
Ability ability = new SimpleActivatedAbility(new BoostSourceEffect(3, 3, Duration.EndOfTurn).setText("{this}"), new ManaCostsImpl<>("{8}")); Ability ability = new SimpleActivatedAbility(new BoostSourceEffect(3, 3, Duration.EndOfTurn).setText("{this}"), new ManaCostsImpl<>("{8}"));
ability.addEffect(new BoostTargetEffect(3, 3, Duration.EndOfTurn).setText("and up to one other target creature each get +3/+3 until end of turn")); ability.addEffect(new BoostTargetEffect(3, 3, Duration.EndOfTurn).setText("and up to one other target creature each get +3/+3 until end of turn"));
ability.addTarget(new TargetCreaturePermanent(0, 1, StaticFilters.FILTER_ANOTHER_TARGET_CREATURE, false)); ability.addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_ANOTHER_TARGET_CREATURE));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -6,21 +6,20 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author Loki * @author Loki
*/ */
public final class RecklessSpite extends CardImpl { public final class RecklessSpite extends CardImpl {
public RecklessSpite(UUID ownerId, CardSetInfo setInfo) { public RecklessSpite(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}{B}");
this.getSpellAbility().addEffect(new DestroyTargetEffect()); this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2, 2, StaticFilters.FILTER_PERMANENT_CREATURES_NON_BLACK, false)); this.getSpellAbility().addTarget(new TargetPermanent(2, StaticFilters.FILTER_PERMANENT_CREATURES_NON_BLACK));
this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(5)); this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(5));
} }

View file

@ -18,7 +18,7 @@ import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.game.permanent.token.custom.CreatureToken; import mage.game.permanent.token.custom.CreatureToken;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
@ -53,7 +53,7 @@ public final class RestlessVinestalk extends CardImpl {
// Whenever Restless Vinestalk attacks, up to one other target creature has base power and toughness 3/3 until end of turn. // Whenever Restless Vinestalk attacks, up to one other target creature has base power and toughness 3/3 until end of turn.
Ability ability = new AttacksTriggeredAbility(new SetBasePowerToughnessTargetEffect(3, 3, Duration.EndOfTurn), false); Ability ability = new AttacksTriggeredAbility(new SetBasePowerToughnessTargetEffect(3, 3, Duration.EndOfTurn), false);
ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false)); ability.addTarget(new TargetPermanent(0, 1, filter));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,8 +1,6 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import mage.MageItem;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -10,15 +8,23 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.target.TargetImpl;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetPermanentSameController;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class Retribution extends CardImpl { public final class Retribution extends CardImpl {
@ -28,8 +34,7 @@ public final class Retribution extends CardImpl {
// Choose two target creatures an opponent controls. That player chooses and sacrifices one of those creatures. Put a -1/-1 counter on the other. // Choose two target creatures an opponent controls. That player chooses and sacrifices one of those creatures. Put a -1/-1 counter on the other.
this.getSpellAbility().addEffect(new RetributionEffect()); this.getSpellAbility().addEffect(new RetributionEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanentOpponentSameController(2, 2, StaticFilters.FILTER_PERMANENT_CREATURE, false)); this.getSpellAbility().addTarget(new TargetPermanentSameController(2, StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURES));
} }
private Retribution(final Retribution card) { private Retribution(final Retribution card) {
@ -60,66 +65,53 @@ class RetributionEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
MageObject sourceObject = source.getSourceObject(game); List<Permanent> permanents = this
if (sourceObject != null) { .getTargetPointer()
boolean sacrificeDone = false; .getTargets(game, source)
int count = 0; .stream()
for (UUID targetId : getTargetPointer().getTargets(game, source)) { .map(game::getPermanent)
Permanent creature = game.getPermanent(targetId); .filter(Objects::nonNull)
if (creature != null) { .collect(Collectors.toList());
Player controllerOfCreature = game.getPlayer(creature.getControllerId()); List<Permanent> canSac = permanents
if ((count == 0 && controllerOfCreature != null .stream()
&& controllerOfCreature.chooseUse(Outcome.Sacrifice, "Sacrifice " + creature.getLogName() + '?', source, game)) .filter(Permanent::canBeSacrificed)
|| (count == 1 .collect(Collectors.toList());
&& !sacrificeDone)) { Permanent toSacrifice;
creature.sacrifice(source, game); switch (canSac.size()) {
sacrificeDone = true; case 0:
} else { toSacrifice = null;
creature.addCounters(CounterType.M1M1.createInstance(), source.getControllerId(), source, game); break;
} case 1:
count++; toSacrifice = canSac.get(0);
} break;
} default:
return true; toSacrifice = Optional
.ofNullable(canSac.get(0).getControllerId())
.map(game::getPlayer)
.map(player -> {
FilterPermanent filter = new FilterPermanent();
filter.add(Predicates.or(
canSac.stream()
.map(MageItem::getId)
.map(PermanentIdPredicate::new)
.collect(Collectors.toList())
));
TargetPermanent target = new TargetPermanent(filter);
target.withNotTarget(true);
player.choose(Outcome.Sacrifice, target, source, game);
return target;
})
.map(TargetImpl::getFirstTarget)
.map(game::getPermanent)
.orElse(null);
} }
return false; if (toSacrifice != null) {
} permanents.remove(toSacrifice);
} toSacrifice.sacrifice(source, game);
}
class TargetCreaturePermanentOpponentSameController extends TargetCreaturePermanent { for (Permanent permanent : permanents) {
permanent.addCounters(CounterType.M1M1.createInstance(), source, game);
public TargetCreaturePermanentOpponentSameController(int minNumTargets, int maxNumTargets, FilterCreaturePermanent filter, boolean notTarget) { }
super(minNumTargets, maxNumTargets, filter, notTarget); return true;
}
private TargetCreaturePermanentOpponentSameController(final TargetCreaturePermanentOpponentSameController target) {
super(target);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if (super.canTarget(controllerId, id, source, game)) {
Permanent firstTargetPermanent = game.getPermanent(id);
if (firstTargetPermanent != null
&& game.getOpponents(controllerId).contains(firstTargetPermanent.getControllerId())) {
for (UUID targetId : getTargets()) {
Permanent targetPermanent = game.getPermanent(targetId);
if (targetPermanent != null) {
if (!firstTargetPermanent.getId().equals(targetPermanent.getId())) {
if (!firstTargetPermanent.isControlledBy(targetPermanent.getOwnerId())) {
return false;
}
}
}
}
return true;
}
}
return false;
}
@Override
public TargetCreaturePermanentOpponentSameController copy() {
return new TargetCreaturePermanentOpponentSameController(this);
} }
} }

View file

@ -1,19 +1,20 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.FightTargetsEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.filter.FilterPermanent;
import mage.filter.StaticFilters; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanentWithDifferentTypes; import mage.target.TargetPermanent;
import java.util.Objects;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class RivalsDuel extends CardImpl { public final class RivalsDuel extends CardImpl {
@ -22,9 +23,9 @@ public final class RivalsDuel extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}");
// Choose two target creatures that share no creature types. Those creatures fight each other. // Choose two target creatures that share no creature types. Those creatures fight each other.
this.getSpellAbility().addEffect(new RivalsDuelFightTargetsEffect()); this.getSpellAbility().addEffect(new FightTargetsEffect()
this.getSpellAbility().addTarget(new TargetCreaturePermanentWithDifferentTypes(2, 2, StaticFilters.FILTER_PERMANENT_CREATURE, false)); .setText("Choose two target creatures that share no creature types. Those creatures fight each other."));
this.getSpellAbility().addTarget(new RivalsDuelTarget());
} }
private RivalsDuel(final RivalsDuel card) { private RivalsDuel(final RivalsDuel card) {
@ -37,42 +38,35 @@ public final class RivalsDuel extends CardImpl {
} }
} }
class RivalsDuelFightTargetsEffect extends OneShotEffect { class RivalsDuelTarget extends TargetPermanent {
RivalsDuelFightTargetsEffect() { private static final FilterPermanent filter = new FilterCreaturePermanent("creatures that share no creature types");
super(Outcome.Damage);
staticText = "Choose two target creatures that share no creature types. " + RivalsDuelTarget() {
"Those creatures fight each other. <i>(Each deals damage equal to its power to the other.)</i>"; super(2, 2, filter, false);
} }
private RivalsDuelFightTargetsEffect(final RivalsDuelFightTargetsEffect effect) { private RivalsDuelTarget(final RivalsDuelTarget target) {
super(effect); super(target);
} }
@Override @Override
public boolean apply(Game game, Ability source) { public RivalsDuelTarget copy() {
Permanent creature1 = null; return new RivalsDuelTarget(this);
Permanent creature2 = null;
for (UUID targetId : getTargetPointer().getTargets(game, source)) {
if (creature1 == null) {
creature1 = game.getPermanent(targetId);
} else {
creature2 = game.getPermanent(targetId);
}
}
// 20110930 - 701.10
if (creature1 != null
&& creature2 != null) {
creature1.damage(creature2.getPower().getValue(), creature2.getId(), source, game, false, true);
creature2.damage(creature1.getPower().getValue(), creature1.getId(), source, game, false, true);
return true;
}
return false;
} }
@Override @Override
public RivalsDuelFightTargetsEffect copy() { public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
return new RivalsDuelFightTargetsEffect(this); if (!super.canTarget(controllerId, id, source, game)) {
return false;
}
Permanent creature = game.getPermanent(id);
return creature != null
&& this
.getTargets()
.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.noneMatch(permanent -> permanent.shareCreatureTypes(game, creature));
} }
} }

View file

@ -1,36 +1,34 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.FilterPermanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.SecondTargetPointer; import mage.target.targetpointer.SecondTargetPointer;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class RiverHeraldsBoon extends CardImpl { public final class RiverHeraldsBoon extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent(SubType.MERFOLK, "Merfolk");
public RiverHeraldsBoon(UUID ownerId, CardSetInfo setInfo) { public RiverHeraldsBoon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}");
// Put a +1/+1 counter on target creature and a +1/+1 counter on up to one target Merfolk. // Put a +1/+1 counter on target creature and a +1/+1 counter on up to one target Merfolk.
this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance())); this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance()));
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance()); this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance())
effect.setTargetPointer(new SecondTargetPointer()); .setTargetPointer(new SecondTargetPointer()).setText("and a +1/+1 counter on up to one target Merfolk"));
effect.setText("and a +1/+1 counter on up to one target Merfolk"); this.getSpellAbility().addTarget(new TargetPermanent(0, 1, filter));
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1, new FilterCreaturePermanent(SubType.MERFOLK, "Merfolk"), false));
} }
private RiverHeraldsBoon(final RiverHeraldsBoon card) { private RiverHeraldsBoon(final RiverHeraldsBoon card) {

View file

@ -11,7 +11,7 @@ import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
@ -38,7 +38,7 @@ public final class RoamingGhostlight extends CardImpl {
// When Roaming Ghostlight enters the battlefield, return up to one target non-Spirit creature to its owner's hand. // When Roaming Ghostlight enters the battlefield, return up to one target non-Spirit creature to its owner's hand.
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect()); Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect());
ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false)); ability.addTarget(new TargetPermanent(0, 1, filter));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -5,10 +5,11 @@ import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.Objects; import java.util.Objects;
import java.util.UUID; import java.util.UUID;
@ -39,9 +40,9 @@ public final class RunAwayTogether extends CardImpl {
} }
} }
class RunAwayTogetherTarget extends TargetCreaturePermanent { class RunAwayTogetherTarget extends TargetPermanent {
private static final FilterCreaturePermanent filter private static final FilterPermanent filter
= new FilterCreaturePermanent("creatures controlled by different players"); = new FilterCreaturePermanent("creatures controlled by different players");
RunAwayTogetherTarget() { RunAwayTogetherTarget() {

View file

@ -1,7 +1,5 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -14,8 +12,9 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class SaddlebackLagac extends CardImpl { public final class SaddlebackLagac extends CardImpl {
@ -27,16 +26,15 @@ public final class SaddlebackLagac extends CardImpl {
} }
public SaddlebackLagac(UUID ownerId, CardSetInfo setInfo) { public SaddlebackLagac(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
this.subtype.add(SubType.LIZARD); this.subtype.add(SubType.LIZARD);
this.power = new MageInt(3); this.power = new MageInt(3);
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// When Saddleback Lagac enters the battlefield, support 2. // When Saddleback Lagac enters the battlefield, support 2.
Ability ability = new EntersBattlefieldTriggeredAbility(new SupportEffect(this, 2, true), false); Ability ability = new EntersBattlefieldTriggeredAbility(new SupportEffect(this, 2, true), false);
ability.addTarget(new TargetCreaturePermanent(0, 2, FILTER, false)); ability.addTarget(new TargetCreaturePermanent(0, 2));
this.addAbility(ability); this.addAbility(ability);
} }
private SaddlebackLagac(final SaddlebackLagac card) { private SaddlebackLagac(final SaddlebackLagac card) {

View file

@ -1,20 +1,18 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.combat.CantBlockTargetEffect; import mage.abilities.effects.common.combat.CantBlockTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetLandPermanent; import mage.target.common.TargetLandPermanent;
import mage.target.targetpointer.SecondTargetPointer; import mage.target.targetpointer.SecondTargetPointer;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class SeismicShift extends CardImpl { public final class SeismicShift extends CardImpl {
@ -28,7 +26,7 @@ public final class SeismicShift extends CardImpl {
this.getSpellAbility().addEffect(new CantBlockTargetEffect(Duration.EndOfTurn) this.getSpellAbility().addEffect(new CantBlockTargetEffect(Duration.EndOfTurn)
.setText("Up to two target creatures can't block this turn") .setText("Up to two target creatures can't block this turn")
.setTargetPointer(new SecondTargetPointer())); .setTargetPointer(new SecondTargetPointer()));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 2, StaticFilters.FILTER_PERMANENT_CREATURES, false)); this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 2));
} }
private SeismicShift(final SeismicShift card) { private SeismicShift(final SeismicShift card) {

View file

@ -11,14 +11,13 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.TargetController;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetOpponentsCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -52,12 +51,6 @@ public final class ShelteringAncient extends CardImpl {
class ShelteringAncientCost extends CostImpl { class ShelteringAncientCost extends CostImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(TargetController.OPPONENT.getControllerPredicate());
}
ShelteringAncientCost() { ShelteringAncientCost() {
this.text = "Put a +1/+1 counter on a creature an opponent controls"; this.text = "Put a +1/+1 counter on a creature an opponent controls";
} }
@ -70,7 +63,8 @@ class ShelteringAncientCost extends CostImpl {
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
Player controller = game.getPlayer(controllerId); Player controller = game.getPlayer(controllerId);
if (controller != null) { if (controller != null) {
Target target = new TargetCreaturePermanent(1, 1, filter, true); Target target = new TargetOpponentsCreaturePermanent();
target.withNotTarget(true);
if (target.choose(Outcome.BoostCreature, controllerId, source.getSourceId(), source, game)) { if (target.choose(Outcome.BoostCreature, controllerId, source.getSourceId(), source, game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget()); Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) { if (permanent != null) {
@ -85,7 +79,7 @@ class ShelteringAncientCost extends CostImpl {
@Override @Override
public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) { public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) {
return game.getBattlefield().contains(filter, source, game, 1); return game.getBattlefield().contains(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE, source, game, 1);
} }
@Override @Override

View file

@ -8,12 +8,14 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.DoubleStrikeAbility; import mage.abilities.keyword.DoubleStrikeAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.filter.common.FilterCreaturePermanent; import mage.constants.Duration;
import mage.filter.predicate.permanent.TappedPredicate; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
@ -34,10 +36,7 @@ public final class SiegeStriker extends CardImpl {
this.addAbility(DoubleStrikeAbility.getInstance()); this.addAbility(DoubleStrikeAbility.getInstance());
// Whenever Siege Striker attacks, you may tap any number of untapped creatures you control. Siege Striker gets +1/+1 until end of turn for each creature tapped this way. // Whenever Siege Striker attacks, you may tap any number of untapped creatures you control. Siege Striker gets +1/+1 until end of turn for each creature tapped this way.
this.addAbility(new AttacksTriggeredAbility( this.addAbility(new AttacksTriggeredAbility(new SiegeStrikerEffect(), true));
new SiegeStrikerEffect(), true
));
} }
private SiegeStriker(final SiegeStriker card) { private SiegeStriker(final SiegeStriker card) {
@ -52,13 +51,6 @@ public final class SiegeStriker extends CardImpl {
class SiegeStrikerEffect extends OneShotEffect { class SiegeStrikerEffect extends OneShotEffect {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("untapped creatures you control");
static {
filter.add(TargetController.YOU.getControllerPredicate());
filter.add(TappedPredicate.UNTAPPED);
}
public SiegeStrikerEffect() { public SiegeStrikerEffect() {
super(Outcome.GainLife); super(Outcome.GainLife);
staticText = "you may tap any number of untapped creatures you control. " staticText = "you may tap any number of untapped creatures you control. "
@ -72,15 +64,13 @@ class SiegeStrikerEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
int tappedAmount = 0; int tappedAmount = 0;
TargetCreaturePermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true); TargetPermanent target = new TargetPermanent(0, Integer.MAX_VALUE, StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURES, true);
if (target.canChoose(source.getControllerId(), source, game) target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), source, game);
&& target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), source, game)) { for (UUID creatureId : target.getTargets()) {
for (UUID creatureId : target.getTargets()) { Permanent creature = game.getPermanent(creatureId);
Permanent creature = game.getPermanent(creatureId); if (creature != null) {
if (creature != null) { creature.tap(source, game);
creature.tap(source, game); tappedAmount++;
tappedAmount++;
}
} }
} }
if (tappedAmount > 0) { if (tappedAmount > 0) {

View file

@ -1,7 +1,5 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -12,13 +10,13 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class SigardianPriest extends CardImpl { public final class SigardianPriest extends CardImpl {
@ -30,7 +28,7 @@ public final class SigardianPriest extends CardImpl {
} }
public SigardianPriest(UUID ownerId, CardSetInfo setInfo) { public SigardianPriest(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.CLERIC); this.subtype.add(SubType.CLERIC);
this.power = new MageInt(1); this.power = new MageInt(1);
@ -39,7 +37,7 @@ public final class SigardianPriest extends CardImpl {
// {1}, {T}: Tap target non-Human creature. // {1}, {T}: Tap target non-Human creature.
Ability ability = new SimpleActivatedAbility(new TapTargetEffect(), new GenericManaCost(1)); Ability ability = new SimpleActivatedAbility(new TapTargetEffect(), new GenericManaCost(1));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent(1, 1, filter, false)); ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -6,8 +6,8 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -27,7 +27,7 @@ public final class SmellFear extends CardImpl {
"<br>Target creature you control fights up to one target creature you don't control" "<br>Target creature you control fights up to one target creature you don't control"
)); ));
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, false)); this.getSpellAbility().addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL));
} }
private SmellFear(final SmellFear card) { private SmellFear(final SmellFear card) {

View file

@ -1,9 +1,5 @@
package mage.cards.s; package mage.cards.s;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.Card;
@ -17,11 +13,14 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/** /**
*
* @author weirddan455 * @author weirddan455
*/ */
public final class SplitTheParty extends CardImpl { public final class SplitTheParty extends CardImpl {
@ -72,7 +71,7 @@ class SplitThePartyEffect extends OneShotEffect {
int halfCreatures = (numCreatures / 2) + (numCreatures % 2); int halfCreatures = (numCreatures / 2) + (numCreatures % 2);
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures controlled by " + targetPlayer.getName()); FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures controlled by " + targetPlayer.getName());
filter.add(new ControllerIdPredicate(targetPlayer.getId())); filter.add(new ControllerIdPredicate(targetPlayer.getId()));
TargetCreaturePermanent target = new TargetCreaturePermanent(halfCreatures, halfCreatures, filter, true); TargetPermanent target = new TargetPermanent(halfCreatures, halfCreatures, filter, true);
if (controller.chooseTarget(outcome, target, source, game)) { if (controller.chooseTarget(outcome, target, source, game)) {
Set<Card> cardsToHand = new HashSet<>(); Set<Card> cardsToHand = new HashSet<>();
for (UUID creatureId : target.getTargets()) { for (UUID creatureId : target.getTargets()) {

View file

@ -16,8 +16,8 @@ import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -103,7 +103,7 @@ class SpyNetworkFaceDownEffect extends OneShotEffect {
FilterCreaturePermanent filter = new FilterCreaturePermanent("face down creature controlled by " + player.getLogName()); FilterCreaturePermanent filter = new FilterCreaturePermanent("face down creature controlled by " + player.getLogName());
filter.add(FaceDownPredicate.instance); filter.add(FaceDownPredicate.instance);
filter.add(new ControllerIdPredicate(player.getId())); filter.add(new ControllerIdPredicate(player.getId()));
TargetCreaturePermanent target = new TargetCreaturePermanent(1, 1, filter, true); TargetPermanent target = new TargetPermanent(1, 1, filter, true);
if (target.canChoose(controller.getId(), source, game)) { if (target.canChoose(controller.getId(), source, game)) {
while (controller.chooseUse(outcome, "Look at a face down creature controlled by " + player.getLogName() + "?", source, game)) { while (controller.chooseUse(outcome, "Look at a face down creature controlled by " + player.getLogName() + "?", source, game)) {
target.clearChosen(); target.clearChosen();

View file

@ -1,9 +1,9 @@
package mage.cards.s; package mage.cards.s;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.combat.CantBlockAllEffect; import mage.abilities.effects.common.combat.CantBlockAllEffect;
import mage.abilities.triggers.BeginningOfCombatTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
@ -17,7 +17,7 @@ import mage.filter.predicate.permanent.PermanentReferenceInCollectionPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -77,7 +77,7 @@ class StandOrFallEffect extends OneShotEffect {
} }
FilterCreaturePermanent opponentFilter = new FilterCreaturePermanent(); FilterCreaturePermanent opponentFilter = new FilterCreaturePermanent();
opponentFilter.add(new ControllerIdPredicate(oppId)); opponentFilter.add(new ControllerIdPredicate(oppId));
TargetCreaturePermanent creatures = new TargetCreaturePermanent(0, Integer.MAX_VALUE, opponentFilter, true); TargetPermanent creatures = new TargetPermanent(0, Integer.MAX_VALUE, opponentFilter, true);
List<Permanent> pile1 = new ArrayList<>(); List<Permanent> pile1 = new ArrayList<>();
if (player.choose(Outcome.Neutral, creatures, source, game)) { if (player.choose(Outcome.Neutral, creatures, source, game)) {
List<UUID> targets = creatures.getTargets(); List<UUID> targets = creatures.getTargets();

View file

@ -8,8 +8,8 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -28,8 +28,8 @@ public final class StruggleForSkemfar extends CardImpl {
"<i>(Each deals damage equal to its power to the other.)</i>" "<i>(Each deals damage equal to its power to the other.)</i>"
)); ));
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
this.getSpellAbility().addTarget(new TargetCreaturePermanent( this.getSpellAbility().addTarget(new TargetPermanent(
0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, false 0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL
)); ));
// Foretell {G} // Foretell {G}

View file

@ -1,19 +1,16 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.BecomesColorTargetEffect; import mage.abilities.effects.common.continuous.BecomesColorTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public final class SwayOfIllusion extends CardImpl { public final class SwayOfIllusion extends CardImpl {
@ -22,10 +19,9 @@ public final class SwayOfIllusion extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Any number of target creatures become the color of your choice until end of turn. // Any number of target creatures become the color of your choice until end of turn.
Effect effect = new BecomesColorTargetEffect(Duration.EndOfTurn); this.getSpellAbility().addEffect(new BecomesColorTargetEffect(Duration.EndOfTurn)
effect.setText("Any number of target creatures become the color of your choice until end of turn"); .setText("Any number of target creatures become the color of your choice until end of turn"));
this.getSpellAbility().addEffect(effect); this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, StaticFilters.FILTER_PERMANENT_CREATURE, false));
// Draw a card. // Draw a card.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1).concatBy("<br>")); this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1).concatBy("<br>"));

View file

@ -42,7 +42,7 @@ public final class TamiyoFieldResearcher extends CardImpl {
// +1: Choose up to two target creatures. Until your next turn, whenever either of those creatures deals combat damage, you draw a card. // +1: Choose up to two target creatures. Until your next turn, whenever either of those creatures deals combat damage, you draw a card.
Ability ability = new LoyaltyAbility(new TamiyoFieldResearcherEffect1(), 1); Ability ability = new LoyaltyAbility(new TamiyoFieldResearcherEffect1(), 1);
ability.addTarget(new TargetCreaturePermanent(0, 2, StaticFilters.FILTER_PERMANENT_CREATURES, false)); ability.addTarget(new TargetCreaturePermanent(0, 2));
this.addAbility(ability); this.addAbility(ability);
// -2: Tap up to two target nonland permanents. They don't untap during their controller's next untap step. // -2: Tap up to two target nonland permanents. They don't untap during their controller's next untap step.

View file

@ -1,36 +1,40 @@
package mage.cards.t; package mage.cards.t;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ShuffleIntoLibraryTargetEffect; import mage.abilities.effects.common.ShuffleIntoLibraryTargetEffect;
import mage.cards.*; import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.choices.FaceVillainousChoice; import mage.choices.FaceVillainousChoice;
import mage.choices.VillainousChoice; import mage.choices.VillainousChoice;
import mage.constants.*; import mage.constants.CardType;
import mage.game.Game; import mage.constants.Outcome;
import mage.filter.StaticFilters; import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
* * @author padfoothelix
* @author padfoothelix
*/ */
public final class ThisIsHowItEnds extends CardImpl { public final class ThisIsHowItEnds extends CardImpl {
public ThisIsHowItEnds(UUID ownerId, CardSetInfo setInfo) { public ThisIsHowItEnds(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{B}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{B}");
// Target creature's owner shuffles it into their library, then faces a villainous choice -- They lose 5 life, or they shuffle another creature they own into their library.
this.getSpellAbility().addEffect(
new ShuffleIntoLibraryTargetEffect()
.setText("target creature's owner shuffles it into their library,")
);
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new ThisIsHowItEndsEffect());
// Target creature's owner shuffles it into their library, then faces a villainous choice -- They lose 5 life, or they shuffle another creature they own into their library.
this.getSpellAbility().addEffect(
new ShuffleIntoLibraryTargetEffect()
.setText("target creature's owner shuffles it into their library,")
);
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new ThisIsHowItEndsEffect());
} }
private ThisIsHowItEnds(final ThisIsHowItEnds card) { private ThisIsHowItEnds(final ThisIsHowItEnds card) {
@ -46,26 +50,26 @@ public final class ThisIsHowItEnds extends CardImpl {
class ThisIsHowItEndsEffect extends OneShotEffect { class ThisIsHowItEndsEffect extends OneShotEffect {
private static final FaceVillainousChoice choice = new FaceVillainousChoice( private static final FaceVillainousChoice choice = new FaceVillainousChoice(
Outcome.Removal, new ThisIsHowItEndsFirstChoice(), new ThisIsHowItEndsSecondChoice() Outcome.Removal, new ThisIsHowItEndsFirstChoice(), new ThisIsHowItEndsSecondChoice()
); );
ThisIsHowItEndsEffect() { ThisIsHowItEndsEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
staticText = "then " + choice.generateRule(); staticText = "then " + choice.generateRule();
} }
private ThisIsHowItEndsEffect(final ThisIsHowItEndsEffect effect) { private ThisIsHowItEndsEffect(final ThisIsHowItEndsEffect effect) {
super(effect); super(effect);
} }
@Override @Override
public ThisIsHowItEndsEffect copy() { public ThisIsHowItEndsEffect copy() {
return new ThisIsHowItEndsEffect(this); return new ThisIsHowItEndsEffect(this);
} }
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
UUID targetOwnerId = game.getOwnerId(getTargetPointer().getFirst(game, source)); UUID targetOwnerId = game.getOwnerId(getTargetPointer().getFirst(game, source));
Player targetOwner = game.getPlayer(targetOwnerId); Player targetOwner = game.getPlayer(targetOwnerId);
choice.faceChoice(targetOwner, game, source); choice.faceChoice(targetOwner, game, source);
return true; return true;
@ -74,13 +78,13 @@ class ThisIsHowItEndsEffect extends OneShotEffect {
class ThisIsHowItEndsFirstChoice extends VillainousChoice { class ThisIsHowItEndsFirstChoice extends VillainousChoice {
ThisIsHowItEndsFirstChoice() { ThisIsHowItEndsFirstChoice() {
super("They lose 5 life","You lose 5 life"); super("They lose 5 life", "You lose 5 life");
} }
@Override @Override
public boolean doChoice(Player player, Game game, Ability source) { public boolean doChoice(Player player, Game game, Ability source) {
player.loseLife(5, game, source, false); player.loseLife(5, game, source, false);
return true; return true;
} }
} }
@ -89,7 +93,7 @@ class ThisIsHowItEndsSecondChoice extends VillainousChoice {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you own"); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you own");
static { static {
filter.add(TargetController.YOU.getOwnerPredicate()); filter.add(TargetController.YOU.getOwnerPredicate());
} }
ThisIsHowItEndsSecondChoice() { ThisIsHowItEndsSecondChoice() {
@ -98,11 +102,12 @@ class ThisIsHowItEndsSecondChoice extends VillainousChoice {
@Override @Override
public boolean doChoice(Player player, Game game, Ability source) { public boolean doChoice(Player player, Game game, Ability source) {
TargetCreaturePermanent target = new TargetCreaturePermanent(1, 1, filter, true); TargetPermanent target = new TargetPermanent(filter);
target.withChooseHint("to shuffle into your library"); target.withNotTarget(true);
target.withChooseHint("to shuffle into your library");
player.chooseTarget(Outcome.Detriment, target, source, game); player.chooseTarget(Outcome.Detriment, target, source, game);
Cards cards = new CardsImpl(target.getTargets()); Cards cards = new CardsImpl(target.getTargets());
player.shuffleCardsToLibrary(cards, game, source); player.shuffleCardsToLibrary(cards, game, source);
return true; return true;
} }
} }

View file

@ -1,7 +1,5 @@
package mage.cards.t; package mage.cards.t;
import java.util.UUID;
import mage.abilities.effects.common.TapTargetEffect; import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -10,10 +8,11 @@ import mage.constants.CardType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate; import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author Quercitron * @author Quercitron
*/ */
public final class TidalSurge extends CardImpl { public final class TidalSurge extends CardImpl {
@ -23,14 +22,13 @@ public final class TidalSurge extends CardImpl {
static { static {
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
} }
public TidalSurge(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{U}");
public TidalSurge(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{U}");
// Tap up to three target creatures without flying. // Tap up to three target creatures without flying.
this.getSpellAbility().addEffect(new TapTargetEffect("tap up to three target creatures without flying")); this.getSpellAbility().addEffect(new TapTargetEffect("tap up to three target creatures without flying"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 3, filter, false)); this.getSpellAbility().addTarget(new TargetPermanent(0, 3, filter));
} }
private TidalSurge(final TidalSurge card) { private TidalSurge(final TidalSurge card) {

View file

@ -7,6 +7,7 @@ import mage.constants.CardType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.other.AnotherTargetPredicate; import mage.filter.predicate.other.AnotherTargetPredicate;
import mage.filter.predicate.permanent.TokenPredicate; import mage.filter.predicate.permanent.TokenPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.SecondTargetPointer; import mage.target.targetpointer.SecondTargetPointer;
@ -29,7 +30,7 @@ public final class TrickShot extends CardImpl {
// Trick Shot deals 6 damage to target creature and 2 damage to up to one other target creature token. // Trick Shot deals 6 damage to target creature and 2 damage to up to one other target creature token.
this.getSpellAbility().addTarget(new TargetCreaturePermanent().setTargetTag(1)); this.getSpellAbility().addTarget(new TargetCreaturePermanent().setTargetTag(1));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1, filter, false).setTargetTag(2)); this.getSpellAbility().addTarget(new TargetPermanent(0, 1, filter).setTargetTag(2));
this.getSpellAbility().addEffect(new DamageTargetEffect(6, true, "", true)); this.getSpellAbility().addEffect(new DamageTargetEffect(6, true, "", true));
this.getSpellAbility().addEffect( this.getSpellAbility().addEffect(
new DamageTargetEffect(2, true, "", true) new DamageTargetEffect(2, true, "", true)

View file

@ -1,22 +1,21 @@
package mage.cards.t; package mage.cards.t;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.constants.SubType;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.filter.StaticFilters; import mage.constants.SubType;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class Twigwalker extends CardImpl { public final class Twigwalker extends CardImpl {
@ -31,7 +30,7 @@ public final class Twigwalker extends CardImpl {
// {1}{G}, Sacrifice Twigwalker: Two target creatures each get +2/+2 until end of turn. // {1}{G}, Sacrifice Twigwalker: Two target creatures each get +2/+2 until end of turn.
Ability ability = new SimpleActivatedAbility(new BoostTargetEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl<>("{1}{G}")); Ability ability = new SimpleActivatedAbility(new BoostTargetEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl<>("{1}{G}"));
ability.addCost(new SacrificeSourceCost()); ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetCreaturePermanent(2, 2, StaticFilters.FILTER_PERMANENT_CREATURES, false)); ability.addTarget(new TargetCreaturePermanent(2));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,7 +1,5 @@
package mage.cards.u; package mage.cards.u;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect;
@ -13,17 +11,19 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.TappedPredicate; import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class UrgeToFeed extends CardImpl { public final class UrgeToFeed extends CardImpl {
public UrgeToFeed(UUID ownerId, CardSetInfo setInfo) { public UrgeToFeed(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}{B}");
// Target creature gets -3/-3 until end of turn. You may tap any number of untapped Vampire creatures you control. If you do, put a +1/+1 counter on each of those Vampires. // Target creature gets -3/-3 until end of turn. You may tap any number of untapped Vampire creatures you control. If you do, put a +1/+1 counter on each of those Vampires.
this.getSpellAbility().addEffect(new BoostTargetEffect(-3, -3, Duration.EndOfTurn)); this.getSpellAbility().addEffect(new BoostTargetEffect(-3, -3, Duration.EndOfTurn));
@ -62,14 +62,13 @@ class UrgeToFeedEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
TargetCreaturePermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true); TargetPermanent target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true);
if (target.canChoose(source.getControllerId(), source, game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), source, game)) { target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), source, game);
for (UUID vampireId : target.getTargets()) { for (UUID vampireId : target.getTargets()) {
Permanent vampire = game.getPermanent(vampireId); Permanent vampire = game.getPermanent(vampireId);
if (vampire != null) { if (vampire != null) {
vampire.tap(source, game); vampire.tap(source, game);
vampire.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game); vampire.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game);
}
} }
} }
return true; return true;

View file

@ -4,7 +4,6 @@ import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.AsTurnedFaceUpEffect; import mage.abilities.effects.AsTurnedFaceUpEffect;
@ -13,16 +12,18 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CopyEffect; import mage.abilities.effects.common.CopyEffect;
import mage.abilities.effects.common.CopyPermanentEffect; import mage.abilities.effects.common.CopyPermanentEffect;
import mage.abilities.keyword.MorphAbility; import mage.abilities.keyword.MorphAbility;
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import mage.util.functions.CopyApplier; import mage.util.functions.CopyApplier;
import java.util.UUID; import java.util.UUID;
@ -104,11 +105,7 @@ class VesuvanShapeshifterEffect extends OneShotEffect {
Permanent copyToCreature = game.getPermanent(source.getSourceId()); Permanent copyToCreature = game.getPermanent(source.getSourceId());
if (copyToCreature != null) { if (copyToCreature != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature"); TargetPermanent target = new TargetPermanent(0, 1, StaticFilters.FILTER_ANOTHER_CREATURE, true);
filter.add(AnotherPredicate.instance);
TargetCreaturePermanent target = new TargetCreaturePermanent(0, 1, filter, true);
if (controller != null && controller.chooseTarget(Outcome.BecomeCreature, target, source, game) && !target.getTargets().isEmpty()) { if (controller != null && controller.chooseTarget(Outcome.BecomeCreature, target, source, game) && !target.getTargets().isEmpty()) {
Permanent copyFromCreature = game.getPermanentOrLKIBattlefield(target.getFirstTarget()); Permanent copyFromCreature = game.getPermanentOrLKIBattlefield(target.getFirstTarget());
if (copyFromCreature != null) { if (copyFromCreature != null) {

View file

@ -1,11 +1,8 @@
package mage.cards.w; package mage.cards.w;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility; import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility;
import mage.constants.SubType;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureAllEffect; import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureAllEffect;
@ -14,6 +11,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicate; import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
@ -22,10 +20,11 @@ import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.filter.predicate.permanent.PermanentIdPredicate; import mage.filter.predicate.permanent.PermanentIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class WeaverOfLies extends CardImpl { public final class WeaverOfLies extends CardImpl {
@ -49,7 +48,7 @@ public final class WeaverOfLies extends CardImpl {
// When Weaver of Lies is turned face up, turn any number of target creatures with a morph ability other than Weaver of Lies face down. // When Weaver of Lies is turned face up, turn any number of target creatures with a morph ability other than Weaver of Lies face down.
Ability ability = new TurnedFaceUpSourceTriggeredAbility(new WeaverOfLiesEffect(), false, false); Ability ability = new TurnedFaceUpSourceTriggeredAbility(new WeaverOfLiesEffect(), false, false);
ability.addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, false)); ability.addTarget(new TargetPermanent(0, Integer.MAX_VALUE, filter));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -16,7 +16,7 @@ import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID; import java.util.UUID;
@ -46,7 +46,7 @@ public final class WerefoxBodyguard extends CardImpl {
// When Werefox Bodyguard enters the battlefield, exile up to one other target non-Fox creature until Werefox Bodyguard leaves the battlefield. // When Werefox Bodyguard enters the battlefield, exile up to one other target non-Fox creature until Werefox Bodyguard leaves the battlefield.
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileUntilSourceLeavesEffect()); Ability ability = new EntersBattlefieldTriggeredAbility(new ExileUntilSourceLeavesEffect());
ability.addTarget(new TargetCreaturePermanent(0, 1, filter, false)); ability.addTarget(new TargetPermanent(0, 1, filter));
this.addAbility(ability); this.addAbility(ability);
// {1}{W}, Sacrifice Werefox Bodyguard: You gain 2 life. // {1}{W}, Sacrifice Werefox Bodyguard: You gain 2 life.

View file

@ -1,26 +1,26 @@
package mage.cards.w; package mage.cards.w;
import java.util.UUID;
import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.LoseLifeSourceControllerEffect; import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public final class WickedPact extends CardImpl { public final class WickedPact extends CardImpl {
public WickedPact(UUID ownerId, CardSetInfo setInfo) { public WickedPact(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}");
// Destroy two target nonblack creatures. You lose 5 life. // Destroy two target nonblack creatures. You lose 5 life.
this.getSpellAbility().addEffect(new DestroyTargetEffect()); this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2, 2, StaticFilters.FILTER_PERMANENT_CREATURES_NON_BLACK, false)); this.getSpellAbility().addTarget(new TargetPermanent(2, StaticFilters.FILTER_PERMANENT_CREATURES_NON_BLACK));
this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(5)); this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(5));
} }

View file

@ -1,7 +1,5 @@
package mage.cards.z; package mage.cards.z;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -16,11 +14,12 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class ZndrspltsJudgment extends CardImpl { public final class ZndrspltsJudgment extends CardImpl {
@ -72,7 +71,8 @@ class ZndrspltsJudgmentEffect extends OneShotEffect {
} }
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control"); FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
filter.add(new ControllerIdPredicate(player.getId())); filter.add(new ControllerIdPredicate(player.getId()));
TargetCreaturePermanent target = new TargetCreaturePermanent(1, 1, filter, true); TargetPermanent target = new TargetPermanent(filter);
target.withNotTarget(true);
if (!player.choose(Outcome.Copy, target, source, game)) { if (!player.choose(Outcome.Copy, target, source, game)) {
continue; continue;
} }
@ -83,7 +83,8 @@ class ZndrspltsJudgmentEffect extends OneShotEffect {
for (Player player : choice.getFoes()) { for (Player player : choice.getFoes()) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control"); FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
filter.add(new ControllerIdPredicate(player.getId())); filter.add(new ControllerIdPredicate(player.getId()));
TargetCreaturePermanent target = new TargetCreaturePermanent(1, 1, filter, true); TargetPermanent target = new TargetPermanent(filter);
target.withNotTarget(true);
if (!player.choose(Outcome.ReturnToHand, target, source, game)) { if (!player.choose(Outcome.ReturnToHand, target, source, game)) {
continue; continue;
} }

View file

@ -6,7 +6,6 @@ import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.util.CardUtil; import mage.util.CardUtil;
@ -23,7 +22,7 @@ public class SupportEffect extends AddCountersTargetEffect {
this.amountSupportTargets = StaticValue.get(amount); this.amountSupportTargets = StaticValue.get(amount);
this.otherPermanent = otherPermanent; this.otherPermanent = otherPermanent;
if (card.isInstantOrSorcery()) { if (card.isInstantOrSorcery()) {
card.getSpellAbility().addTarget(new TargetCreaturePermanent(0, amount, new FilterCreaturePermanent("target creatures"), false)); card.getSpellAbility().addTarget(new TargetCreaturePermanent(0, amount));
} }
staticText = setText(); staticText = setText();
} }

View file

@ -1,12 +1,13 @@
package mage.abilities.keyword; package mage.abilities.keyword;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.keyword.SupportEffect; import mage.abilities.effects.keyword.SupportEffect;
import mage.cards.Card; import mage.cards.Card;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
/** /**
* 701.32. Support * 701.32. Support
@ -19,19 +20,25 @@ import mage.target.common.TargetCreaturePermanent;
*/ */
public class SupportAbility extends EntersBattlefieldTriggeredAbility { public class SupportAbility extends EntersBattlefieldTriggeredAbility {
private static final FilterPermanent filter = new FilterCreaturePermanent("other target creatures");
static {
filter.add(AnotherPredicate.instance);
}
/* /*
* For enchantments, the text should not include the word "other". * For enchantments, the text should not include the word "other".
* The otherPermanent choice removes the word "other" from rule text creation. * The otherPermanent choice removes the word "other" from rule text creation.
*/ */
public SupportAbility(Card card, int amount, boolean otherPermanent) { public SupportAbility(Card card, int amount, boolean otherPermanent) {
super(new SupportEffect(card, amount, otherPermanent)); super(new SupportEffect(card, amount, otherPermanent));
if (!card.isInstantOrSorcery()) { if (card.isInstantOrSorcery()) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures"); return;
if (card.isCreature()) { }
filter.add(AnotherPredicate.instance); if (card.isCreature()) {
filter.setMessage("other target creatures"); addTarget(new TargetPermanent(0, amount, StaticFilters.FILTER_PERMANENT_CREATURES));
} } else {
addTarget(new TargetCreaturePermanent(0, amount, filter, false)); addTarget(new TargetPermanent(0, amount, filter));
} }
} }

View file

@ -27,7 +27,7 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.command.Plane; import mage.game.command.Plane;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
import java.util.ArrayList; import java.util.ArrayList;
@ -62,7 +62,7 @@ public class BantPlane extends Plane {
// Active player can roll the planar die: Whenever you roll {CHAOS}, put a divinity counter on target green, white, or blue creature. That creature gains indestructible for as long as it has a divinity counter on it. // Active player can roll the planar die: Whenever you roll {CHAOS}, put a divinity counter on target green, white, or blue creature. That creature gains indestructible for as long as it has a divinity counter on it.
Effect chaosEffect = new ConditionalContinuousEffect(new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.Custom), new TargetHasCounterCondition(CounterType.DIVINITY), rule); Effect chaosEffect = new ConditionalContinuousEffect(new GainAbilityTargetEffect(IndestructibleAbility.getInstance(), Duration.Custom), new TargetHasCounterCondition(CounterType.DIVINITY), rule);
Target chaosTarget = new TargetCreaturePermanent(1, 1, filter2, false); Target chaosTarget = new TargetPermanent(filter2);
Effect chaosEffect2 = new AddCountersTargetEffect(CounterType.DIVINITY.createInstance()); Effect chaosEffect2 = new AddCountersTargetEffect(CounterType.DIVINITY.createInstance());
List<Effect> chaosEffects = new ArrayList<Effect>(); List<Effect> chaosEffects = new ArrayList<Effect>();

View file

@ -25,7 +25,7 @@ import mage.game.Game;
import mage.game.command.Plane; import mage.game.command.Plane;
import mage.game.stack.Spell; import mage.game.stack.Spell;
import mage.target.Target; import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.TargetPermanent;
import mage.util.CardUtil; import mage.util.CardUtil;
import mage.watchers.common.PlanarRollWatcher; import mage.watchers.common.PlanarRollWatcher;
@ -48,7 +48,7 @@ public class FeedingGroundsPlane extends Plane {
// Active player can roll the planar die: Whenever you roll {CHAOS}, target red or green creature gets X +1/+1 counters // Active player can roll the planar die: Whenever you roll {CHAOS}, target red or green creature gets X +1/+1 counters
Effect chaosEffect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(), TargetManaValue.instance); Effect chaosEffect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(), TargetManaValue.instance);
Target chaosTarget = new TargetCreaturePermanent(1, 1, StaticFilters.FILTER_PERMANENT_A_CREATURE, false); Target chaosTarget = new TargetPermanent(StaticFilters.FILTER_PERMANENT_A_CREATURE);
List<Effect> chaosEffects = new ArrayList<>(); List<Effect> chaosEffects = new ArrayList<>();
chaosEffects.add(chaosEffect); chaosEffects.add(chaosEffect);

View file

@ -1,4 +1,3 @@
package mage.target.common; package mage.target.common;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
@ -15,7 +14,7 @@ public class TargetCreaturePermanent extends TargetPermanent {
} }
public TargetCreaturePermanent(FilterCreaturePermanent filter) { public TargetCreaturePermanent(FilterCreaturePermanent filter) {
this(1, 1, filter, false); super(1, 1, filter, false);
} }
public TargetCreaturePermanent(int numTargets) { public TargetCreaturePermanent(int numTargets) {
@ -23,11 +22,7 @@ public class TargetCreaturePermanent extends TargetPermanent {
} }
public TargetCreaturePermanent(int minNumTargets, int maxNumTargets) { public TargetCreaturePermanent(int minNumTargets, int maxNumTargets) {
this(minNumTargets, maxNumTargets, maxNumTargets > 1 ? StaticFilters.FILTER_PERMANENT_CREATURES : StaticFilters.FILTER_PERMANENT_CREATURE, false); super(minNumTargets, maxNumTargets, maxNumTargets > 1 ? StaticFilters.FILTER_PERMANENT_CREATURES : StaticFilters.FILTER_PERMANENT_CREATURE, false);
}
public TargetCreaturePermanent(int minNumTargets, int maxNumTargets, FilterCreaturePermanent filter, boolean notTarget) {
super(minNumTargets, maxNumTargets, filter, notTarget);
} }
protected TargetCreaturePermanent(final TargetCreaturePermanent target) { protected TargetCreaturePermanent(final TargetCreaturePermanent target) {

View file

@ -1,49 +0,0 @@
package mage.target.common;
import mage.abilities.Ability;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author LevelX2
*/
public class TargetCreaturePermanentWithDifferentTypes extends TargetCreaturePermanent {
public TargetCreaturePermanentWithDifferentTypes(int minNumTargets, int maxNumTargets, FilterCreaturePermanent filter, boolean notTarget) {
super(minNumTargets, maxNumTargets, filter, notTarget);
}
protected TargetCreaturePermanentWithDifferentTypes(final TargetCreaturePermanentWithDifferentTypes target) {
super(target);
}
@Override
public TargetCreaturePermanentWithDifferentTypes copy() {
return new TargetCreaturePermanentWithDifferentTypes(this);
}
@Override
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
if (super.canTarget(controllerId, id, source, game)) {
Permanent creature = game.getPermanent(id);
if (creature != null) {
for (Object object : getTargets()) {
UUID targetId = (UUID) object;
Permanent selectedCreature = game.getPermanent(targetId);
if (selectedCreature != null
&& !creature.getId().equals(selectedCreature.getId())) {
if (creature.shareCreatureTypes(game, selectedCreature)) {
return false;
}
}
}
return true;
}
}
return false;
}
}