Menu

Scripts for Chart a Course

Config

CodeRay output
name=Chart a Course
image=https://magiccards.info/scans/en/xln/48.jpg
value=2.500
rarity=U
type=Sorcery
cost={1}{U}
timing=main
requires_groovy_code
oracle=Draw two cards. Then discard a card unless you attacked with a creature this turn.

Script

CodeRay output
[
    new MagicSpellCardEvent() {
        @Override
        public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
            return new MagicEvent(
                cardOnStack,
                this,
                "PN draws two cards. Then PN discards a card unless PN attacked with a creature this turn."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final MagicPlayer player = event.getPlayer();
            game.doAction(new DrawAction(player, 2));
            if (player.getCreaturesAttackedThisTurn() < 1) {
                game.addEvent(new MagicDiscardEvent(event.getSource(), player, 1));
            }
        }
    }
]