Menu

Submission for Pyroblast

142

Config

name=Pyroblast
image=http://mtgimage.com/card/pyroblast.jpg
value=2.500
rarity=C
type=Instant
cost={R}
timing=counter
requires_groovy_code
oracle=Choose one — • Counter target spell if it's blue. • Destroy target permanent if it's blue.

Script

[
    new MagicSpellCardEvent() {
        @Override
        public MagicEvent getEvent(final MagicCardOnStack cardOnStack, final MagicPayedCost payedCost) {
            return new MagicEvent(
                cardOnStack,
                new MagicOrChoice(
                    MagicTargetChoice.TARGET_SPELL,
                    MagicTargetChoice.TARGET_PERMANENT
                ),
                this,
                "Choose one\$ - counter target spell if it's blue; " +
                "or destroy target permanent if it's blue.\$" 
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            if (event.isMode(1)) {
            event.processTargetCardOnStack(game, {
                if (it.hasColor(MagicColor.Blue)) {
                    game.doAction(new MagicCounterItemOnStackAction(it));
                }});
            } else if (event.isMode(2)) {
            event.processTargetPermanent(game, {
               if (it.hasColor(MagicColor.Blue)) {
                   game.doAction(new MagicDestroyAction(it));
                }});
            }
        }
    }
]
Pushed