Menu

Submission for Dark Confidant

75

Config

name=Dark Confidant
image=http://mtgimage.com/card/dark%20confidant.jpg
value=2.500
rarity=R
type=Creature
subtype=Human,Wizard
cost={1}{B}
pt=2/1
timing=main
requires_groovy_code
oracle=At the beginning of your upkeep, reveal the top card of your library and put that card into your hand. You lose life equal to its converted mana cost.

Script

[
    new MagicAtYourUpkeepTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
            return new MagicEvent(
                permanent,
                this,
                "Reveal the top card of PN's library and put that card into PN's hand. PN loses life equal to its converted mana cost."
            );
        }
        @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.OwnersHand
                ));
            final int amount = card.getConvertedCost();
            game.doAction(new MagicChangeLifeAction(event.getPlayer(), -amount));
            }
        }
    }
]
Pushed