magarena/release/Magarena/scripts/Ward_Sliver.groovy

29 lines
1.1 KiB
Groovy
Raw Normal View History

2013-05-19 01:15:01 -07:00
[
new MagicWhenComesIntoPlayTrigger() {
2012-09-22 22:57:48 -07:00
@Override
2013-06-19 07:23:35 -07:00
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPayedCost payedCost) {
2012-09-22 22:57:48 -07:00
return new MagicEvent(
permanent,
MagicColorChoice.ALL_INSTANCE,
this,
2013-06-23 18:29:26 -07:00
"Choose a color\$. " +
2013-05-19 01:15:01 -07:00
"All Slivers have protection from chosen color."
2012-09-22 22:57:48 -07:00
);
}
@Override
2013-03-22 22:00:53 -07:00
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicColor color = event.getChosenColor();
2012-09-22 22:57:48 -07:00
final MagicAbility protection = color.getProtectionAbility();
game.doAction(new MagicAddStaticAction(event.getPermanent(), new MagicStatic(
2013-06-23 18:29:26 -07:00
MagicLayer.Ability,
2012-09-22 22:57:48 -07:00
MagicTargetFilter.TARGET_SLIVER) {
@Override
public void modAbilityFlags(final MagicPermanent source,final MagicPermanent permanent,final Set<MagicAbility> flags) {
flags.add(protection);
2012-09-22 22:57:48 -07:00
}
2013-06-23 18:29:26 -07:00
}
2012-09-22 22:57:48 -07:00
));
}
2013-05-19 01:15:01 -07:00
}
]