Implement Track Down from Core 2021 (#6667)

This commit is contained in:
arcox 2020-06-19 20:52:46 +00:00 committed by GitHub
parent c22c93ea90
commit 71729f5a78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 85 additions and 0 deletions

View file

@ -0,0 +1,84 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.keyword.ScryEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
/**
* @author arcox
*/
public final class TrackDown extends CardImpl {
public TrackDown(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}");
// Scry 3, then reveal the top card of your library. If its a creature or land card, draw a card.
this.getSpellAbility().addEffect(new ScryEffect(3));
this.getSpellAbility().addEffect(new TrackDownEffect());
}
public TrackDown(final TrackDown card) {
super(card);
}
@Override
public TrackDown copy() {
return new TrackDown(this);
}
}
class TrackDownEffect extends OneShotEffect {
public TrackDownEffect() {
super(Outcome.DrawCard);
this.staticText = "then reveal the top card of your library. If its a creature or land card, draw a card";
}
public TrackDownEffect(final TrackDownEffect effect) {
super(effect);
}
@Override
public TrackDownEffect copy() {
return new TrackDownEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject == null || controller == null) {
return false;
}
if (!controller.getLibrary().hasCards()) {
return false;
}
Card card = controller.getLibrary().getFromTop(game);
if (card == null) {
return false;
}
CardsImpl cards = new CardsImpl();
cards.add(card);
controller.revealCards(sourceObject.getName(), cards, game);
if (card.isLand() || card.isCreature()) {
controller.drawCards(1, source.getSourceId(), game);
}
return true;
}
}

View file

@ -274,6 +274,7 @@ public final class CoreSet2021 extends ExpansionSet {
cards.add(new SetCardInfo("Tolarian Kraken", 80, Rarity.UNCOMMON, mage.cards.t.TolarianKraken.class));
cards.add(new SetCardInfo("Tome Anima", 81, Rarity.COMMON, mage.cards.t.TomeAnima.class));
cards.add(new SetCardInfo("Tormod's Crypt", 241, Rarity.UNCOMMON, mage.cards.t.TormodsCrypt.class));
cards.add(new SetCardInfo("Track Down", 211, Rarity.COMMON, mage.cards.t.TrackDown.class));
cards.add(new SetCardInfo("Traitorous Greed", 166, Rarity.UNCOMMON, mage.cards.t.TraitorousGreed.class));
cards.add(new SetCardInfo("Tranquil Cove", 258, Rarity.COMMON, mage.cards.t.TranquilCove.class));
cards.add(new SetCardInfo("Transmogrify", 167, Rarity.RARE, mage.cards.t.Transmogrify.class));