27 lines
1.2 KiB
Groovy
27 lines
1.2 KiB
Groovy
[
|
|
new MagicWhenComesIntoPlayTrigger() {
|
|
@Override
|
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPlayer player) {
|
|
return new MagicEvent(
|
|
permanent,
|
|
player,
|
|
this,
|
|
"Return a Zombie card at random from your graveyard to your hand."
|
|
);
|
|
}
|
|
@Override
|
|
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
|
final MagicPlayer player = event.getPlayer();
|
|
final List<MagicCard> targets = game.filterCards(player,MagicTargetFilter.TARGET_ZOMBIE_CARD_FROM_GRAVEYARD);
|
|
if (targets.size() > 0) {
|
|
final MagicPermanent permanent = event.getPermanent();
|
|
final magic.MersenneTwisterFast rng = new magic.MersenneTwisterFast(player.getGraveyard().getStateId());
|
|
final int index = rng.nextInt(targets.size());
|
|
final MagicCard card = targets.get(index);
|
|
game.doAction(new MagicRemoveCardAction(card,MagicLocationType.Graveyard));
|
|
game.doAction(new MagicMoveCardAction(card,MagicLocationType.Graveyard,MagicLocationType.OwnersHand));
|
|
}
|
|
}
|
|
}
|
|
]
|