Menu

Submission for Goblin Guide

126

Config

name=Goblin Guide
image=http://mtgimage.com/card/goblin%20guide.jpg
value=2.500
rarity=R
type=Creature
subtype=Goblin,Scout
cost={R}
pt=2/2
ability=Haste
timing=main
requires_groovy_code
oracle=Haste. Whenever Goblin Guide attacks, defending player reveals the top card of his or her library. If it's a land card, that player puts it into his or her hand.

Script

[
     new MagicWhenSelfAttacksTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent attacker) {
            return new MagicEvent(
                permanent,
                game.getDefendingPlayer(),
                this,
                "PN reveals the top card of his or her library. If it's a land card, PN puts it into his or her hand."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            for (final MagicCard card : game.getDefendingPlayer().getLibrary().getCardsFromTop(1)) {
                game.doAction(new MagicRemoveCardAction(
                    card,
                    MagicLocationType.OwnersLibrary
                ));
            if (card.hasType(MagicType.Land)) {
            game.doAction(new MagicMoveCardAction(
                    card,
                    MagicLocationType.OwnersLibrary,
                    MagicLocationType.OwnersHand));
            } else {
            game.doAction(new MagicMoveCardAction(
                    card,
                    MagicLocationType.OwnersLibrary,
                    MagicLocationType.TopOfOwnersLibrary));
            }
            }
        }
    }
]
Pushed