Menu

Submission for Planar Chaos

97

Config

name=Planar Chaos
image=http://magiccards.info/scans/en/ju/97.jpg
value=2.500
rarity=U
type=Enchantment
cost={2}{R}
timing=enchantment
requires_groovy_code
oracle=At the beginning of your upkeep, flip a coin. If you lose the flip, sacrifice Planar Chaos. Whenever a player casts a spell, that player flips a coin. If he or she loses the flip, counter that spell.

Script

[
    new MagicAtYourUpkeepTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
            return new MagicEvent(
                permanent,
                new MagicCoinFlipChoice(),
                this,
                "PN flips a coin.\$ If PN loses the flip, sacrifice SN."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final MagicPlayer player = event.getPlayer();
            final Boolean heads = event.isMode(1) 
            game.addEvent(new MagicCoinFlipEvent(
                event.getSource(),
                heads,
                player,
                null,
                new SacrificeAction(event.getPermanent())
            ));
        }
    },
    new MagicWhenOtherSpellIsCastTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicCardOnStack cardOnStack) {
            return new MagicEvent(
                permanent,
                cardOnStack.getController(),
                new MagicCoinFlipChoice(),
                cardOnStack,
                this,
                "PN flips a coin.\$ If PN loses the flip, counter RN."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final MagicPlayer player = event.getPlayer();
            final Boolean heads = event.isMode(1) 
            game.addEvent(new MagicCoinFlipEvent(
                event.getSource(),
                heads,
                player,
                null,
                new CounterItemOnStackAction(event.getRefCardOnStack())
            ));
        }
    }
]
Pushed