magarena/release/Magarena/scripts/Gloom_Surgeon.groovy

43 lines
1.7 KiB
Groovy
Raw Normal View History

2013-05-29 22:30:02 -07:00
[
new MagicIfDamageWouldBeDealtTrigger(MagicTrigger.PREVENT_DAMAGE) {
2013-05-29 22:30:02 -07:00
@Override
public MagicEvent executeTrigger(final MagicGame game, final MagicPermanent permanent, final MagicDamage damage) {
if (damage.isCombat() && damage.getTarget() == permanent) {
final int amt = damage.getAmount();
// Prevention effect
damage.prevent();
2013-05-29 22:30:02 -07:00
return new MagicEvent(
permanent,
amt,
2013-05-29 22:30:02 -07:00
this,
"Exile RN cards from the top of your library."
);
}
return MagicEvent.NONE;
2013-06-23 18:29:26 -07:00
}
2013-05-29 22:30:02 -07:00
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final int amount = event.getRefInt();
final MagicPlayer player = event.getPlayer();
final MagicCardList library = player.getLibrary();
final int size = library.size();
2013-06-23 18:29:26 -07:00
final int count = size >= amount ? amount : size;
2013-05-29 22:30:02 -07:00
if (count > 0) {
//setScore(player,ArtificialScoringSystem.getMillScore(count));
for (int c=count;c>0;c--) {
final MagicCard card = library.getCardAtTop();
game.doAction(new MagicRemoveCardAction(
card,
MagicLocationType.OwnersLibrary
));
game.doAction(new MagicMoveCardAction(
card,
MagicLocationType.OwnersLibrary,
MagicLocationType.Exile
));
}
}
}
}
]