magarena/release/Magarena/scripts/Phyrexian_Reaper.groovy

40 lines
1.5 KiB
Groovy
Raw Normal View History

2013-05-26 06:23:44 -07:00
[
new MagicWhenBecomesBlockedTrigger() {
2013-04-12 19:32:25 -07:00
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent attacker) {
if (permanent != attacker) {
return MagicEvent.NONE;
}
final MagicPermanentList plist = new MagicPermanentList();
for (final MagicPermanent blocker : permanent.getBlockingCreatures()) {
if (blocker.hasColor(MagicColor.Green)) {
plist.add(blocker);
}
}
return !plist.isEmpty() ?
new MagicEvent(
permanent,
plist,
this,
plist.size() == 1 ?
"Destroy " + plist.get(0) + ". It can't be regenerated." :
"Destroy blocking green creatures. They can't be regenerated."
):
MagicEvent.NONE;
}
2013-06-23 18:29:26 -07:00
2013-04-12 19:32:25 -07:00
@Override
2013-05-26 06:23:44 -07:00
public void executeEvent(final MagicGame game, final MagicEvent event) {
2013-04-12 19:32:25 -07:00
final MagicPermanentList plist = event.getRefPermanentList();
for (final MagicPermanent blocker : plist) {
game.doAction(MagicChangeStateAction.Set(
blocker,
MagicPermanentState.CannotBeRegenerated
));
2013-04-12 19:32:25 -07:00
game.doAction(new MagicDestroyAction(blocker));
}
}
2013-05-26 06:23:44 -07:00
}
]