Implemented Cling to Dust

This commit is contained in:
Evan Kranzler 2019-12-31 12:28:09 -05:00
parent 2022bd9bb1
commit 65c960de69
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,79 @@
package mage.cards.c;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.EscapeAbility;
import mage.cards.Card;
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.players.Player;
import mage.target.common.TargetCardInGraveyard;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ClingToDust extends CardImpl {
public ClingToDust(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}");
// Exile target card from a graveyard. If it was a creature card, you gain 3 life. Otherwise, you draw a card.
this.getSpellAbility().addEffect(new ClingToDustEffect());
this.getSpellAbility().addTarget(new TargetCardInGraveyard());
// Escape{3}{B}, Exile five other cards from your graveyard.
this.addAbility(new EscapeAbility(this, "{3}{B}", 5));
}
private ClingToDust(final ClingToDust card) {
super(card);
}
@Override
public ClingToDust copy() {
return new ClingToDust(this);
}
}
class ClingToDustEffect extends OneShotEffect {
ClingToDustEffect() {
super(Outcome.Benefit);
staticText = "exile target card from a graveyard. If it was a creature card, " +
"you gain 3 life. Otherwise, you draw a card";
}
private ClingToDustEffect(final ClingToDustEffect effect) {
super(effect);
}
@Override
public ClingToDustEffect copy() {
return new ClingToDustEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Card card = game.getCard(source.getFirstTarget());
if (player == null || card == null) {
return false;
}
boolean isCreature = card.isCreature();
if (!player.moveCards(card, Zone.EXILED, source, game)) {
return false;
}
if (isCreature) {
player.gainLife(3, game, source);
} else {
player.drawCards(1, game);
}
return true;
}
}

View file

@ -32,6 +32,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Athreos, Shroud-Veiled", 269, Rarity.MYTHIC, mage.cards.a.AthreosShroudVeiled.class));
cards.add(new SetCardInfo("Banishing Light", 4, Rarity.UNCOMMON, mage.cards.b.BanishingLight.class));
cards.add(new SetCardInfo("Brine Giant", 44, Rarity.COMMON, mage.cards.b.BrineGiant.class));
cards.add(new SetCardInfo("Cling to Dust", 87, Rarity.UNCOMMON, mage.cards.c.ClingToDust.class));
cards.add(new SetCardInfo("Commanding Presence", 7, Rarity.UNCOMMON, mage.cards.c.CommandingPresence.class));
cards.add(new SetCardInfo("Daxos, Blessed by the Sun", 9, Rarity.UNCOMMON, mage.cards.d.DaxosBlessedByTheSun.class));
cards.add(new SetCardInfo("Deathbellow War Cry", 294, Rarity.RARE, mage.cards.d.DeathbellowWarCry.class));