Implemented Topple the Statue

This commit is contained in:
Evan Kranzler 2019-04-10 15:14:39 -04:00
parent cf265ed6a9
commit 33b6e13d11
2 changed files with 69 additions and 0 deletions

View file

@ -0,0 +1,68 @@
package mage.cards.t;
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.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ToppleTheStatue extends CardImpl {
public ToppleTheStatue(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}");
// Tap target permanent. If it's an artifact, destroy it.
// Draw a card.
this.getSpellAbility().addEffect(new ToppleTheStatueEffect());
this.getSpellAbility().addTarget(new TargetPermanent());
}
private ToppleTheStatue(final ToppleTheStatue card) {
super(card);
}
@Override
public ToppleTheStatue copy() {
return new ToppleTheStatue(this);
}
}
class ToppleTheStatueEffect extends OneShotEffect {
ToppleTheStatueEffect() {
super(Outcome.Benefit);
staticText = "Tap target permanent. If it's an artifact, destroy it.<br>Draw a card.";
}
private ToppleTheStatueEffect(final ToppleTheStatueEffect effect) {
super(effect);
}
@Override
public ToppleTheStatueEffect copy() {
return new ToppleTheStatueEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
permanent.tap(game);
if (permanent.isArtifact()) {
permanent.destroy(source.getSourceId(), game, false);
}
return new DrawCardSourceControllerEffect(1).apply(game, source);
}
}

View file

@ -169,6 +169,7 @@ public final class WarOfTheSpark extends ExpansionSet {
cards.add(new SetCardInfo("Tibalt, Rakish Instigator", 146, Rarity.UNCOMMON, mage.cards.t.TibaltRakishInstigator.class));
cards.add(new SetCardInfo("Time Wipe", 223, Rarity.RARE, mage.cards.t.TimeWipe.class));
cards.add(new SetCardInfo("Tolsimir, Friend to Wolves", 224, Rarity.RARE, mage.cards.t.TolsimirFriendToWolves.class));
cards.add(new SetCardInfo("Topple the Statue", 35, Rarity.COMMON, mage.cards.t.ToppleTheStatue.class));
cards.add(new SetCardInfo("Totally Lost", 74, Rarity.COMMON, mage.cards.t.TotallyLost.class));
cards.add(new SetCardInfo("Turret Ogre", 148, Rarity.COMMON, mage.cards.t.TurretOgre.class));
cards.add(new SetCardInfo("Vivien's Arkbow", 181, Rarity.RARE, mage.cards.v.ViviensArkbow.class));