diff --git a/Mage.Sets/src/mage/cards/h/HarnessTheStorm.java b/Mage.Sets/src/mage/cards/h/HarnessTheStorm.java index d7eb201d29..1700cae76a 100644 --- a/Mage.Sets/src/mage/cards/h/HarnessTheStorm.java +++ b/Mage.Sets/src/mage/cards/h/HarnessTheStorm.java @@ -1,4 +1,3 @@ - package mage.cards.h; import java.util.UUID; @@ -32,9 +31,11 @@ public final class HarnessTheStorm extends CardImpl { public HarnessTheStorm(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); - // Whenever you cast an instant or sorcery spell from your hand, you may cast target card with the same name as that spell from your graveyard. + // Whenever you cast an instant or sorcery spell from your hand, you may cast + // target card with the same name as that spell from your graveyard. this.addAbility(new HarnessTheStormTriggeredAbility(new HarnessTheStormEffect(), - new FilterInstantOrSorcerySpell("an instant or sorcery spell from your hand"), false), new CastFromHandWatcher()); + new FilterInstantOrSorcerySpell("an instant or sorcery spell from your hand"), + false), new CastFromHandWatcher()); } public HarnessTheStorm(final HarnessTheStorm card) { @@ -87,7 +88,8 @@ class HarnessTheStormEffect extends OneShotEffect { public HarnessTheStormEffect() { super(Outcome.Benefit); - this.staticText = "you may cast target card with the same name as that spell from your graveyard. (you still pay its costs.)"; + this.staticText = "you may cast target card with the same name as that " + + "spell from your graveyard. (you still pay its costs.)"; } public HarnessTheStormEffect(final HarnessTheStormEffect effect) { @@ -106,8 +108,11 @@ class HarnessTheStormEffect extends OneShotEffect { if (controller != null) { Card card = controller.getGraveyard().get(getTargetPointer().getFirst(game, source), game); if (card != null) { - if (controller.chooseUse(outcome, "Cast " + card.getIdName() + " from your graveyard?", source, game)) { - controller.cast(card.getSpellAbility(), game, false, new MageObjectReference(source.getSourceObject(game), game)); + if (controller.chooseUse(outcome.Benefit, "Cast " + card.getIdName() + " from your graveyard?", source, game)) { + game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE); + controller.cast(controller.chooseAbilityForCast(card, game, false), + game, false, new MageObjectReference(source.getSourceObject(game), game)); + game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null); } } return true; diff --git a/Mage.Sets/src/mage/cards/m/MindleechMass.java b/Mage.Sets/src/mage/cards/m/MindleechMass.java index 85f4dca3e9..41704f0e83 100644 --- a/Mage.Sets/src/mage/cards/m/MindleechMass.java +++ b/Mage.Sets/src/mage/cards/m/MindleechMass.java @@ -1,4 +1,3 @@ - package mage.cards.m; import java.util.UUID; @@ -38,7 +37,8 @@ public final class MindleechMass extends CardImpl { // Trample this.addAbility(TrampleAbility.getInstance()); - // Whenever Mindleech Mass deals combat damage to a player, you may look at that player's hand. If you do, you may cast a nonland card in it without paying that card's mana cost. + // Whenever Mindleech Mass deals combat damage to a player, you may look at that + // player's hand. If you do, you may cast a nonland card in it without paying that card's mana cost. this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new MindleechMassEffect(), true, true)); } @@ -56,7 +56,8 @@ class MindleechMassEffect extends OneShotEffect { public MindleechMassEffect() { super(Outcome.PlayForFree); - this.staticText = "you may look at that player's hand. If you do, you may cast a nonland card in it without paying that card's mana cost"; + this.staticText = "you may look at that player's hand. If you do, " + + "you may cast a nonland card in it without paying that card's mana cost"; } public MindleechMassEffect(final MindleechMassEffect effect) { @@ -82,7 +83,10 @@ class MindleechMassEffect extends OneShotEffect { if (controller.chooseTarget(Outcome.PlayForFree, cardsInHand, target, source, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { - controller.cast(card.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game)); + game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE); + controller.cast(controller.chooseAbilityForCast(card, game, true), + game, true, new MageObjectReference(source.getSourceObject(game), game)); + game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null); } } } diff --git a/Mage.Sets/src/mage/cards/p/PanopticMirror.java b/Mage.Sets/src/mage/cards/p/PanopticMirror.java index d724c32dab..f911ddb64f 100644 --- a/Mage.Sets/src/mage/cards/p/PanopticMirror.java +++ b/Mage.Sets/src/mage/cards/p/PanopticMirror.java @@ -1,4 +1,3 @@ - package mage.cards.p; import java.util.UUID; @@ -84,7 +83,7 @@ class PanopticMirrorExileEffect extends OneShotEffect { } TargetCardInHand target = new TargetCardInHand(filter); - if (player.choose(this.outcome, target, source.getSourceId(), game)) { + if (player.choose(outcome.PlayForFree, target, source.getSourceId(), game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { card.moveToExile(CardUtil.getCardExileZoneId(game, source), "Panoptic Mirror", source.getSourceId(), game); @@ -103,7 +102,7 @@ class PanopticMirrorCastEffect extends OneShotEffect { public PanopticMirrorCastEffect() { super(Outcome.ReturnToHand); - this.staticText = "you may copy a card exiled with Panoptic Mirror. If you do, you may cast the copy without paying its mana cost"; + this.staticText = "you may copy a card exiled with {this}. If you do, you may cast the copy without paying its mana cost"; } public PanopticMirrorCastEffect(final PanopticMirrorCastEffect effect) { @@ -122,7 +121,10 @@ class PanopticMirrorCastEffect extends OneShotEffect { if (PanopticMirror == null) { PanopticMirror = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); } - if (PanopticMirror != null && PanopticMirror.getImprinted() != null && !PanopticMirror.getImprinted().isEmpty() && controller != null) { + if (PanopticMirror != null + && PanopticMirror.getImprinted() != null + && !PanopticMirror.getImprinted().isEmpty() + && controller != null) { CardsImpl cards = new CardsImpl(); for (UUID uuid : PanopticMirror.getImprinted()) { Card card = game.getCard(uuid); @@ -145,8 +147,11 @@ class PanopticMirrorCastEffect extends OneShotEffect { } if (cardToCopy != null) { Card copy = game.copyCard(cardToCopy, source, source.getControllerId()); - if (controller.chooseUse(outcome, "Cast the copied card without paying mana cost?", source, game)) { - return controller.cast(copy.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game)); + if (controller.chooseUse(outcome.PlayForFree, "Cast the copied card without paying mana cost?", source, game)) { + game.getState().setValue("PlayFromNotOwnHandZone" + copy.getId(), Boolean.TRUE); + controller.cast(controller.chooseAbilityForCast(copy, game, true), + game, true, new MageObjectReference(source.getSourceObject(game), game)); + game.getState().setValue("PlayFromNotOwnHandZone" + copy.getId(), null); } } return true; diff --git a/Mage.Sets/src/mage/cards/v/VillainousWealth.java b/Mage.Sets/src/mage/cards/v/VillainousWealth.java index e45e4eded9..15fc750974 100644 --- a/Mage.Sets/src/mage/cards/v/VillainousWealth.java +++ b/Mage.Sets/src/mage/cards/v/VillainousWealth.java @@ -1,4 +1,3 @@ - package mage.cards.v; import java.util.UUID; @@ -29,7 +28,8 @@ public final class VillainousWealth extends CardImpl { public VillainousWealth(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{B}{G}{U}"); - // Target opponent exiles the top X cards of their library. You may cast any number of nonland cards with converted mana cost X or less from among them without paying their mana cost. + // Target opponent exiles the top X cards of their library. You may cast any number of nonland cards + // with converted mana cost X or less from among them without paying their mana cost. this.getSpellAbility().addTarget(new TargetOpponent()); this.getSpellAbility().addEffect(new VillainousWealthEffect()); @@ -49,7 +49,9 @@ class VillainousWealthEffect extends OneShotEffect { public VillainousWealthEffect() { super(Outcome.PlayForFree); - this.staticText = "Target opponent exiles the top X cards of their library. You may cast any number of nonland cards with converted mana cost X or less from among them without paying their mana cost"; + this.staticText = "Target opponent exiles the top X cards of their library. " + + "You may cast any number of nonland cards with converted mana cost X " + + "or less from among them without paying their mana cost"; } public VillainousWealthEffect(final VillainousWealthEffect effect) { @@ -74,7 +76,8 @@ class VillainousWealthEffect extends OneShotEffect { Cards cardsToExile = new CardsImpl(); cardsToExile.addAll(player.getLibrary().getTopCards(game, source.getManaCostsToPay().getX())); controller.moveCards(cardsToExile, Zone.EXILED, source, game); - if (controller.chooseUse(Outcome.PlayForFree, "Cast cards exiled with " + mageObject.getLogName() + " without paying its mana cost?", source, game)) { + if (controller.chooseUse(Outcome.PlayForFree, "Cast cards exiled with " + mageObject.getLogName() + + " without paying its mana cost?", source, game)) { OuterLoop: while (cardsToExile.count(filter, game) > 0) { if (!controller.canRespond()) { @@ -82,11 +85,17 @@ class VillainousWealthEffect extends OneShotEffect { } TargetCardInExile target = new TargetCardInExile(0, 1, filter, exileId, false); target.setNotTarget(true); - while (cardsToExile.count(filter, game) > 0 && controller.choose(Outcome.PlayForFree, cardsToExile, target, game)) { + while (cardsToExile.count(filter, game) > 0 + && controller.choose(Outcome.PlayForFree, cardsToExile, target, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { - controller.cast(card.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game)); - cardsToExile.remove(card); + game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE); + Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true), + game, true, new MageObjectReference(source.getSourceObject(game), game)); + game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null); + if (cardWasCast) { + cardsToExile.remove(card); + } } else { break OuterLoop; }