magarena/release/Magarena/scripts/Goblin_Lackey.groovy

38 lines
1.3 KiB
Groovy

[
new MagicWhenDamageIsDealtTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) {
return (damage.getSource() == permanent &&
damage.getTarget().isPlayer()) ?
new MagicEvent(
permanent,
new MagicMayChoice(
MagicTargetChoice.GOBLIN_CARD_FROM_HAND
),
MagicGraveyardTargetPicker.PutOntoBattlefield,
this,
"PN may\$ put a Goblin permanent card\$ from " +
"his or her hand onto the battlefield."
):
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
if (event.isYes()) {
event.processTargetCard(game, {
final MagicCard card ->
game.doAction(new MagicRemoveCardAction(
card,
MagicLocationType.OwnersHand
));
game.doAction(new MagicPlayCardAction(
card,
event.getPlayer()
));
});
}
}
}
]