Menu

Submission for Keeper of the Light

8

Config

name=Keeper of the Light
image=http://magiccards.info/scans/en/ex/8.jpg
value=2.500
rarity=U
type=Creature
subtype=Human,Wizard
cost={W}{W}
pt=1/2
timing=main
requires_groovy_code
oracle={W}, {T}: Choose target opponent who had more life than you did as you activated this ability. You gain 3 life.

Script

def OPPONENT_WHO_HAS_MORE_LIFE = new MagicPlayerFilterImpl() {
    public boolean accept(final MagicSource source,final MagicPlayer player,final MagicPlayer target) {
        return target.isEnemy(player) && target.getLife() > player.getLife();
    } 
};

def TARGET_OPPONENT_WHO_HAS_MORE_LIFE = new MagicTargetChoice(
    OPPONENT_WHO_HAS_MORE_LIFE,
    "target opponent who has more life than you"
);

[
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Pump),
        "+Life"
    ) {
        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [
                new MagicPayManaCostEvent(source,"{W}"),
                new MagicTapEvent(source)
            ];
        }

        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                TARGET_OPPONENT_WHO_HAS_MORE_LIFE,
                this,
                "PN gains 3 life."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            game.addEvent(MagicRuleEventAction.create("You gain 3 life.").getEvent(event.getSource()));
        }
    }
]
Pushed