magarena/release/Magarena/scripts/Witherscale_Wurm.groovy

49 lines
1.8 KiB
Groovy

[
new MagicWhenBlocksOrBecomesBlockedTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent blocker) {
return new MagicEvent(
permanent,
permanent == blocker ? blocker.getBlockedCreature() : blocker,
this,
"RN gains wither until end of turn."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processRefPermanent(game, {
final MagicPermanent permanent ->
game.doAction(new MagicGainAbilityAction(
permanent,
MagicAbility.Wither
));
} as MagicPermanentAction);
}
},
new MagicWhenDamageIsDealtTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent permanent, final MagicDamage damage) {
return (permanent == damage.getSource() &&
permanent.isOpponent(damage.getTarget()) &&
permanent.getCounters(MagicCounterType.MinusOne) > 0) ?
new MagicEvent(
permanent,
this,
"Remove all -1/-1 counters from SN."
):
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicPermanent permanent = event.getPermanent();
final int amount = permanent.getCounters(MagicCounterType.MinusOne);
game.doAction(new MagicChangeCountersAction(
permanent,
MagicCounterType.MinusOne,
-amount,
true
));
}
}
]