Menu

Submission for Shelter

29

Config

name=Shelter
image=http://magiccards.info/scans/en/vma/44.jpg
value=2.500
rarity=C
type=Instant
cost={1}{W}
timing=pump
requires_groovy_code
oracle=Target creature you control gains protection from the color of your choice until end of turn. Draw a card.

Script

def action = {
    final MagicGame game, final MagicEvent event ->
    game.doAction(new MagicGainAbilityAction(
        event.getRefPermanent(),
        event.getChosenColor().getProtectionAbility()
    ));
}

[
    new MagicSpellCardEvent() {
        @Override
        public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
            return new MagicEvent(
                cardOnStack,
                MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,
                this,
                "Target creature\$ you control gains protection from the color of your choice until end of turn."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetPermanent(game, {
                game.addEvent(new MagicEvent(
                    event.getSource(),
                    event.getPlayer(),
                    MagicColorChoice.ALL_INSTANCE,
                    it,
                    action,
                    "Chosen color\$."
                ));
            });
                game.doAction(new MagicDrawAction(event.getPlayer(),1));
        }
    }
]
Pushed