Menu

Submission for

Comment

tested in magarena 1.43

Config

name=Pernicious Deed
url=http://magiccards.info/ap/en/114.html
image=http://magiccards.info/scans/en/ap/114.jpg
value=4.519
rarity=R
type=Enchantment
cost={1}{B}{G}
timing=enchantment
requires_groovy_code

Script

def TARGET_ARTIFACT_OR_CREATURE_OR_ENCHANTMENT = new MagicPermanentFilterImpl () {
	public boolean accept(final MagicGame game,final MagicPlayer player,final MagicPermanent target) {
		return target.isArtifact() ||
			   target.isEnchantment() ||
			   target.isCreature();
	}
};
[
	new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Removal),
        "Destroy"
    ) {

        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [ 
				new MagicPayManaCostTapEvent(source,"{X}"),
                new MagicSacrificeEvent(source)
			];
        }

        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
            final int amount=payedCost.getX();
			return new MagicEvent(
                source,
				amount,
                this,
                "Destroy each artifact, creature and enchantment with converted mana cost RN or less."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final MagicPermanent source = event.getPermanent();
            final int amount = event.getRefInt();
            final Collection<MagicPermanent> targets=
                game.filterPermanents(
                    source.getController(),
                    new MagicTargetFilter.MagicCMCPermanentFilter(
                        TARGET_ARTIFACT_OR_CREATURE_OR_ENCHANTMENT,
                        MagicTargetFilter.Operator.LESS_THAN_OR_EQUAL,
                        amount
                    )
                );
            game.doAction(new MagicDestroyAction(targets));
        }
    }
]
Pushed