magarena/release/Magarena/scripts/Hagra_Diabolist.groovy

36 lines
1.4 KiB
Groovy
Raw Normal View History

2013-05-26 22:23:54 -07:00
[
new MagicWhenOtherComesIntoPlayTrigger() {
2013-04-12 19:32:25 -07:00
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent otherPermanent) {
return (otherPermanent.isFriend(permanent) &&
otherPermanent.hasSubType(MagicSubType.Ally)) ?
new MagicEvent(
permanent,
new MagicMayChoice(
MagicTargetChoice.NEG_TARGET_PLAYER
),
this,
2013-05-26 22:23:54 -07:00
"PN may\$ have target player\$ lose life " +
2013-04-12 19:32:25 -07:00
"equal to the number of Allies he or she controls."
) :
MagicEvent.NONE;
}
@Override
2013-05-26 22:23:54 -07:00
public void executeEvent(final MagicGame game, final MagicEvent event) {
2013-04-12 19:32:25 -07:00
if (event.isYes()) {
event.processTargetPlayer(game,new MagicPlayerAction() {
public void doAction(final MagicPlayer targetPlayer) {
final MagicPlayer player = event.getPlayer();
final int amount =
player.getNrOfPermanentsWithSubType(MagicSubType.Ally);
if (amount > 0) {
game.doAction(new MagicChangeLifeAction(targetPlayer,-amount));
}
}
});
}
}
2013-05-26 22:23:54 -07:00
}
]