Menu

Submission for Noetic Scales

304

Config

name=Noetic Scales
image=http://mtgimage.com/card/noetic%20scales.jpg
value=4.449
rarity=R
type=Artifact
cost={4}
timing=main
requires_groovy_code
oracle=At the beginning of each player's upkeep, return to its owner's hand each creature that player controls with power greater than the number of cards in his or her hand.

Script

[
    new MagicAtUpkeepTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent permanent, final MagicPlayer upkeepPlayer) {
           return new MagicEvent(
                    permanent,
                    upkeepPlayer,
                    this,
                    "Return to PN's hand all the creatures PN controls " +
                    "with power greater than the number of cards in PN's hand."
                );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final int amount = event.getPlayer().getHandSize();
            final Collection<MagicPermanent> targets=
                game.filterPermanents(event.getPlayer(),MagicTargetFilterFactory.CREATURE_YOU_CONTROL);
            for (final MagicPermanent target : targets) {
                if(target.getPower() > amount){
                    game.doAction(new MagicRemoveFromPlayAction(target,MagicLocationType.OwnersHand));
                }
            }
        }
    }
]
Pushed