Menu

Submission for Chaos Harlequin

102

Config

name=Chaos Harlequin
image=http://mtgimage.com/card/chaos%20harlequin.jpg
value=2.500
rarity=R
type=Creature
subtype=Human
cost={2}{R}{R}
pt=2/4
timing=main
requires_groovy_code
oracle={R}: Exile the top card of your library. If that card is a land card, Chaos Harlequin gets -4/-0 until end of turn. Otherwise, Chaos Harlequin gets +2/+0 until end of turn.

Script

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

        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                this,
                "Exile the top card of PN's library. If that card is a land card, SN gets -4/-0 until end of turn." + " Otherwise, SN gets +2/+0 until end of turn."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            for (final MagicCard card : event.getPlayer().getLibrary().getCardsFromTop(1)) {
                game.doAction(new MagicRemoveCardAction(
                    card,
                    MagicLocationType.OwnersLibrary
                ));
                game.doAction(new MagicMoveCardAction(
                    card,
                    MagicLocationType.OwnersLibrary,
                      MagicLocationType.Exile
                ));
            if (card.hasType(MagicType.Land)) {
            game.doAction(new MagicChangeTurnPTAction(event.getPermanent(), -4, -0));
            } else {
            game.doAction(new MagicChangeTurnPTAction(event.getPermanent(), +2, +0));
            }
            }
        }
    }
]
Pushed