magarena/release/Magarena/scripts/Endless_Wurm.groovy

26 lines
1.0 KiB
Groovy

[
new MagicAtUpkeepTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
return permanent.isController(upkeepPlayer) ?
new MagicEvent(
permanent,
this,
"Sacrifice SN unless you sacrifice an enchantment."
):
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicPermanent permanent = event.getPermanent();
final MagicPlayer player = event.getPlayer();
if (player.controlsPermanentWithType(MagicType.Enchantment)) {
game.addEvent(new MagicSacrificePermanentEvent(permanent,player,MagicTargetChoice.SACRIFICE_ENCHANTMENT));
} else {
game.doAction(new MagicSacrificeAction(permanent));
}
}
}
]