magarena/release/Magarena/scripts/Pendrell_Mists.groovy

34 lines
1.1 KiB
Groovy

def MistsUpkeep = new MagicAtUpkeepTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
return permanent.isController(upkeepPlayer) ?
new MagicEvent(
permanent,
new MagicMayChoice(
new MagicPayManaCostChoice(MagicManaCost.create("{1}"))
),
this,
"You may\$ pay {1}. If you don't, sacrifice SN."
):
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
if (event.isNo()) {
game.doAction(new MagicSacrificeAction(event.getPermanent()));
}
}
};
[
new MagicStatic(
MagicLayer.Ability,
MagicTargetFilter.TARGET_CREATURE
) {
@Override
public void modAbilityFlags(final MagicPermanent source,final MagicPermanent permanent,final Set<MagicAbility> flags) {
permanent.addAbility(MistsUpkeep);
}
}
]