magarena/release/Magarena/scripts/Black_Sun_s_Zenith.groovy

30 lines
1.1 KiB
Groovy

[
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
final int amount=payedCost.getX();
return new MagicEvent(
cardOnStack,
this,
"Put "+amount+" -1/-1 counters on each creature. " +
"Shuffle SN into its owner's library."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final int amount = event.getCardOnStack().getX();
final Collection<MagicPermanent> targets =
game.filterPermanents(event.getPlayer(),MagicTargetFilter.TARGET_CREATURE);
for (final MagicPermanent target : targets) {
game.doAction(new MagicChangeCountersAction(
target,
MagicCounterType.MinusOne,
amount,
true
));
}
game.doAction(new MagicChangeCardDestinationAction(event.getCardOnStack(),MagicLocationType.OwnersLibrary));
}
}
]