This commit is contained in:
jeffwadsworth 2019-12-30 15:54:55 -06:00
parent e4591f42f0
commit f95b672bb2
7 changed files with 104 additions and 55 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.d; package mage.cards.d;
import mage.MageInt; import mage.MageInt;
@ -44,7 +43,10 @@ public final class DiluvianPrimordial extends CardImpl {
// Flying // Flying
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// When Diluvian Primordial enters the battlefield, for each opponent, you may cast up to one target instant or sorcery card from that player's graveyard without paying its mana cost. If a card cast this way would be put into a graveyard this turn, exile it instead. // When Diluvian Primordial enters the battlefield, for each opponent,
// you may cast up to one target instant or sorcery card from that
// player's graveyard without paying its mana cost. If a card cast this way
// would be put into a graveyard this turn, exile it instead.
Ability ability = new EntersBattlefieldTriggeredAbility(new DiluvianPrimordialEffect(), false); Ability ability = new EntersBattlefieldTriggeredAbility(new DiluvianPrimordialEffect(), false);
ability.setTargetAdjuster(DiluvianPrimordialAdjuster.instance); ability.setTargetAdjuster(DiluvianPrimordialAdjuster.instance);
this.addAbility(ability); this.addAbility(ability);
@ -71,7 +73,8 @@ enum DiluvianPrimordialAdjuster implements TargetAdjuster {
if (opponent == null) { if (opponent == null) {
continue; continue;
} }
FilterCard filter = new FilterCard("instant or sorcery card from " + opponent.getLogName() + "'s graveyard"); FilterCard filter = new FilterCard("instant or sorcery card from "
+ opponent.getLogName() + "'s graveyard");
filter.add(new OwnerIdPredicate(opponentId)); filter.add(new OwnerIdPredicate(opponentId));
filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY))); filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY)));
TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(0, 1, filter); TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(0, 1, filter);
@ -84,7 +87,10 @@ class DiluvianPrimordialEffect extends OneShotEffect {
public DiluvianPrimordialEffect() { public DiluvianPrimordialEffect() {
super(Outcome.PlayForFree); super(Outcome.PlayForFree);
this.staticText = "for each opponent, you may cast up to one target instant or sorcery card from that player's graveyard without paying its mana cost. If a card cast this way would be put into a graveyard this turn, exile it instead"; this.staticText = "for each opponent, you may cast up to one target "
+ "instant or sorcery card from that player's graveyard without "
+ "paying its mana cost. If a card cast this way would be put "
+ "into a graveyard this turn, exile it instead";
} }
public DiluvianPrimordialEffect(final DiluvianPrimordialEffect effect) { public DiluvianPrimordialEffect(final DiluvianPrimordialEffect effect) {
@ -104,8 +110,12 @@ class DiluvianPrimordialEffect extends OneShotEffect {
if (target instanceof TargetCardInOpponentsGraveyard) { if (target instanceof TargetCardInOpponentsGraveyard) {
Card targetCard = game.getCard(target.getFirstTarget()); Card targetCard = game.getCard(target.getFirstTarget());
if (targetCard != null) { if (targetCard != null) {
if (controller.chooseUse(outcome, "Cast " + targetCard.getLogName() + '?', source, game)) { if (controller.chooseUse(Outcome.PlayForFree, "Cast " + targetCard.getLogName() + '?', source, game)) {
if (controller.cast(targetCard.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game))) { game.getState().setValue("PlayFromNotOwnHandZone" + targetCard.getId(), Boolean.TRUE);
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(targetCard, game, true),
game, true, new MageObjectReference(source.getSourceObject(game), game));
game.getState().setValue("PlayFromNotOwnHandZone" + targetCard.getId(), null);
if (cardWasCast) {
ContinuousEffect effect = new DiluvianPrimordialReplacementEffect(); ContinuousEffect effect = new DiluvianPrimordialReplacementEffect();
effect.setTargetPointer(new FixedTarget(targetCard.getId(), game.getState().getZoneChangeCounter(targetCard.getId()))); effect.setTargetPointer(new FixedTarget(targetCard.getId(), game.getState().getZoneChangeCounter(targetCard.getId())));
game.addEffect(effect, source); game.addEffect(effect, source);

View file

@ -50,7 +50,10 @@ public final class DreadhordeArcanist extends CardImpl {
// Trample // Trample
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
// Whenever Dreadhorde Arcanist attacks, you may cast target instant or sorcery card with converted mana cost less than or equal to Dreadhorde Arcanist's power from your graveyard without paying its mana cost. If that card would be put into your graveyard this turn, exile it instead. // Whenever Dreadhorde Arcanist attacks, you may cast target instant or
// sorcery card with converted mana cost less than or equal to Dreadhorde Arcanist's
// power from your graveyard without paying its mana cost. If that card would be put
// into your graveyard this turn, exile it instead.
Ability ability = new AttacksTriggeredAbility(new DreadhordeArcanistEffect(), false); Ability ability = new AttacksTriggeredAbility(new DreadhordeArcanistEffect(), false);
ability.addTarget(new TargetCardInYourGraveyard(filter)); ability.addTarget(new TargetCardInYourGraveyard(filter));
this.addAbility(ability); this.addAbility(ability);
@ -80,10 +83,10 @@ enum DreadhordeArcanistPredicate implements ObjectSourcePlayerPredicate<ObjectSo
class DreadhordeArcanistEffect extends OneShotEffect { class DreadhordeArcanistEffect extends OneShotEffect {
DreadhordeArcanistEffect() { DreadhordeArcanistEffect() {
super(Outcome.Benefit); super(Outcome.PlayForFree);
this.staticText = "you may cast target instant or sorcery card with converted mana cost " + this.staticText = "you may cast target instant or sorcery card with converted mana cost "
"less than or equal to {this}'s power from your graveyard without paying its mana cost. " + + "less than or equal to {this}'s power from your graveyard without paying its mana cost. "
"If that card would be put into your graveyard this turn, exile it instead."; + "If that card would be put into your graveyard this turn, exile it instead.";
} }
private DreadhordeArcanistEffect(final DreadhordeArcanistEffect effect) { private DreadhordeArcanistEffect(final DreadhordeArcanistEffect effect) {
@ -102,13 +105,12 @@ class DreadhordeArcanistEffect extends OneShotEffect {
return false; return false;
} }
Card card = game.getCard(this.getTargetPointer().getFirst(game, source)); Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
if (card == null if (card != null
|| !controller.chooseUse(outcome, "Cast " + card.getLogName() + '?', source, game) && controller.chooseUse(Outcome.PlayForFree, "Cast " + card.getLogName() + '?', source, game)) {
|| !controller.cast( game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
card.getSpellAbility(), game, true, controller.cast(controller.chooseAbilityForCast(card, game, true),
new MageObjectReference(source.getSourceObject(game), game) game, true, new MageObjectReference(source.getSourceObject(game), game));
)) { game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
return false;
} }
ContinuousEffect effect = new DreadhordeArcanistReplacementEffect(card.getId()); ContinuousEffect effect = new DreadhordeArcanistReplacementEffect(card.getId());
effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId()))); effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId())));

View file

@ -1,4 +1,3 @@
package mage.cards.e; package mage.cards.e;
import mage.MageInt; import mage.MageInt;
@ -132,8 +131,9 @@ class EliteArcanistImprintEffect extends OneShotEffect {
class EliteArcanistCopyEffect extends OneShotEffect { class EliteArcanistCopyEffect extends OneShotEffect {
public EliteArcanistCopyEffect() { public EliteArcanistCopyEffect() {
super(Outcome.Copy); super(Outcome.PlayForFree);
this.staticText = "Copy the exiled card. You may cast the copy without paying its mana cost. X is the converted mana cost of the exiled card"; this.staticText = "Copy the exiled card. You may cast the copy "
+ "without paying its mana cost. X is the converted mana cost of the exiled card";
} }
public EliteArcanistCopyEffect(final EliteArcanistCopyEffect effect) { public EliteArcanistCopyEffect(final EliteArcanistCopyEffect effect) {
@ -151,17 +151,24 @@ class EliteArcanistCopyEffect extends OneShotEffect {
if (sourcePermanent == null) { if (sourcePermanent == null) {
sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
} }
if (sourcePermanent != null && sourcePermanent.getImprinted() != null && !sourcePermanent.getImprinted().isEmpty()) { if (sourcePermanent != null
&& sourcePermanent.getImprinted() != null
&& !sourcePermanent.getImprinted().isEmpty()) {
Card imprintedInstant = game.getCard(sourcePermanent.getImprinted().get(0)); Card imprintedInstant = game.getCard(sourcePermanent.getImprinted().get(0));
if (imprintedInstant != null && game.getState().getZone(imprintedInstant.getId()) == Zone.EXILED) { if (imprintedInstant != null
&& game.getState().getZone(imprintedInstant.getId()) == Zone.EXILED) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId()); Card copiedCard = game.copyCard(imprintedInstant, source, source.getControllerId());
if (copiedCard != null) { if (copiedCard != null) {
game.getExile().add(source.getSourceId(), "", copiedCard); game.getExile().add(source.getSourceId(), "", copiedCard);
game.getState().setZone(copiedCard.getId(), Zone.EXILED); game.getState().setZone(copiedCard.getId(), Zone.EXILED);
if (controller.chooseUse(outcome, "Cast the copied card without paying mana cost?", source, game)) { if (controller.chooseUse(Outcome.PlayForFree, "Cast the copied card without paying mana cost?", source, game)) {
return controller.cast(copiedCard.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game)); game.getState().setValue("PlayFromNotOwnHandZone" + copiedCard.getId(), Boolean.TRUE);
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(copiedCard, game, true),
game, true, new MageObjectReference(source.getSourceObject(game), game));
game.getState().setValue("PlayFromNotOwnHandZone" + copiedCard.getId(), null);
return cardWasCast;
} }
} }
} }

View file

@ -1,4 +1,3 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID; import java.util.UUID;
@ -34,7 +33,8 @@ import mage.target.targetpointer.FixedTarget;
*/ */
public final class GoblinDarkDwellers extends CardImpl { public final class GoblinDarkDwellers extends CardImpl {
private static final FilterInstantOrSorceryCard filter = new FilterInstantOrSorceryCard("instant or sorcery card with converted mana cost 3 or less"); private static final FilterInstantOrSorceryCard filter
= new FilterInstantOrSorceryCard("instant or sorcery card with converted mana cost 3 or less");
static { static {
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 4)); filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 4));
@ -69,8 +69,9 @@ public final class GoblinDarkDwellers extends CardImpl {
class GoblinDarkDwellersEffect extends OneShotEffect { class GoblinDarkDwellersEffect extends OneShotEffect {
GoblinDarkDwellersEffect() { GoblinDarkDwellersEffect() {
super(Outcome.Benefit); super(Outcome.PlayForFree);
this.staticText = "you may cast target instant or sorcery card with converted mana cost 3 or less from your graveyard without paying its mana cost. " this.staticText = "you may cast target instant or sorcery card with "
+ "converted mana cost 3 or less from your graveyard without paying its mana cost. "
+ "If that card would be put into your graveyard this turn, exile it instead"; + "If that card would be put into your graveyard this turn, exile it instead";
} }
@ -89,8 +90,12 @@ class GoblinDarkDwellersEffect extends OneShotEffect {
if (controller != null) { if (controller != null) {
Card card = game.getCard(this.getTargetPointer().getFirst(game, source)); Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
if (card != null) { if (card != null) {
if (controller.chooseUse(outcome, "Cast " + card.getLogName() + '?', source, game)) { if (controller.chooseUse(Outcome.PlayForFree, "Cast " + card.getLogName() + '?', source, game)) {
if (controller.cast(card.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game))) { 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) {
ContinuousEffect effect = new GoblinDarkDwellersReplacementEffect(card.getId()); ContinuousEffect effect = new GoblinDarkDwellersReplacementEffect(card.getId());
effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId()))); effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId())));
game.addEffect(effect, source); game.addEffect(effect, source);

View file

@ -1,4 +1,3 @@
package mage.cards.j; package mage.cards.j;
import java.util.HashSet; import java.util.HashSet;
@ -42,7 +41,8 @@ public final class JacesMindseeker extends CardImpl {
// Flying // Flying
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// When Jace's Mindseeker enters the battlefield, target opponent puts the top five cards of their library into their graveyard. // When Jace's Mindseeker enters the battlefield, target opponent puts
// the top five cards of their library into their graveyard.
// You may cast an instant or sorcery card from among them without paying its mana cost. // You may cast an instant or sorcery card from among them without paying its mana cost.
Ability ability = new EntersBattlefieldTriggeredAbility(new JaceMindseekerEffect()); Ability ability = new EntersBattlefieldTriggeredAbility(new JaceMindseekerEffect());
ability.addTarget(new TargetOpponent()); ability.addTarget(new TargetOpponent());
@ -65,7 +65,9 @@ class JaceMindseekerEffect extends OneShotEffect {
public JaceMindseekerEffect() { public JaceMindseekerEffect() {
super(Outcome.PlayForFree); super(Outcome.PlayForFree);
this.staticText = "target opponent puts the top five cards of their library into their graveyard. You may cast an instant or sorcery card from among them without paying its mana cost"; this.staticText = "target opponent puts the top five cards of their "
+ "library into their graveyard. You may cast an instant or "
+ "sorcery card from among them without paying its mana cost";
} }
public JaceMindseekerEffect(final JaceMindseekerEffect effect) { public JaceMindseekerEffect(final JaceMindseekerEffect effect) {
@ -89,9 +91,11 @@ class JaceMindseekerEffect extends OneShotEffect {
for (Card card : allCards) { for (Card card : allCards) {
if (filter.match(card, game)) { if (filter.match(card, game)) {
Zone zone = game.getState().getZone(card.getId()); Zone zone = game.getState().getZone(card.getId());
// If the five cards are put into a public zone such as exile instead of a graveyard (perhaps due to the ability of Rest in Peace), // If the five cards are put into a public zone such as exile instead
// of a graveyard (perhaps due to the ability of Rest in Peace),
// you can cast one of those instant or sorcery cards from that zone. // you can cast one of those instant or sorcery cards from that zone.
if (zone == Zone.GRAVEYARD || zone == Zone.EXILED) { if (zone == Zone.GRAVEYARD
|| zone == Zone.EXILED) {
cardsToCast.add(card); cardsToCast.add(card);
} }
} }
@ -104,10 +108,13 @@ class JaceMindseekerEffect extends OneShotEffect {
TargetCard target = new TargetCard(Zone.GRAVEYARD, filter); // zone should be ignored here TargetCard target = new TargetCard(Zone.GRAVEYARD, filter); // zone should be ignored here
target.setNotTarget(true); target.setNotTarget(true);
if (controller.chooseUse(outcome, "Cast an instant or sorcery card from among them for free?", source, game) if (controller.chooseUse(outcome, "Cast an instant or sorcery card from among them for free?", source, game)
&& controller.choose(outcome, cardsToCast, target, game)) { && controller.choose(Outcome.PlayForFree, cardsToCast, target, game)) {
Card card = cardsToCast.get(target.getFirstTarget(), game); Card card = cardsToCast.get(target.getFirstTarget(), game);
if (card != null) { 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);
} }
} }
} }

View file

@ -1,4 +1,3 @@
package mage.cards.t; package mage.cards.t;
import java.util.Set; import java.util.Set;
@ -32,8 +31,12 @@ public final class TalentOfTheTelepath extends CardImpl {
public TalentOfTheTelepath(UUID ownerId, CardSetInfo setInfo) { public TalentOfTheTelepath(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}{U}");
// Target opponent reveals the top seven cards of their library. You may cast an instant or sorcery card from among them without paying its mana cost. Then that player puts the rest into their graveyard. // Target opponent reveals the top seven cards of their library.
// <i>Spell mastery</i> &mdash; If there are two or more instant and/or sorcery cards in your graveyard, you may cast up to two revealed instant and/or sorcery cards instead of one. // You may cast an instant or sorcery card from among them without paying
// its mana cost. Then that player puts the rest into their graveyard.
// <i>Spell mastery</i> &mdash; If there are two or more instant and/or
// sorcery cards in your graveyard, you may cast up to two revealed instant
// and/or sorcery cards instead of one.
getSpellAbility().addEffect(new TalentOfTheTelepathEffect()); getSpellAbility().addEffect(new TalentOfTheTelepathEffect());
getSpellAbility().addTarget(new TargetOpponent()); getSpellAbility().addTarget(new TargetOpponent());
@ -55,8 +58,12 @@ class TalentOfTheTelepathEffect extends OneShotEffect {
public TalentOfTheTelepathEffect() { public TalentOfTheTelepathEffect() {
super(Outcome.PlayForFree); super(Outcome.PlayForFree);
this.staticText = "Target opponent reveals the top seven cards of their library. You may cast an instant or sorcery card from among them without paying its mana cost. Then that player puts the rest into their graveyard. " this.staticText = "Target opponent reveals the top seven cards of their "
+ "<BR><i>Spell mastery</i> &mdash; If there are two or more instant and/or sorcery cards in your graveyard, you may cast up to two revealed instant and/or sorcery cards instead of one."; + "library. You may cast an instant or sorcery card from among them "
+ "without paying its mana cost. Then that player puts the rest into their graveyard. "
+ "<BR><i>Spell mastery</i> &mdash; If there are two or more instant "
+ "and/or sorcery cards in your graveyard, you may cast up to two "
+ "revealed instant and/or sorcery cards instead of one.";
} }
public TalentOfTheTelepathEffect(final TalentOfTheTelepathEffect effect) { public TalentOfTheTelepathEffect(final TalentOfTheTelepathEffect effect) {
@ -76,7 +83,8 @@ class TalentOfTheTelepathEffect extends OneShotEffect {
if (targetOpponent != null && sourceObject != null) { if (targetOpponent != null && sourceObject != null) {
Set<Card> allCards = targetOpponent.getLibrary().getTopCards(game, 7); Set<Card> allCards = targetOpponent.getLibrary().getTopCards(game, 7);
Cards cards = new CardsImpl(allCards); Cards cards = new CardsImpl(allCards);
targetOpponent.revealCards(sourceObject.getIdName() + " - " + targetOpponent.getName() + "'s top library cards", cards, game); targetOpponent.revealCards(sourceObject.getIdName() + " - "
+ targetOpponent.getName() + "'s top library cards", cards, game);
for (Card card : allCards) { for (Card card : allCards) {
if (filter.match(card, game)) { if (filter.match(card, game)) {
cardsToCast.add(card); cardsToCast.add(card);
@ -95,15 +103,21 @@ class TalentOfTheTelepathEffect extends OneShotEffect {
target.setNotTarget(true); target.setNotTarget(true);
while (numberOfSpells > 0 while (numberOfSpells > 0
&& !cardsToCast.isEmpty() && !cardsToCast.isEmpty()
&& controller.chooseUse(outcome, "Cast an instant or sorcery card from among them for free?", source, game) && controller.chooseUse(outcome, "Cast an instant or sorcery card "
&& controller.choose(outcome, cardsToCast, target, game)) { + "from among them for free?", source, game)
&& controller.choose(Outcome.PlayForFree, cardsToCast, target, game)) {
Card card = cardsToCast.get(target.getFirstTarget(), game); Card card = cardsToCast.get(target.getFirstTarget(), game);
if (card != null) { if (card != null) {
controller.cast(card.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game)); 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) {
numberOfSpells--; numberOfSpells--;
cardsToCast.remove(card); cardsToCast.remove(card);
allCards.remove(card); allCards.remove(card);
} }
}
if (!controller.canRespond()) { if (!controller.canRespond()) {
return false; return false;
} }

View file

@ -1,4 +1,3 @@
package mage.cards.t; package mage.cards.t;
import java.util.UUID; import java.util.UUID;
@ -49,7 +48,8 @@ public final class TorrentialGearhulk extends CardImpl {
// Flash // Flash
this.addAbility(FlashAbility.getInstance()); this.addAbility(FlashAbility.getInstance());
// When Torrential Gearhulk enters the battlefield, you may cast target instant card from your graveyard without paying its mana cost. // When Torrential Gearhulk enters the battlefield, you may cast target
// instant card from your graveyard without paying its mana cost.
// If that card would be put into your graveyard this turn, exile it instead. // If that card would be put into your graveyard this turn, exile it instead.
Ability ability = new EntersBattlefieldTriggeredAbility(new TorrentialGearhulkEffect()); Ability ability = new EntersBattlefieldTriggeredAbility(new TorrentialGearhulkEffect());
ability.addTarget(new TargetCardInYourGraveyard(filter)); ability.addTarget(new TargetCardInYourGraveyard(filter));
@ -69,7 +69,7 @@ public final class TorrentialGearhulk extends CardImpl {
class TorrentialGearhulkEffect extends OneShotEffect { class TorrentialGearhulkEffect extends OneShotEffect {
TorrentialGearhulkEffect() { TorrentialGearhulkEffect() {
super(Outcome.Benefit); super(Outcome.PlayForFree);
this.staticText = "you may cast target instant card from your graveyard without paying its mana cost. " this.staticText = "you may cast target instant card from your graveyard without paying its mana cost. "
+ "If that card would be put into your graveyard this turn, exile it instead"; + "If that card would be put into your graveyard this turn, exile it instead";
} }
@ -88,9 +88,13 @@ class TorrentialGearhulkEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
Card card = game.getCard(this.getTargetPointer().getFirst(game, source)); Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
if (card != null && card.getSpellAbility() != null) { if (card != null) {
if (controller.chooseUse(outcome, "Cast " + card.getLogName() + '?', source, game)) { if (controller.chooseUse(outcome, "Cast " + card.getLogName() + '?', source, game)) {
if (controller.cast(card.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game))) { 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) {
ContinuousEffect effect = new TorrentialGearhulkReplacementEffect(card.getId()); ContinuousEffect effect = new TorrentialGearhulkReplacementEffect(card.getId());
effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId()))); effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId())));
game.addEffect(effect, source); game.addEffect(effect, source);