magarena/release/Magarena/scripts/Chain_Reaction.groovy

23 lines
941 B
Groovy
Raw Normal View History

2013-05-18 04:56:41 -07:00
[
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
this,
"SN deals X damage to each creature, where X is the number of creatures on the battlefield."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final int amount=game.getNrOfPermanents(MagicType.Creature);
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));
}
}
}
]