magarena/release/Magarena/scripts/Change_of_Heart.groovy

31 lines
1.2 KiB
Groovy

[
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
new MagicBuybackChoice(
MagicTargetChoice.NEG_TARGET_CREATURE,
MagicManaCost.create("{3}")
),
new MagicNoCombatTargetPicker(true,false,false),
this,
"Target creature\$ can't attack this turn. " +
"If the buyback cost was payed\$, return SN to its owner's hand as it resolves."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(new MagicChangeStateAction(creature,MagicPermanentState.CannotAttack,true));
if (event.isBuyback()) {
game.doAction(new MagicChangeCardDestinationAction(event.getCardOnStack(), MagicLocationType.OwnersHand));
}
}
});
}
}
]