magarena/release/Magarena/scripts/Savage_Twister.groovy

26 lines
962 B
Groovy

[
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
final int amount=payedCost.getX();
return new MagicEvent(
cardOnStack,
this,
"SN deals "+amount+" damage to each creature."
);
}
@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) {
final MagicDamage damage=new MagicDamage(event.getSource(),target,amount);
game.doAction(new MagicDealDamageAction(damage));
}
}
}
]