Menu

Submission for Razor Barrier

26

Config

name=Razor Barrier
image=http://magiccards.info/scans/en/ddf/26.jpg
value=2.500
rarity=C
type=Instant
cost={1}{W}
timing=pump
requires_groovy_code
oracle=Target permanent you control gains protection from artifacts or from the color of your choice until end of turn.

Script

def ProtectionFromArtifacts = MagicAbility.getAbilityList("protection from artifacts");

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,
                new MagicOrChoice(
                    MagicTargetChoice.TARGET_PERMANENT_YOU_CONTROL,
                    MagicTargetChoice.TARGET_PERMANENT_YOU_CONTROL
                ),
                this,
                "Choose one\$ - target permanent\$ you control gains protection from artifacts until end of turn; " +
                "or target permanent\$ you control gains protection from the color of your choice until end of turn.\$" 
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            if (event.isMode(1)) {
                event.processTargetPermanent(game, {
                    game.doAction(new MagicGainAbilityAction(it,ProtectionFromArtifacts))
                });
            }
            if (event.isMode(2)) {
                event.processTargetPermanent(game, {
                    game.addEvent(new MagicEvent(
                        event.getSource(),
                        event.getPlayer(),
                        MagicColorChoice.ALL_INSTANCE,
                        it,
                        action,
                        "Chosen color\$."
                    ));
                });
            }
        }
    }
]
Pushed