magarena/release/Magarena/scripts/Souls_of_the_Faultless.groovy

25 lines
1.0 KiB
Groovy
Raw Normal View History

2013-05-18 20:07:26 -07:00
[
new MagicWhenDamageIsDealtTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) {
final MagicPlayer attackingPlayer = damage.getSource().getController();
2013-06-23 18:29:26 -07:00
return (damage.getTarget() == permanent &&
2013-05-18 20:07:26 -07:00
damage.isCombat()) ?
new MagicEvent(
permanent,
damage.getDealtAmount(),
this,
2013-06-23 18:29:26 -07:00
"PN gains RN life and " +
2013-05-18 20:07:26 -07:00
attackingPlayer + " loses RN life."
) :
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicPlayer attackingPlayer = game.getTurnPlayer();
game.doAction(new MagicChangeLifeAction(event.getPlayer(), event.getRefInt()));
game.doAction(new MagicChangeLifeAction(attackingPlayer, -event.getRefInt()));
}
}
]