Menu

Submission for Molten-Tail Masticore

177

Config

name=Molten-Tail Masticore
image=http://mtgimage.com/card/molten-tail%20masticore.jpg
value=2.500
rarity=M
type=Artifact,Creature
subtype=Masticore
cost={4}
pt=4/4
ability={2}: Regenerate SN.
timing=main
requires_groovy_code
oracle=At the beginning of your upkeep, sacrifice Molten-Tail Masticore unless you discard a card. {4}, Exile a creature card from your graveyard: Molten-Tail Masticore deals 4 damage to target creature or player. {2}: Regenerate Molten-Tail Masticore.

Script

def choice = new MagicTargetChoice("a creature card from your graveyard");

def EFFECT = MagicRuleEventAction.create("SN deals 4 damage to target creature or player.");

[
    new MagicAtYourUpkeepTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
            return new MagicEvent(
                permanent,
                new MagicMayChoice("Discard a card?"),
                this,
                "PN may\$ discard a card. If PN doesn't, sacrifice SN."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final MagicEvent discard = new MagicDiscardEvent(event.getSource(), event.getPlayer());
            if (event.isYes() && discard.isSatisfied()) {
                game.addEvent(discard);
            } else {
                game.doAction(new MagicSacrificeAction(event.getPermanent()));
            }
        }
    },
    new MagicPermanentActivation(
        [MagicConditionFactory.GraveyardAtLeast(1)],
        new MagicActivationHints(MagicTiming.Removal),
        "Damage"
    ) {

        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [
                new MagicPayManaCostEvent(source,"{4}"),
                new MagicExileCardEvent(source, choice)
            ];
        }

        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
            return EFFECT.getEvent(source);
        }
    }
]
Pushed