magarena/release/Magarena/scripts/Moldgraf_Monstrosity.groovy

31 lines
1.6 KiB
Groovy
Raw Normal View History

2013-05-28 01:19:32 -07:00
[
new MagicWhenPutIntoGraveyardTrigger() {
2013-04-12 19:32:25 -07:00
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicGraveyardTriggerData triggerData) {
return (triggerData.fromLocation == MagicLocationType.Play) ?
new MagicEvent(
permanent,
this,
"Exile SN, then return two creature " +
2013-05-28 01:19:32 -07:00
"cards at random from your graveyard to the battlefield."
):
2013-04-12 19:32:25 -07:00
MagicEvent.NONE;
}
@Override
2013-05-28 01:19:32 -07:00
public void executeEvent(final MagicGame game, final MagicEvent event) {
2013-04-12 19:32:25 -07:00
final MagicPermanent permanent = event.getPermanent();
game.doAction(new MagicRemoveCardAction(permanent.getCard(),MagicLocationType.Graveyard));
game.doAction(new MagicMoveCardAction(permanent.getCard(),MagicLocationType.Graveyard,MagicLocationType.Exile));
final MagicPlayer player = event.getPlayer();
final List<MagicCard> targets = game.filterCards(player,MagicTargetFilter.TARGET_CREATURE_CARD_FROM_GRAVEYARD);
final magic.MersenneTwisterFast rng = new magic.MersenneTwisterFast(player.getGraveyard().getStateId());
int actualAmount = Math.min(targets.size(),2);
for (;actualAmount>0;actualAmount--) {
final int index = rng.nextInt(targets.size());
final MagicCard card = targets.get(index);
game.doAction(new MagicReanimateAction(player,card,MagicPlayCardAction.NONE));
2013-05-28 01:19:32 -07:00
}
2013-04-12 19:32:25 -07:00
}
2013-05-28 01:19:32 -07:00
}
]