Menu

Submission for Daru Cavalier

18

Comment

Adapted from Avarax

Config

name=Daru Cavalier
image=http://mtgimage.com/card/daru%20cavalier.jpg
value=2.500
rarity=C
type=Creature
subtype=Human,Soldier
cost={3}{W}
pt=2/2
ability=First strike
timing=main
requires_groovy_code
oracle=First strike. When Daru Cavalier enters the battlefield, you may search your library for a card named Daru Cavalier, reveal it, and put it into your hand. If you do, shuffle your library.

Script

def CARD_NAMED_DARU_CAVALIER = new MagicCardFilterImpl() {
    public boolean accept(final MagicGame game,final MagicPlayer player,final MagicCard target) {
        return target.getName().equals("Daru Cavalier");
    }
    public boolean acceptType(final MagicTargetType targetType) {
        return targetType==MagicTargetType.Library;
    }
};

[
    new MagicWhenComesIntoPlayTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPayedCost payedCost) {      
            return new MagicEvent(
                permanent,
                new MagicMayChoice(),
                this,
                "PN may\$ search his or her library for a card named Daru Cavalier, " + 
                "reveal it, and put it into PN's hand. If PN does, shuffle PN's library."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            if (event.isYes()) {
                game.addEvent(new MagicSearchToLocationEvent(
                    event,
                    new MagicTargetChoice(
                        CARD_NAMED_DARU_CAVALIER, 
                        "a card named Daru Cavalier"
                    ),
                    MagicLocationType.OwnersHand
                ));
            }
        }
    }
]
Pushed