Menu

Submission for Spellstutter Sprite

65

Config

name=Spellstutter Sprite
image=http://mtgimage.com/card/spellstutter%20sprite.jpg
value=2.500
rarity=C
type=Creature
subtype=Faerie,Wizard
cost={1}{U}
pt=1/1
ability=Flash;\
        Flying
timing=counter
requires_groovy_code
oracle=Flash. Flying. When Spellstutter Sprite enters the battlefield, counter target spell with converted mana cost X or less, where X is the number of Faeries you control.

Script

def SPELL_WITH_CONVERTED_COST_X_OR_LESS=new MagicStackFilterImpl() {
    public boolean accept(final MagicGame game,final MagicPlayer player,final MagicItemOnStack target) {
        return target.isSpell() && target.getConvertedCost() <= player.getNrOfPermanents(MagicSubType.Faerie);
    } 
};

def TARGET_SPELL_WITH_CONVERTED_COST_X_OR_LESS = new MagicTargetChoice(
    SPELL_WITH_CONVERTED_COST_X_OR_LESS,
    "target spell with converted mana cost X or less"
);

[
    new MagicWhenComesIntoPlayTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent permanent, final MagicPayedCost payedCost) {
            return new MagicEvent(
                permanent,
                TARGET_SPELL_WITH_CONVERTED_COST_X_OR_LESS,
                this,
                "Counter target spell\$ with converted mana cost X or less," + "where X is the number of Faeries you control."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetCardOnStack(game, {
                    game.doAction(new MagicCounterItemOnStackAction(it));
                });
        }
    }
]
Pushed