Implemented Devious Cover-up

This commit is contained in:
Evan Kranzler 2018-09-20 20:06:34 -04:00
parent 6031a16e53
commit 7f81fc6437
2 changed files with 84 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));