magarena/incomplete/Rock_Hydra.groovy

17 lines
698 B
Groovy
Raw Normal View History

2015-05-24 13:06:10 -07:00
[
new MagicPreventDamageTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent permanent, final MagicDamage damage) {
if (damage.getTarget() == permanent && permanent.hasCounters(MagicCounterType.PlusOne)) {
final int amount = permanent.getCounters(MagicCounterType.PlusOne);
// Prevention effect.
damage.prevent(amount);
game.doAction(new ChangeCountersAction(permanent,MagicCounterType.PlusOne,-amount));
}
return MagicEvent.NONE;
}
}
]
//Rock Hydra's activated damage prevention should occur before this