magarena/release/Magarena/scripts/Phyrexian_Slayer.groovy

36 lines
1.4 KiB
Groovy
Raw Normal View History

2013-05-26 06:23:21 -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.White)) {
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 white creatures. They can't be regenerated."
):
MagicEvent.NONE;
}
@Override
2013-05-26 06:23:21 -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(new MagicChangeStateAction(blocker,MagicPermanentState.CannotBeRegenerated,true));
game.doAction(new MagicDestroyAction(blocker));
}
}
2013-05-26 06:23:21 -07:00
}
]