Menu

Submission for Reverent Mantra

44

Config

name=Reverent Mantra
image=http://mtgimage.com/card/reverent%20mantra.jpg
value=2.500
rarity=R
type=Instant
cost={3}{W}
timing=pump
requires_groovy_code
oracle=You may exile a white card from your hand rather than pay Reverent Mantra's mana cost. Choose a color. All creatures gain protection from the chosen color until end of turn.

Script

[
    new MagicCardActivation(
        [MagicCondition.CARD_CONDITION],
        new MagicActivationHints(MagicTiming.Pump,true),
        "Alt"
    ) {
        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicCard source) {
            final MagicTargetChoice targetChoice = new MagicTargetChoice(
                new MagicOtherCardTargetFilter(
                    MagicTargetFilterFactory.WHITE_CARD_FROM_HAND, 
                    source
                ),
                MagicTargetHint.None,
                "a white card from your hand"
            );
            return [new MagicExileCardEvent(source, targetChoice)];
        }
    },
    new MagicSpellCardEvent() {
        @Override
        public MagicEvent getEvent(final MagicCardOnStack cardOnStack, final MagicPayedCost payedCost) {
            return new MagicEvent(
                cardOnStack,
                MagicColorChoice.ALL_INSTANCE,
                this,
                "Choose a color\$. " +
                "All creatures gain protection from the chosen color until end of turn."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final MagicColor color = event.getChosenColor();
            final MagicAbility protection = color.getProtectionAbility();
            final Collection<MagicPermanent> targets =
                game.filterPermanents(event.getPlayer(),MagicTargetFilterFactory.CREATURE);
            for (final MagicPermanent target : targets) {
                game.doAction(new MagicGainAbilityAction(target, protection));
            }
        }
    }
]
Pushed