Menu

Submission for Drekavac

43

Config

name=Drekavac
image=http://mtgimage.com/card/drekavac.jpg
value=2.500
rarity=U
type=Creature
subtype=Beast
cost={1}{B}
pt=3/3
timing=main
requires_groovy_code
oracle=When Drekavac enters the battlefield, sacrifice it unless you discard a noncreature card.

Script

def NONCREATURE_CARD_FROM_HAND = new MagicCardFilterImpl() {
    public boolean accept(final MagicGame game,final MagicPlayer player,final MagicCard target) {
        return !target.hasType(MagicType.Creature);
    }
    public boolean acceptType(final MagicTargetType targetType) {
        return targetType == MagicTargetType.Hand;
    }
}; 
def A_NONCREATURE_CARD_FROM_HAND = new MagicTargetChoice(
    NONCREATURE_CARD_FROM_HAND,  
    MagicTargetHint.None,
    "a noncreature card from your hand"
);

[
    new MagicWhenComesIntoPlayTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent permanent, final MagicPayedCost payedCost) {
            return new MagicEvent(
                permanent,
                new MagicMayChoice("Discard a noncreature card?"),
                this,
                "PN may\$ discard a noncreature card. If PN doesn't, sacrifice SN."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final MagicEvent discard = new MagicDiscardChosenEvent(event.getSource(), A_NONCREATURE_CARD_FROM_HAND);
            if (event.isYes() && discard.isSatisfied()) {
                game.addEvent(discard);
            } else {
                game.doAction(new MagicSacrificeAction(event.getPermanent()));
            }
        }
    }
]
Pushed