magarena/release/Magarena/scripts/Halimar_Excavator.groovy

32 lines
1.3 KiB
Groovy
Raw Normal View History

2013-05-26 03:48:59 -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,
MagicTargetChoice.NEG_TARGET_PLAYER,
this,
2013-05-26 03:48:59 -07:00
"Target player\$ puts the top X cards of his or her " +
2013-04-12 19:32:25 -07:00
"library into his or her graveyard, where X is the " +
"number of Allies PN controls."
) :
MagicEvent.NONE;
}
2013-06-23 18:29:26 -07:00
2013-04-12 19:32:25 -07:00
@Override
2013-05-26 03:48:59 -07:00
public void executeEvent(final MagicGame game, final MagicEvent event) {
2013-04-12 19:32:25 -07:00
event.processTargetPlayer(game,new MagicPlayerAction() {
public void doAction(final MagicPlayer targetPlayer) {
final MagicPlayer player = event.getPlayer();
final int amount = player.getNrOfPermanents(MagicSubType.Ally);
2013-04-12 19:32:25 -07:00
if (amount > 0) {
game.doAction(new MagicMillLibraryAction(targetPlayer,amount));
}
}
2013-06-23 18:29:26 -07:00
});
}
2013-05-26 03:48:59 -07:00
}
]