Menu

Submission for Promise of Power

157

Config

name=Promise of Power
image=http://mtgimage.com/card/promise%20of%20power.jpg
value=2.500
rarity=R
type=Sorcery
cost={2}{B}{B}{B}
ability=Entwine {4}
timing=main
requires_groovy_code
oracle=Choose one — • You draw five cards and you lose 5 life. • Put an X/X black Demon creature token with flying onto the battlefield, where X is the number of cards in your hand as the token enters the battlefield. Entwine {4}

Script

def TEXT1 = "You draw five cards and you lose 5 life."

def TEXT2 = "Put an X/X black Demon creature token with flying onto the battlefield, "+
            "where X is the number of cards in your hand as the token enters the battlefield."

[
    new MagicSpellCardEvent() {
        @Override
        public MagicEvent getEvent(final MagicCardOnStack cardOnStack, final MagicPayedCost payedCost) {
            return new MagicEvent(
                cardOnStack,
                payedCost.isKicked() ? 
                    MagicChoice.NONE :
                    new MagicOrChoice(
                        MagicChoice.NONE,
                        MagicChoice.NONE
                    ),
                this,
                payedCost.isKicked() ?
                    "You draw five cards and you lose 5 life. "+
                    "Put an X/X black Demon creature token with flying onto the battlefield, "+
                    "where X is the number of cards in your hand as the token enters the battlefield." :
                    "Choose one\$ — • " + TEXT1 + " • " + TEXT2 + "\$"
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            if (event.isKicked()) {
                game.doAction(new MagicDrawAction(event.getPlayer(),5));
                game.doAction(new MagicChangeLifeAction(event.getPlayer(), -5));    
                final int x = event.getPlayer().getHandSize();
                game.doAction(new MagicPlayTokenAction(event.getPlayer(), MagicCardDefinition.create({
                    it.setName("Demon");
                    it.setFullName("black Demon creature token with flying");
                    it.setPowerToughness(x, x);
                    it.setColors("b");
                    it.addSubType(MagicSubType.Demon);
                    it.addType(MagicType.Creature);
                    it.setToken();
                    it.setValue(x);
                })));   
            } else if (event.isMode(1)) {
                game.addEvent(MagicRuleEventAction.create("You draw five cards and you lose 5 life.").getEvent(event.getSource()));
            } else if (event.isMode(2)) {
                final int x = event.getPlayer().getHandSize();
                game.doAction(new MagicPlayTokenAction(event.getPlayer(), MagicCardDefinition.create({
                    it.setName("Demon");
                    it.setFullName("black Demon creature token with flying");
                    it.setPowerToughness(x, x);
                    it.setColors("b");
                    it.addSubType(MagicSubType.Demon);
                    it.addType(MagicType.Creature);
                    it.setToken();
                    it.setValue(x);
                })));   
            }
        }
    }
]
Pushed