Menu

Submission for Omen of Fire

112

Config

name=Omen of Fire
image=http://mtgimage.com/card/omen%20of%20fire.jpg
value=2.500
rarity=R
type=Instant
cost={3}{R}{R}
timing=removal
requires_groovy_code
oracle=Return all Islands to their owners' hands. Each player sacrifices a Plains or a white permanent for each white permanent he or she controls.

Script

def PLAINS_OR_WHITE_PERMANENT = new MagicPermanentFilterImpl() {
    public boolean accept(final MagicGame game,final MagicPlayer player,final MagicPermanent target) {
        return target.hasSubType(MagicSubType.Plains) || target.hasColor(MagicColor.White) &&
               target.isController(player);
    } 
};

def A_PLAINS_OR_WHITE_PERMANENT = new MagicTargetChoice(
    PLAINS_OR_WHITE_PERMANENT,
    "a plains or white permanent you control"
);

[
    new MagicSpellCardEvent() {
        @Override
        public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
            return new MagicEvent(
                cardOnStack,
                this,
                "Return all Islands to their owners' hands. " +
                "Each player sacrifices a Plains or a white permanent for each white permanent he or she controls."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final Collection<MagicPermanent> targets=
                game.filterPermanents(event.getPlayer(),MagicTargetFilterFactory.ISLAND);
            for (final MagicPermanent target : targets) {
                game.doAction(new MagicRemoveFromPlayAction(target,MagicLocationType.OwnersHand));
            }
            for (final MagicPlayer player : game.getAPNAP()) {
                final int amount = player.getNrOfPermanents(MagicColor.White);
                for (final int count = 1; count <= amount; count++) {
                    game.addEvent(new MagicSacrificePermanentEvent(event.getCardOnStack(),player,A_PLAINS_OR_WHITE_PERMANENT));
                }
            }
        }
    }
]
Pushed