diff --git a/Mage.Sets/src/mage/cards/g/GripOfAmnesia.java b/Mage.Sets/src/mage/cards/g/GripOfAmnesia.java new file mode 100644 index 00000000000..d89a6ce0f90 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GripOfAmnesia.java @@ -0,0 +1,76 @@ +package mage.cards.g; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.players.Player; +import mage.target.TargetSpell; + +/** + * + * @author weirddan455 + */ +public final class GripOfAmnesia extends CardImpl { + + public GripOfAmnesia(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); + + // Counter target spell unless its controller exiles all cards from their graveyard. + // Draw a card. + this.getSpellAbility().addEffect(new GripOfAmnesiaEffect()); + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1)); + this.getSpellAbility().addTarget(new TargetSpell()); + } + + private GripOfAmnesia(final GripOfAmnesia card) { + super(card); + } + + @Override + public GripOfAmnesia copy() { + return new GripOfAmnesia(this); + } +} + +class GripOfAmnesiaEffect extends OneShotEffect { + + public GripOfAmnesiaEffect() { + super(Outcome.Detriment); + staticText = "Counter target spell unless its controller exiles all cards from their graveyard"; + } + + private GripOfAmnesiaEffect(final GripOfAmnesiaEffect effect) { + super(effect); + } + + @Override + public GripOfAmnesiaEffect copy() { + return new GripOfAmnesiaEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Spell spell = game.getStack().getSpell(source.getFirstTarget()); + if (spell != null) { + Player controller = game.getPlayer(spell.getControllerId()); + if (controller != null && controller.chooseUse(Outcome.Benefit, "Exile all cards from your graveyard? (Otherwise " + + spell.getLogName() + " will be countered)", source, game)) { + controller.moveCards(controller.getGraveyard(), Zone.EXILED, source, game); + game.informPlayers(controller.getLogName() + " exiles all cards from their graveyard to prevent counter effect"); + } else { + game.getStack().counter(spell.getId(), source, game); + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Judgment.java b/Mage.Sets/src/mage/sets/Judgment.java index f72ecc1915c..c21637ed783 100644 --- a/Mage.Sets/src/mage/sets/Judgment.java +++ b/Mage.Sets/src/mage/sets/Judgment.java @@ -84,6 +84,7 @@ public final class Judgment extends ExpansionSet { cards.add(new SetCardInfo("Glory", 11, Rarity.RARE, mage.cards.g.Glory.class)); cards.add(new SetCardInfo("Golden Wish", 12, Rarity.RARE, mage.cards.g.GoldenWish.class)); cards.add(new SetCardInfo("Goretusk Firebeast", 91, Rarity.COMMON, mage.cards.g.GoretuskFirebeast.class)); + cards.add(new SetCardInfo("Grip of Amnesia", 41, Rarity.COMMON, mage.cards.g.GripOfAmnesia.class)); cards.add(new SetCardInfo("Grizzly Fate", 119, Rarity.UNCOMMON, mage.cards.g.GrizzlyFate.class)); cards.add(new SetCardInfo("Guided Strike", 13, Rarity.COMMON, mage.cards.g.GuidedStrike.class)); cards.add(new SetCardInfo("Guiltfeeder", 68, Rarity.RARE, mage.cards.g.Guiltfeeder.class));