Menu

Scripts for Settle the Wreckage

Config

CodeRay output
name=Settle the Wreckage
image=https://magiccards.info/scans/en/xln/34.jpg
value=2.500
rarity=R
type=Instant
cost={2}{W}{W}
timing=removal
requires_groovy_code
oracle=Exile all attacking creatures target player controls. That player may search his or her library for that many basic land cards, put those cards onto the battlefield tapped, then shuffle his or her library.

Script

CodeRay output
[
    new MagicSpellCardEvent() {
        @Override
        public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
            return new MagicEvent(
                cardOnStack,
                NEG_TARGET_PLAYER,
                this,
                "Exile all attacking creatures target player\$ controls."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetPlayer(game, {
                final MagicPlayer player ->
                int amount = 0;
                player.getPermanents().each {
                    if (it.hasType(MagicType.Creature) && it.hasState(MagicPermanentState.Attacking)) {
                        game.addEvent(new MagicExileEvent(it));
                        amount++;
                    }
                }
                game.addEvent(new MagicSearchOntoBattlefieldEvent(
                    event.getSource(),
                    player,
                    new MagicFromCardFilterChoice(
                        BASIC_LAND_CARD_FROM_LIBRARY,
                        amount,
                        true,
                        "basic land cards from your library"
                    ),
                    MagicPlayMod.TAPPED
                ));
            });
        }
    }
]