diff --git a/Mage.Sets/src/mage/cards/c/CloudstoneCurio.java b/Mage.Sets/src/mage/cards/c/CloudstoneCurio.java index 03293511272..4f4bda9cfca 100644 --- a/Mage.Sets/src/mage/cards/c/CloudstoneCurio.java +++ b/Mage.Sets/src/mage/cards/c/CloudstoneCurio.java @@ -45,6 +45,7 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; +import mage.target.targetpointer.FixedTarget; /** * @@ -97,7 +98,7 @@ class CloudstoneCurioEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - Permanent triggeringCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); + Permanent triggeringCreature = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game); if (triggeringCreature == null) { triggeringCreature = (Permanent) game.getLastKnownInformation(getTargetPointer().getFirst(game, source), Zone.BATTLEFIELD); } diff --git a/Mage.Sets/src/mage/cards/c/CreamOfTheCrop.java b/Mage.Sets/src/mage/cards/c/CreamOfTheCrop.java index 53bcf282e66..28151228784 100644 --- a/Mage.Sets/src/mage/cards/c/CreamOfTheCrop.java +++ b/Mage.Sets/src/mage/cards/c/CreamOfTheCrop.java @@ -43,6 +43,7 @@ import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetCard; import mage.target.common.TargetCardInHand; +import mage.target.targetpointer.FixedTarget; /** * @@ -89,7 +90,7 @@ class CreamOfTheCropEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - Permanent permanent = game.getPermanentOrLKIBattlefield(this.getTargetPointer().getFirst(game, source)); + Permanent permanent = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game); if (player != null && permanent != null) { int numLooked = Math.min(permanent.getPower().getValue(), player.getLibrary().size()); if (numLooked > 0) { diff --git a/Mage.Sets/src/mage/cards/d/DragonTempest.java b/Mage.Sets/src/mage/cards/d/DragonTempest.java index a0f1f4e80d5..e760a1a34ef 100644 --- a/Mage.Sets/src/mage/cards/d/DragonTempest.java +++ b/Mage.Sets/src/mage/cards/d/DragonTempest.java @@ -46,6 +46,7 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCreatureOrPlayer; +import mage.target.targetpointer.FixedTarget; /** * @@ -60,7 +61,7 @@ public class DragonTempest extends CardImpl { } public DragonTempest(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}"); // Whenever a creature with flying enters the battlefield under your control, it gains haste until the end of turn. Effect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); @@ -119,7 +120,7 @@ class DragonTempestDamageEffect extends OneShotEffect { if (controller != null) { int amount = game.getBattlefield().countAll(dragonFilter, controller.getId(), game); if (amount > 0) { - Permanent targetCreature = game.getPermanent(source.getTargets().getFirstTarget()); + Permanent targetCreature = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game); if (targetCreature != null) { targetCreature.damage(amount, getTargetPointer().getFirst(game, source), game, false, true); } else { diff --git a/Mage.Sets/src/mage/cards/f/FlameshadowConjuring.java b/Mage.Sets/src/mage/cards/f/FlameshadowConjuring.java index 7b2f75d20c5..b57cb5448be 100644 --- a/Mage.Sets/src/mage/cards/f/FlameshadowConjuring.java +++ b/Mage.Sets/src/mage/cards/f/FlameshadowConjuring.java @@ -67,7 +67,8 @@ public class FlameshadowConjuring extends CardImpl { // Whenever a nontoken creature enters the battlefield under your control, you may pay {R}. If you do, create a token that's a copy of that creature. That token gains haste. Exile it at the beginning of the next end step. Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new DoIfCostPaid( - new FlameshadowConjuringEffect(), new ManaCostsImpl("{R}"), "Pay {R} to create a token that's a copy of that creature that entered the battlefield?"), filterNontoken, false, SetTargetPointer.PERMANENT, + new FlameshadowConjuringEffect(), new ManaCostsImpl("{R}"), "Pay {R} to create a token that's a copy of that creature that entered the battlefield?"), + filterNontoken, false, SetTargetPointer.PERMANENT, "Whenever a nontoken creature enters the battlefield under your control, " + "you may pay {R}. If you do, create a token that's a copy of that creature. " + "That token gains haste. Exile it at the beginning of the next end step"); @@ -102,7 +103,7 @@ class FlameshadowConjuringEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); + Permanent permanent = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game); if (permanent != null) { PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(null, null, true); effect.setTargetPointer(getTargetPointer()); diff --git a/Mage.Sets/src/mage/cards/i/InallaArchmageRitualist.java b/Mage.Sets/src/mage/cards/i/InallaArchmageRitualist.java index 89da932deaa..b5748d102e9 100644 --- a/Mage.Sets/src/mage/cards/i/InallaArchmageRitualist.java +++ b/Mage.Sets/src/mage/cards/i/InallaArchmageRitualist.java @@ -55,6 +55,7 @@ import mage.constants.Zone; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.TappedPredicate; import mage.filter.predicate.permanent.TokenPredicate; import mage.game.Game; @@ -69,12 +70,13 @@ import mage.target.targetpointer.FixedTarget; */ public class InallaArchmageRitualist extends CardImpl { - private static final FilterControlledPermanent filter = new FilterControlledPermanent("Wizard"); + private static final FilterControlledPermanent filter = new FilterControlledPermanent("another nontoken Wizard"); private static final FilterControlledPermanent filter2 = new FilterControlledPermanent("untapped Wizards you control"); static { filter.add(new SubtypePredicate(SubType.WIZARD)); filter.add(Predicates.not(new TokenPredicate())); + filter.add(new AnotherPredicate()); filter2.add(new SubtypePredicate(SubType.WIZARD)); filter2.add(Predicates.not(new TappedPredicate())); } @@ -94,7 +96,7 @@ public class InallaArchmageRitualist extends CardImpl { new InallaArchmageRitualistEffect(), new ManaCostsImpl("{1}"), "Pay {1} to create a token copy?"), filter, false, SetTargetPointer.PERMANENT, ""), SourceOnBattlefieldOrCommandZoneCondition.instance, - "Eminence - Whenever a nontoken Wizard enters the battlefield under your control, " + "Eminence - Whenever another nontoken Wizard enters the battlefield under your control, " + "{this} is in the command zone or on the battlefield, " + "you may pay {1}. If you do, create a token that's a copy of that Wizard. " + "That token gains haste. Exile it at the beginning of the next end step"); @@ -135,7 +137,7 @@ class InallaArchmageRitualistEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); + Permanent permanent = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game); if (permanent != null) { PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(null, null, true); effect.setTargetPointer(getTargetPointer()); diff --git a/Mage.Sets/src/mage/cards/m/Mirrorworks.java b/Mage.Sets/src/mage/cards/m/Mirrorworks.java index b30f0b3caf8..2d1e051fb9f 100644 --- a/Mage.Sets/src/mage/cards/m/Mirrorworks.java +++ b/Mage.Sets/src/mage/cards/m/Mirrorworks.java @@ -61,7 +61,7 @@ public class Mirrorworks extends CardImpl { // Whenever another nontoken artifact enters the battlefield under your control, you may pay {2}. // If you do, create a token that's a copy of that artifact. - Effect effect = new DoIfCostPaid(new PutTokenOntoBattlefieldCopyTargetEffect(), + Effect effect = new DoIfCostPaid(new PutTokenOntoBattlefieldCopyTargetEffect(true), new ManaCostsImpl("{2}"), "Create a token that's a copy of that artifact?"); effect.setText("you may pay {2}. If you do, create a token that's a copy of that artifact"); this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, effect, filter, false, SetTargetPointer.PERMANENT, null)); diff --git a/Mage.Sets/src/mage/cards/r/RikuOfTwoReflections.java b/Mage.Sets/src/mage/cards/r/RikuOfTwoReflections.java index 18943ea3199..f2cdde3f9da 100644 --- a/Mage.Sets/src/mage/cards/r/RikuOfTwoReflections.java +++ b/Mage.Sets/src/mage/cards/r/RikuOfTwoReflections.java @@ -82,7 +82,7 @@ public class RikuOfTwoReflections extends CardImpl { this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(effect, new ManaCostsImpl("{U}{R}")), filter, false, true)); // Whenever another nontoken creature enters the battlefield under your control, you may pay {G}{U}. If you do, create a token that's a copy of that creature. - effect = new DoIfCostPaid(new PutTokenOntoBattlefieldCopyTargetEffect(), + effect = new DoIfCostPaid(new PutTokenOntoBattlefieldCopyTargetEffect(true), new ManaCostsImpl("{G}{U}"), "Create a token that's a copy of that creature?"); effect.setText("you may pay {G}{U}. If you do, create a token that's a copy of that creature"); this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, effect, filterPermanent, false, SetTargetPointer.PERMANENT, null)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/PutTokenOntoBattlefieldCopyTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PutTokenOntoBattlefieldCopyTargetEffect.java index 1e5b785bc3e..337f8c05d4f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PutTokenOntoBattlefieldCopyTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PutTokenOntoBattlefieldCopyTargetEffect.java @@ -70,6 +70,12 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect { private boolean gainsFlying; private boolean becomesArtifact; private ObjectColor color; + private boolean useLKI = false; + + public PutTokenOntoBattlefieldCopyTargetEffect(boolean useLKI) { + this(); + this.useLKI = useLKI; + } public PutTokenOntoBattlefieldCopyTargetEffect() { super(Outcome.PutCreatureInPlay); @@ -149,6 +155,7 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect { this.gainsFlying = effect.gainsFlying; this.becomesArtifact = effect.becomesArtifact; this.color = effect.color; + this.useLKI = effect.useLKI; } public void setBecomesArtifact(boolean becomesArtifact) { @@ -163,7 +170,12 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect { } else { targetId = getTargetPointer().getFirst(game, source); } - Permanent permanent = game.getPermanentOrLKIBattlefield(targetId); + Permanent permanent; + if (useLKI) { + permanent = ((FixedTarget) getTargetPointer()).getTargetedPermanentOrLKIBattlefield(game); + } else { + permanent = game.getPermanentOrLKIBattlefield(targetId); + } Card copyFrom; ApplyToPermanent applier = new EmptyApplyToPermanent(); if (permanent != null) { @@ -220,7 +232,7 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect { if (onlySubType != null && !token.getSubtype(game).contains(onlySubType)) { token.getSubtype(game).clear(); token.getSubtype(game).add(onlySubType); - } + } if (color != null) { token.getColor(game).setColor(color); } @@ -279,8 +291,12 @@ public class PutTokenOntoBattlefieldCopyTargetEffect extends OneShotEffect { public void setOnlySubType(String onlySubType) { this.onlySubType = onlySubType; } - + public void setOnlyColor(ObjectColor color) { this.color = color; } + + public void setUseLKI(boolean useLKI) { + this.useLKI = useLKI; + } }