Menu

Submission for Meltdown

203

Config

name=Meltdown
image=http://mtgimage.com/card/meltdown.jpg
value=2.500
rarity=U
type=Sorcery
cost={X}{R}
timing=main
requires_groovy_code
oracle=Destroy each artifact with converted mana cost X or less.

Script

[
    new MagicSpellCardEvent() {

        @Override
        public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
            final int amount=payedCost.getX();
            return new MagicEvent(
                cardOnStack,
                amount,
                this,
                "Destroy all artifacts with converted mana cost RN or less."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final int amount=event.getRefInt();
            final Collection<MagicPermanent> targets=
                game.filterPermanents(
                    event.getSource().getController(),
                    new MagicCMCPermanentFilter(
                        MagicTargetFilterFactory.ARTIFACT,
                        Operator.LESS_THAN_OR_EQUAL,
                        amount
                    )
                );
            game.doAction(new MagicDestroyAction(targets));
        }
    }
]
Pushed