magarena/release/Magarena/scripts/Dromar__the_Banisher.groovy

35 lines
1.4 KiB
Groovy
Raw Normal View History

2013-05-28 00:09:35 -07:00
[
new MagicWhenDamageIsDealtTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) {
2013-06-06 07:09:45 -07:00
return (damage.getSource()==permanent &&
2013-06-23 18:29:26 -07:00
damage.getTarget().isPlayer() &&
2013-06-06 07:09:45 -07:00
damage.isCombat()) ?
2013-05-28 00:09:35 -07:00
new MagicEvent(
permanent,
new MagicMayChoice(
new MagicPayManaCostChoice(MagicManaCost.create("{2}{U}")),
MagicColorChoice.UNSUMMON_INSTANCE
),
this,
2013-06-23 18:29:26 -07:00
"You may\$ pay {2}{U}\$. If you do, choose a color\$. " +
2013-05-28 00:09:35 -07:00
"Return all creatures of that color to their owner's hand."
):
MagicEvent.NONE;
}
2013-06-23 18:29:26 -07:00
2013-05-28 00:09:35 -07:00
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
if (event.isYes()) {
final MagicColor color=event.getChosenColor();
final Collection<MagicPermanent> targets=game.filterPermanents(event.getPlayer(),MagicTargetFilter.TARGET_CREATURE);
for (final MagicPermanent creature : targets) {
if (creature.hasColor(color)) {
game.doAction(new MagicRemoveFromPlayAction(creature,MagicLocationType.OwnersHand));
}
}
2013-06-23 18:29:26 -07:00
}
2013-05-28 00:09:35 -07:00
}
}
]