Menu

Submission for Cosmic Larva

63

Comment

Based on Endless Wurm. Tried to do it using the hasOptions method but failed, so reverted to the old method.

Config

name=Cosmic Larva
image=http://mtgimage.com/card/cosmic%20larva.jpg
value=2.500
rarity=R
type=Creature
subtype=Beast
cost={1}{R}{R}
pt=7/6
ability=Trample
timing=main
requires_groovy_code
oracle=Trample. At the beginning of your upkeep, sacrifice Cosmic Larva unless you sacrifice two lands.

Script

[
    new MagicAtUpkeepTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
            return permanent.isController(upkeepPlayer) ?
                new MagicEvent(
                    permanent,
                    new MagicMayChoice("Sacrifice two lands?"),
                    this,
                    "PN may\$ sacrifice two lands. If PN doesn't, sacrifice SN."
                ):
                MagicEvent.NONE;
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            if (event.getPlayer().getNrOfPermanents(MagicType.Land) >=2 && event.isYes()) {
                game.addEvent(new MagicSacrificePermanentEvent(event.getPermanent(),event.getPlayer(),MagicTargetChoice.SACRIFICE_LAND));
			game.addEvent(new MagicSacrificePermanentEvent(event.getPermanent(),event.getPlayer(),MagicTargetChoice.SACRIFICE_LAND));
            } else {
                game.doAction(new MagicSacrificeAction(event.getPermanent()));
            }
        }
    }
]
Pushed