Menu

Submission for Harsh Sustenance

154

Config

name=Harsh Sustenance
image=http://mtgimage.com/card/harsh%20sustenance.jpg
value=2.500
rarity=C
type=Instant
cost={1}{W}{B}
timing=removal
requires_groovy_code
oracle=Harsh Sustenance deals X damage to target creature or player and you gain X life, where X is the number of creatures you control.

Script

[
    new MagicSpellCardEvent() {
        @Override
        public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
            final int X = cardOnStack.getController().getNrOfPermanents(MagicType.Creature);
            return new MagicEvent(
                cardOnStack,
                MagicTargetChoice.NEG_TARGET_CREATURE_OR_PLAYER,
                new MagicDamageTargetPicker(X),
                this,
                "SN deals X damage to target creature or player\$ and PN gains X life, where X is the number of creatures PN controls."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTarget(game, {
                final int X = event.getPlayer().getNrOfPermanents(MagicType.Creature);
                final MagicDamage damage=new MagicDamage(event.getSource(),it,X);
                game.doAction(new MagicDealDamageAction(damage));
                game.doAction(new MagicChangeLifeAction(event.getPlayer(),X));
            });
        }
    }
]
Pushed