Menu

Submission for Hammer Mage

193

Config

name=Hammer Mage
image=http://mtgimage.com/card/hammer%20mage.jpg
value=2.500
rarity=U
type=Creature
subtype=Human,Spellshaper
cost={1}{R}
pt=1/1
timing=main
requires_groovy_code
oracle={X}{R}, {T}, Discard a card: Destroy all artifacts with converted mana cost X or less.

Script

[
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Removal),
        "Destroy"
    ) {
		@Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [
                new MagicTapEvent(source),
		  new MagicPayManaCostEvent(source,"{X}{R}"),
			new MagicDiscardEvent(source)
            ];
        }

        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                payedCost.getX(),
                this,
                "Destroy all artifacts with converted mana cost RN or less."
            );
        }

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