Menu

Submission for Aven Warcraft

2

Config

name=Aven Warcraft
image=http://mtgimage.com/card/aven%20warcraft.jpg
value=2.500
rarity=U
type=Instant
cost={2}{W}
effect=Creatures you control get +0/+2 until end of turn.
timing=pump
requires_groovy_code
oracle=Creatures you control get +0/+2 until end of turn. Threshold — If seven or more cards are in your graveyard, choose a color. Creatures you control also gain protection from the chosen color until end of turn.

Script

[
    new MagicSpellCardEvent() {
        @Override
        public MagicEvent getEvent(final MagicCardOnStack cardOnStack, final MagicPayedCost payedCost) {
            return new MagicEvent(
                cardOnStack,
                MagicColorChoice.ALL_INSTANCE,
                this,
                "Choose a color\$. " +
                "Creatures PN controls have protection from the chosen color until end of turn if there are 7 or more cards in PN's graveyard."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            if (MagicCondition.THRESHOLD_CONDITION.accept(event.getSource())) {
            final MagicColor color = event.getChosenColor();
            final MagicAbility protection = color.getProtectionAbility();
            final Collection<MagicPermanent> targets =
                game.filterPermanents(event.getPlayer(),MagicTargetFilterFactory.CREATURE_YOU_CONTROL);
            for (final MagicPermanent target : targets) {
                game.doAction(new MagicGainAbilityAction(target, protection));
                }
            }
        }
    }
]
Pushed