magarena/release/Magarena/scripts/Perimeter_Captain.groovy

27 lines
947 B
Groovy

[
new MagicWhenBlocksTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent creature) {
return (creature.isFriend(permanent) &&
creature.hasAbility(MagicAbility.Defender)) ?
new MagicEvent(
permanent,
new MagicSimpleMayChoice(
MagicSimpleMayChoice.GAIN_LIFE,
2,
MagicSimpleMayChoice.DEFAULT_YES
),
this,
"PN may\$ gain 2 life."
) :
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
if (event.isYes()) {
game.doAction(new MagicChangeLifeAction(event.getPlayer(),2));
}
}
}
]