Menu

Submission for Avoid Fate

73

Config

name=Avoid Fate
image=http://magiccards.info/scans/en/tsts/73.jpg
value=2.500
rarity=C
type=Instant
cost={G}
timing=counter
requires_groovy_code
oracle=Counter target instant or Aura spell that targets a permanent you control.

Script

def INSTANT_OR_AURA_TARGETS_YOUR_PERM = new MagicStackFilterImpl() {
    public boolean accept(final MagicSource source,final MagicPlayer player,final MagicItemOnStack target) {
        return (target.hasType(MagicType.Instant) || target.hasSubType(MagicSubType.Aura)) &&
        target.getTarget().isPermanent() && target.getTarget().isFriend(player);
    } 
};

def TARGET_INSTANT_OR_AURA_TARGETS_YOUR_PERM = new MagicTargetChoice(
    INSTANT_OR_AURA_TARGETS_YOUR_PERM,
    MagicTargetHint.Negative,
    "target instant or aura that targets a permanent you control"
);

[
    new MagicWhenComesIntoPlayTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent permanent, final MagicPayedCost payedCost) {
            return new MagicEvent(
                permanent,
                TARGET_INSTANT_OR_AURA_TARGETS_YOUR_PERM,
                this,
                "Counter target instant or Aura spell\$ that targets a permanent you control."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetCardOnStack(game, {
                game.doAction(new CounterItemOnStackAction(it));
            });
        }
    }
]
Pushed