Menu

Submission for Wall of Junk

315

Config

name=Wall of Junk
image=http://mtgimage.com/card/wall%20of%20junk.jpg
value=2.500
rarity=U
type=Artifact,Creature
subtype=Wall
cost={2}
pt=0/7
ability=Defender
timing=main
requires_groovy_code
oracle=Defender. Whenever Wall of Junk blocks, return it to its owner's hand at end of combat.

Script

[
    new MagicWhenBlocksTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent blocker) {
            final MagicPermanent blocked = permanent.getBlockedCreature();
            return (permanent == blocker && blocked.isValid()) ?
                new MagicEvent(
                    permanent,
                    this,
                    "Return SN to its owner's hand at end of combat."
                ):
                MagicEvent.NONE;
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
                game.doAction(new MagicAddTriggerAction(
                    event.getPermanent(),
                    MagicAtEndOfCombatTrigger.Return
                ))
        }
    }
]
Pushed