Menu

Submission for Foxfire

157

Config

name=Foxfire
image=http://mtgimage.com/card/foxfire.jpg
value=2.500
rarity=C
type=Instant
cost={2}{G}
timing=block
requires_groovy_code
oracle=Untap target attacking creature. Prevent all combat damage that would be dealt to and dealt by that creature this turn. Draw a card at the beginning of the next turn's upkeep.

Script

[
    new MagicSpellCardEvent() {
        @Override
        public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
            return new MagicEvent(
                cardOnStack,
                new MagicTargetChoice("target attacking creature"),
                MagicPreventTargetPicker.create(),     
                this,
                "Untap target attacking creature\$. " + 
                "Prevent all combat damage that would be dealt to and dealt by that creature this turn."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetPermanent(game, {
                game.doAction(new MagicUntapAction(it));
                game.doAction(new MagicAddTurnTriggerAction(
                    it,
                    MagicIfDamageWouldBeDealtTrigger.PreventCombatDamageDealtToDealtBy
                ));
                game.doAction(new MagicAddTriggerAction(
                    MagicAtUpkeepTrigger.YouDraw(
                        event.getSource(), 
                        event.getPlayer()
                    )
                ));
            });
        }
    }
]
Pushed