diff --git a/Mage.Sets/src/mage/cards/m/Mirari.java b/Mage.Sets/src/mage/cards/m/Mirari.java index 0c0b0fe580..da05fc00c0 100644 --- a/Mage.Sets/src/mage/cards/m/Mirari.java +++ b/Mage.Sets/src/mage/cards/m/Mirari.java @@ -1,7 +1,5 @@ - package mage.cards.m; -import java.util.UUID; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.Effect; @@ -19,17 +17,17 @@ import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.game.stack.Spell; -import mage.target.TargetSpell; import mage.target.targetpointer.FixedTarget; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class Mirari extends CardImpl { public Mirari(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{5}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}"); addSuperType(SuperType.LEGENDARY); // Whenever you cast an instant or sorcery spell, you may pay {3}. If you do, copy that spell. You may choose new targets for the copy. @@ -58,8 +56,9 @@ class MirariTriggeredAbility extends TriggeredAbilityImpl { } MirariTriggeredAbility() { - super(Zone.BATTLEFIELD, new DoIfCostPaid(new CopyTargetSpellEffect(true), new GenericManaCost(3)), false); - this.addTarget(new TargetSpell(filter)); + super(Zone.BATTLEFIELD, new DoIfCostPaid( + new CopyTargetSpellEffect(true), + new GenericManaCost(3)), false); } MirariTriggeredAbility(final MirariTriggeredAbility ability) { @@ -82,7 +81,11 @@ class MirariTriggeredAbility extends TriggeredAbilityImpl { Spell spell = game.getStack().getSpell(event.getTargetId()); if (isControlledInstantOrSorcery(spell)) { for (Effect effect : getEffects()) { - effect.setTargetPointer(new FixedTarget(spell.getId())); + if (effect instanceof DoIfCostPaid) { + for (Effect execEffect : ((DoIfCostPaid) effect).getExecutingEffects()) { + execEffect.setTargetPointer(new FixedTarget(spell.getId())); + } + } } return true; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CopyTargetSpellEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CopyTargetSpellEffect.java index 040be4c85d..93c6712292 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CopyTargetSpellEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CopyTargetSpellEffect.java @@ -1,4 +1,3 @@ - package mage.abilities.effects.common; import mage.abilities.Ability; @@ -13,7 +12,6 @@ import mage.players.Player; /** * @author BetaSteward_at_googlemail.com - * */ public class CopyTargetSpellEffect extends OneShotEffect { @@ -79,7 +77,14 @@ public class CopyTargetSpellEffect extends OneShotEffect { return staticText; } StringBuilder sb = new StringBuilder(); - sb.append("copy target ").append(mode.getTargets().get(0).getTargetName()).append(". You may choose new targets for the copy"); + sb.append("copy "); + if (!mode.getTargets().isEmpty()) { + sb.append("target ").append(mode.getTargets().get(0).getTargetName()); + } else { + sb.append("that spell"); + } + sb.append(". You may choose new targets for the copy"); + return sb.toString(); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java index 845fe9e5a4..5a8c7f408d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoIfCostPaid.java @@ -1,6 +1,5 @@ package mage.abilities.effects.common; -import java.util.Locale; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.Mode; @@ -14,6 +13,8 @@ import mage.game.Game; import mage.players.Player; import mage.util.CardUtil; +import java.util.Locale; + public class DoIfCostPaid extends OneShotEffect { protected Effects executingEffects = new Effects(); @@ -27,9 +28,10 @@ public class DoIfCostPaid extends OneShotEffect { } public DoIfCostPaid(Effect effect, Effect effect2, Cost cost) { - this(effect,effect2,cost,true); + this(effect, effect2, cost, true); } - public DoIfCostPaid(Effect effect, Effect effect2, Cost cost,boolean optional) { + + public DoIfCostPaid(Effect effect, Effect effect2, Cost cost, boolean optional) { this(effect, cost, null, optional); this.otherwiseEffects.add(effect2); } @@ -62,6 +64,14 @@ public class DoIfCostPaid extends OneShotEffect { return this; } + public Effects getExecutingEffects() { + return this.executingEffects; + } + + public Effects getOtherwiseEffects() { + return this.otherwiseEffects; + } + @Override public boolean apply(Game game, Ability source) { Player player = getPayingPlayer(game, source);