magarena/release/Magarena/scripts/Vigor.groovy

33 lines
1.2 KiB
Groovy

[
new MagicIfDamageWouldBeDealtTrigger(MagicTrigger.PREVENT_DAMAGE) {
@Override
public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent permanent, final MagicDamage damage) {
final MagicTarget target = damage.getTarget();
int amount = 0;
if (target != permanent &&
target.isCreature() &&
permanent.isFriend(target)) {
amount = damage.prevent();
}
return amount > 0 ?
new MagicEvent(
permanent,
damage.getTarget(),
{
final MagicGame G, final MagicEvent E ->
G.doAction(new MagicChangeCountersAction(
E.getRefPermanent(),
MagicCounterType.PlusOne,
amount,
true
));
} as MagicEventAction,
"Prevent ${amount} damage and put ${amount} +1/+1 counters on RN"
):
MagicEvent.NONE;
}
}
]