magarena/release/Magarena/scripts/Change_of_Heart.groovy

28 lines
1.1 KiB
Groovy
Raw Normal View History

2013-05-26 22:24:16 -07:00
[
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
MagicTargetChoice.NEG_TARGET_CREATURE,
2013-05-26 22:24:16 -07:00
new MagicNoCombatTargetPicker(true,false,false),
this,
2013-06-23 18:29:26 -07:00
"Target creature\$ can't attack this turn. " +
"If the buyback cost was payed, return SN to its owner's hand as it resolves."
2013-05-26 22:24:16 -07:00
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(MagicChangeStateAction.Set(creature,MagicPermanentState.CannotAttack));
2013-05-26 22:24:16 -07:00
if (event.isBuyback()) {
game.doAction(new MagicChangeCardDestinationAction(event.getCardOnStack(), MagicLocationType.OwnersHand));
2013-06-23 18:29:26 -07:00
}
2013-05-26 22:24:16 -07:00
}
});
}
}
]