magarena/release/Magarena/scripts/Trygon_Predator.groovy

31 lines
1.1 KiB
Groovy

[
new MagicWhenDamageIsDealtTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) {
return (damage.getSource() == permanent &&
damage.getTarget().isPlayer() &&
damage.isCombat()) ?
new MagicEvent(
permanent,
new MagicMayChoice(
MagicTargetChoice.TARGET_ARTIFACT_OR_ENCHANTMENT_YOUR_OPPONENT_CONTROLS
),
MagicDestroyTargetPicker.Destroy,
this,
"PN may\$ destroy target artifact or enchantment\$ an opponent controls."
):
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
if (event.isYes()) {
event.processTargetPermanent(game, {
final MagicPermanent permanent ->
game.doAction(new MagicDestroyAction(permanent));
});
}
}
}
]