Menu

Submission for Exile

27

Config

name=Exile
image=http://mtgimage.com/card/exile.jpg
value=2.500
rarity=R
type=Instant
cost={2}{W}
timing=removal
requires_groovy_code
oracle=Exile target nonwhite attacking creature. You gain life equal to its toughness.

Script

def NONWHITE_ATTACKING_CREATURE=new MagicPermanentFilterImpl() {
    public boolean accept(final MagicGame game,final MagicPlayer player,final MagicPermanent target) {
        return target.isCreature() && !target.hasColor(MagicColor.White) && target.isAttacking();
    } 
};

def TARGET_NONWHITE_ATTACKING_CREATURE = new MagicTargetChoice(
    NONWHITE_ATTACKING_CREATURE,
    "target nonwhite attacking creature"
);

[
    new MagicSpellCardEvent() {
        @Override
        public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
            return new MagicEvent(
                cardOnStack,
                TARGET_NONWHITE_ATTACKING_CREATURE,
                MagicExileTargetPicker.create(),
                this,
                "Exile target nonwhite attacking creature\$. You gain life equal to its toughness."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetPermanent(game, {
                game.doAction(new MagicRemoveFromPlayAction(it,MagicLocationType.Exile));
                game.doAction(new MagicChangeLifeAction(
                    event.getPlayer(),
                    it.getToughness()
                ));
            });
        }
    }
]
Pushed