Menu

Submission for Fruit of the First Tree

132

Config

name=Fruit of the First Tree
image=http://mtgimage.com/card/fruit%20of%20the%20first%20tree.jpg
value=2.500
rarity=U
type=Enchantment
subtype=Aura
cost={3}{G}
timing=aura
enchant=pump,creature
requires_groovy_code
oracle=Enchant creature. When enchanted creature dies, you gain X life and draw X cards, where X is its toughness.

Script

[
    new MagicWhenOtherDiesTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent died) {
            return (permanent.getEnchantedPermanent() == died) ?
                new MagicEvent(
                    permanent,
                    permanent.getEnchantedPermanent(),
                    this,
                    "PN gains X life and draws X cards, where X is RN's toughness."
                ):
                MagicEvent.NONE;
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final int toughness = event.getRefPermanent().getToughness();
                game.doAction(new MagicChangeLifeAction(event.getPlayer(),toughness));
                game.doAction(new MagicDrawAction(event.getPlayer(),toughness));
        }
    }
]
Pushed