From 7f81fc64374ed6d7ea90ea072aac9baa4dd21024 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 20 Sep 2018 20:06:34 -0400 Subject: [PATCH] Implemented Devious Cover-up --- .../src/mage/cards/d/DeviousCoverUp.java | 83 +++++++++++++++++++ Mage.Sets/src/mage/sets/GuildsOfRavnica.java | 1 + 2 files changed, 84 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DeviousCoverUp.java diff --git a/Mage.Sets/src/mage/cards/d/DeviousCoverUp.java b/Mage.Sets/src/mage/cards/d/DeviousCoverUp.java new file mode 100644 index 00000000000..6df5646a40a --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DeviousCoverUp.java @@ -0,0 +1,83 @@ +package mage.cards.d; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CounterTargetWithReplacementEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetSpell; +import mage.target.common.TargetCardInYourGraveyard; +import mage.target.targetpointer.SecondTargetPointer; + +/** + * + * @author TheElk801 + */ +public final class DeviousCoverUp extends CardImpl { + + public DeviousCoverUp(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}{U}"); + + // Counter target spell. If that spell is countered this way, exile it instead of putting it into its owner's graveyard. + this.getSpellAbility().addEffect(new CounterTargetWithReplacementEffect(Zone.EXILED)); + this.getSpellAbility().addTarget(new TargetSpell()); + + // You may shuffle up to four target cards from your graveyard into your library. + this.getSpellAbility().addEffect(new DeviousCoverUpEffect().setTargetPointer(new SecondTargetPointer())); + this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(0, 5)); + } + + public DeviousCoverUp(final DeviousCoverUp card) { + super(card); + } + + @Override + public DeviousCoverUp copy() { + return new DeviousCoverUp(this); + } +} + +class DeviousCoverUpEffect extends OneShotEffect { + + public DeviousCoverUpEffect() { + super(Outcome.Benefit); + this.staticText = "You may shuffle up to five target cards " + + "from your graveyard into your library."; + } + + public DeviousCoverUpEffect(final DeviousCoverUpEffect effect) { + super(effect); + } + + @Override + public DeviousCoverUpEffect copy() { + return new DeviousCoverUpEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getFirstTarget()); + if (player == null || !player.chooseUse(outcome, "Shuffle the targeted cards into your library?", source, game)) { + return false; + } + Cards cards = new CardsImpl(); + for (UUID targetId : targetPointer.getTargets(game, source)) { + Card card = game.getCard(targetId); + if (card != null) { + cards.add(card); + } + } + player.getLibrary().addAll(cards.getCards(game), game); + player.shuffleLibrary(source, game); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java index feb87734c55..62ce736e7ea 100644 --- a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java +++ b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java @@ -71,6 +71,7 @@ public final class GuildsOfRavnica extends ExpansionSet { cards.add(new SetCardInfo("Dead Weight", 67, Rarity.COMMON, mage.cards.d.DeadWeight.class)); cards.add(new SetCardInfo("Deadly Visit", 68, Rarity.COMMON, mage.cards.d.DeadlyVisit.class)); cards.add(new SetCardInfo("Deafening Clarion", 165, Rarity.RARE, mage.cards.d.DeafeningClarion.class)); + cards.add(new SetCardInfo("Devious Cover-up", 35, Rarity.COMMON, mage.cards.d.DeviousCoverUp.class)); cards.add(new SetCardInfo("Devkarin Dissident", 127, Rarity.COMMON, mage.cards.d.DevkarinDissident.class)); cards.add(new SetCardInfo("Dimir Guildgate", 245, Rarity.COMMON, mage.cards.d.DimirGuildgate.class)); cards.add(new SetCardInfo("Dimir Guildgate", 246, Rarity.COMMON, mage.cards.d.DimirGuildgate.class));