Menu

Submission for Minion of Leshrac

104

Config

name=Minion of Leshrac
image=http://mtgimage.com/card/minion%20of%20leshrac.jpg
value=2.500
rarity=R
type=Creature
subtype=Demon,Minion
cost={4}{B}{B}{B}
pt=5/5
ability=Protection from black;\
        {T}: Destroy target creature or land.
timing=main
requires_groovy_code
oracle=Protection from black. At the beginning of your upkeep, Minion of Leshrac deals 5 damage to you unless you sacrifice a creature other than Minion of Leshrac. If Minion of Leshrac deals damage to you this way, tap it. {T}: Destroy target creature or land.

Script

[
    new MagicAtUpkeepTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
            return permanent.isController(upkeepPlayer) ?
                new MagicEvent(
                    permanent,
                    this,
                    "Sacrifice a creature other than SN. If you can't, SN deals 5 damage to you. If it deals damage to you this way, tap SN."
                ) :
                MagicEvent.NONE;
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final MagicPermanent permanent = event.getPermanent();
            final MagicPlayer player = event.getPlayer();
            final MagicTargetChoice targetChoice = new MagicTargetChoice(
                new MagicOtherPermanentTargetFilter(
                    MagicTargetFilterFactory.CREATURE_YOU_CONTROL,
                    permanent
                ),
                MagicTargetHint.None,
                "a creature other than " + permanent + " to sacrifice"
            );
		if (player.getNrOfPermanents(MagicType.Creature) >=2) {
            game.addEvent(new MagicSacrificePermanentEvent(permanent,player,targetChoice));
		} else {
		final MagicDamage damage = new MagicDamage(event.getSource(),event.getPlayer(),5)
                game.doAction(new MagicDealDamageAction(damage));
		if (damage.getDealtAmount() > 0) {
		game.doAction(new MagicTapAction(event.getPermanent(),true));
		}
		}
        }
    }
]
Pushed