Menu

Scripts for Phyrexian Obliterator

Config

CodeRay output
name=Phyrexian Obliterator
image=https://magiccards.info/scans/en/a25/101.jpg
image_updated=2018-04-27
value=4.354
rarity=M
type=Creature
subtype=Horror
cost={B}{B}{B}{B}
pt=5/5
ability=Trample
timing=main
requires_groovy_code
oracle=Trample\nWhenever a source deals damage to Phyrexian Obliterator, that source's controller sacrifices that many permanents.

Script

CodeRay output
[
    new DamageIsDealtTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent permanent, final MagicDamage damage) {
            final int amount = damage.getDealtAmount();
            return damage.getTarget() == permanent ?
                new MagicEvent(
                    permanent,
                    damage.getSource().getController(),
                    amount,
                    this,
                    "PN sacrifices RN permanents."
                ):
                MagicEvent.NONE;
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final MagicPermanent permanent = event.getPermanent();
            final MagicPlayer player = event.getPlayer();
            int amount = event.getRefInt();
            while (amount > 0 && player.getPermanents().size() > 0) {
                game.addEvent(new MagicSacrificePermanentEvent(
                    permanent,
                    player,
                    SACRIFICE_PERMANENT
                ));
                amount--;
            }
        }
    }
]