Menu

Submission for Coiling Oracle

188

Config

name=Coiling Oracle
image=http://mtgimage.com/card/coiling%20oracle.jpg
value=2.500
rarity=C
type=Creature
subtype=Snake,Elf,Druid
cost={G}{U}
pt=1/1
timing=main
requires_groovy_code
oracle=When Coiling Oracle enters the battlefield, reveal the top card of your library. If it's a land card, put it onto the battlefield. Otherwise, put that card into your hand.

Script

[
     new MagicWhenComesIntoPlayTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent permanent, final MagicPayedCost payedCost) {
            return new MagicEvent(
               permanent,
                this,
                "Reveal the top card of PN's library. If that card is a land card, put it onto the battlefield." + " Otherwise, put that card into your hand."
            );
        }
        @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
                ));
            if (card.hasType(MagicType.Land)) {
            game.doAction(new MagicPlayCardAction(
                        card,
                        event.getPlayer()
                    ));            } else {
            game.doAction(new MagicMoveCardAction(
                    card,
                    MagicLocationType.OwnersLibrary,
                    MagicLocationType.OwnersHand
                ));
            }
            }
        }
    }
]
Pushed