Menu

Submission for Cephalid Illusionist

28

Config

name=Cephalid Illusionist
image=http://mtgimage.com/card/cephalid%20illusionist.jpg
value=2.500
rarity=U
type=Creature
subtype=Cephalid,Wizard
cost={1}{U}
pt=1/1
timing=main
requires_groovy_code
oracle=Whenever Cephalid Illusionist becomes the target of a spell or ability, put the top three cards of your library into your graveyard. {2}{U}, {T}: Prevent all combat damage that would be dealt to and dealt by target creature you control this turn.

Script

[
    new MagicWhenSelfTargetedTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicItemOnStack target) {
            return new MagicEvent(
                permanent,
                this,
                "Put the top three cards of PN's library into PN's graveyard."
                );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            game.doAction(new MagicMillLibraryAction(event.getPermanent().getController(),3));
        }
    },
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Block),
        "Prevent"
    ) {
        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [
                new MagicPayManaCostEvent(source,"{2}{U}"),
                new MagicTapEvent(source)
            ];
        }

        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,
                MagicPreventTargetPicker.create(),     
                this,
                "Prevent all combat damage that would be dealt to and dealt by target creature you control\$ this turn."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetPermanent(game, {
                game.doAction(new MagicAddTurnTriggerAction(
                    it,
                    MagicIfDamageWouldBeDealtTrigger.PreventCombatDamageDealtToDealtBy
                ));
            });
        }
    }
]
Pushed