magarena/release/Magarena/scripts/Deepcavern_Imp.groovy

34 lines
1.3 KiB
Groovy
Raw Normal View History

2013-05-26 03:21:41 -07:00
[
new MagicAtUpkeepTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
2013-06-23 18:29:26 -07:00
return (permanent.isController(upkeepPlayer) &&
2013-05-26 03:21:41 -07:00
permanent.hasState(MagicPermanentState.MustPayEchoCost)) ?
new MagicEvent(
permanent,
new MagicMayChoice(),
this,
"PN may\$ discard a card. " +
"If he or she doesn't, sacrifice SN."
):
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicPermanent permanent = event.getPermanent();
if (event.isYes() && event.getPlayer().getHandSize() > 0) {
game.addEvent(new MagicDiscardEvent(
permanent,
event.getPlayer()
2013-05-26 03:21:41 -07:00
));
game.doAction(MagicChangeStateAction.Clear(
2013-05-26 03:21:41 -07:00
permanent,
MagicPermanentState.MustPayEchoCost
2013-05-26 03:21:41 -07:00
));
} else {
game.doAction(new MagicSacrificeAction(permanent));
}
2013-06-23 18:29:26 -07:00
}
2013-05-26 03:21:41 -07:00
}
]