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/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; + } }