Menu

Submission for Alabaster Potion

2

Config

name=Alabaster Potion
image=http://magiccards.info/scans/en/me3/2.jpg
value=2.500
rarity=U
type=Instant
cost={X}{W}{W}
timing=pump
requires_groovy_code
oracle=Choose one — • Target player gains X life. • Prevent the next X damage that would be dealt to target creature or player this turn.

Script

[
    new MagicSpellCardEvent() {
        @Override
        public MagicEvent getEvent(final MagicCardOnStack cardOnStack, final MagicPayedCost payedCost) {
            return new MagicEvent(
                cardOnStack,
                new MagicOrChoice(
                    MagicTargetChoice.POS_TARGET_PLAYER,
                    MagicTargetChoice.POS_TARGET_CREATURE_OR_PLAYER
                ),
                payedCost.getX(),
                this,
                "Choose one\$ - target player gains X life; " +
                "or prevent the next X damage that would be dealt to target creature or player this turn.\$" 
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final int X = event.getRefInt();
            if (event.isMode(1)) {
                event.processTargetPlayer(game, {
                    game.doAction(new MagicChangeLifeAction(it,X));
                });
            } else if (event.isMode(2)) {
                event.processTarget(game, {
                game.doAction(new MagicPreventDamageAction(it,X));
                });
            }
        }
    }
]
Pushed