Menu

Submission for Feldon's Cane

109

Config

name=Feldon's Cane
image=http://mtgimage.com/card/feldon%27s%20cane.jpg
value=2.500
rarity=U
type=Artifact
cost={1}
timing=artifact
requires_groovy_code
oracle={T}, Exile Feldon's Cane: Shuffle your graveyard into your library.

Script

[
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Draw),
        "Graveyard"
    ) {
        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [
                new MagicTapEvent(source),
                new MagicExileEvent(source)
            ];
        }

        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                this,
                "Shuffle your graveyard into your library."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final MagicPlayer player = event.getPlayer();
            final MagicCardList graveyard = new MagicCardList(player.getGraveyard());
            for (final MagicCard card : graveyard) {
                game.doAction(new MagicRemoveCardAction(
                    card,
                    MagicLocationType.Graveyard
                ));
                game.doAction(new MagicMoveCardAction(
                    card,
                    MagicLocationType.Graveyard,
                    MagicLocationType.OwnersLibrary
                ));
            }
        }
    }
]
Pushed