magarena/release/Magarena/scripts/Pestilence.groovy

54 lines
2.1 KiB
Groovy

[
new MagicPermanentActivation([MagicConditionFactory.ManaCost("{B}")], new MagicActivationHints(MagicTiming.None),"Damage") {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return [
new MagicPayManaCostEvent(source,"{B}")
];
}
@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) {
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;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
game.doAction(new MagicSacrificeAction(event.getPermanent()));
}
}
]