magarena/release/Magarena/scripts/Pestilence.groovy

55 lines
2.0 KiB
Groovy
Raw Normal View History

[
2013-06-14 19:59:14 -07:00
new MagicPermanentActivation(
new MagicActivationHints(MagicTiming.None),"Damage"
) {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return [
new MagicPayManaCostEvent(source,"{B}")
];
}
2013-06-23 18:29:26 -07:00
2013-06-15 17:38:51 -07:00
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
this,
"SN deals 1 damage to all creatures and players."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
2013-06-23 18:29:26 -07:00
final Collection<MagicPermanent> targets =
game.filterPermanents(event.getPlayer(),MagicTargetFilter.TARGET_CREATURE);
for (final MagicPermanent target : targets) {
final MagicDamage damage=new MagicDamage(event.getSource(),target,1);
game.doAction(new MagicDealDamageAction(damage));
}
for (final MagicPlayer player : game.getPlayers()) {
final MagicDamage damage=new MagicDamage(event.getSource(),player,1);
game.doAction(new MagicDealDamageAction(damage));
}
}
},
new MagicAtEndOfTurnTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer eotPlayer) {
final Collection<MagicPermanent> targets =
game.filterPermanents(permanent.getController(),MagicTargetFilter.TARGET_CREATURE);
return (targets.size() == 0) ?
new MagicEvent(
permanent,
this,
"Sacrifice SN."
):
MagicEvent.NONE;
}
2013-06-23 18:29:26 -07:00
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
game.doAction(new MagicSacrificeAction(event.getPermanent()));
}
}
]