magarena/release/Magarena/scripts/Surgespanner.groovy

31 lines
1.2 KiB
Groovy

[
new MagicWhenBecomesTappedTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent tapped) {
return (permanent == tapped) ?
new MagicEvent(
permanent,
new MagicMayChoice(
new MagicPayManaCostChoice(MagicManaCost.create("{1}{U}")),
MagicTargetChoice.TARGET_PERMANENT
),
MagicBounceTargetPicker.getInstance(),
this,
"PN may\$ pay {1}{U}\$. If you do, " +
"return target permanent\$ to its owner's hand."
) :
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
if (event.isYes()) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent permanent) {
game.doAction(new MagicRemoveFromPlayAction(permanent,MagicLocationType.OwnersHand));
}
});
}
}
}
]