Menu

Submission for Bident of Thassa

86

Config

name=Bident of Thassa
url=http://magiccards.info/query?q=%21bident%20of%20thassa
image=http://mtgimage.com/card/bident%20of%20thassa.jpg
value=3.507
rarity=R
type=Legendary,Artifact,Enchantment
cost={2}{U}{U}
timing=artifact
requires_groovy_code

Script

[
    new MagicPermanentActivation(
        new MagicActivationHints(MagicTiming.MustAttack),
        "Attacks"
    ) {

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

        @Override
        public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
            return new MagicEvent(
                source,
                this,
                "Creatures your opponent controls attacks you this turn if able."
            );
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final MagicPlayer player=event.getPlayer();
            final Collection<MagicPermanent> targets=game.filterPermanents(player,MagicTargetFilter.TARGET_CREATURE);
            for (final MagicPermanent creature : targets) {
                if (!creature.isController(player)) {
                    game.doAction(new MagicGainAbilityAction(creature,MagicAbility.AttacksEachTurnIfAble));
                } 
            }
        }
    },
    new MagicWhenDamageIsDealtTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) {
            return (permanent.isOpponent(damage.getTarget()) &&
                    damage.getSource().isCreature() &&
                    damage.isCombat()) ?
                new MagicEvent(
                    permanent,
                    damage.getSource().getController(),
                    new MagicSimpleMayChoice(
                        MagicSimpleMayChoice.DRAW_CARDS,
                        1,
                        MagicSimpleMayChoice.DEFAULT_NONE
                    ),
                    this,
                    "PN may\$ draw a card."
                ) :
                MagicEvent.NONE;
        }
        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            if (event.isYes()) {
                game.doAction(new MagicDrawAction(event.getPlayer()));
            }
        }
    }
]
Pushed