Menu

Submission for Safe Haven

121

Config

name=Safe Haven
image=http://mtgimage.com/card/safe%20haven.jpg
value=2.500
rarity=R
type=Land
timing=land
requires_groovy_code
oracle={2}, {T}: Exile target creature you control. At the beginning of your upkeep, you may sacrifice Safe Haven. If you do, return each card exiled with Safe Haven to the battlefield under its owner's control.

Script

[
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.Removal),
        "Exile"
    ) {

        @Override
        public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
            return [
                new MagicPayManaCostEvent(source,"{2}"),
                new MagicTapEvent(source)
            ];
        }

        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,
                this,
                "Exile target creature you control."
            );
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            event.processTargetPermanent(game, {
                game.doAction(new MagicExileLinkAction(
                    event.getPermanent(),
                    it
                )); 
            });
        }
    },
    new MagicAtYourUpkeepTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
            return new MagicEvent(            
                permanent,
                new MagicMayChoice("Sacrifice SN?"),
                this,
                "PN may\$ sacrifice SN. If you do, return each card exiled with SN to the battlefield under its owner's control"
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            if (event.isYes()) {
                game.doAction(new MagicSacrificeAction(event.getPermanent()));
                game.doAction(new MagicReturnLinkedExileAction(
                    event.getPermanent(),
                    MagicLocationType.Play,
                    event.getPlayer()
                ));
            }
        }
    }
]
Pushed