magarena/release/Magarena/scripts/Mask_of_Memory.groovy

39 lines
1.3 KiB
Groovy

[
new MagicWhenDamageIsDealtTrigger() {
@Override
public MagicEvent executeTrigger(
final MagicGame game,
final MagicPermanent permanent,
final MagicDamage damage) {
return (permanent.getEquippedCreature() == damage.getSource() &&
damage.getTarget().isPlayer() &&
damage.isCombat()) ?
new MagicEvent(
permanent,
new MagicSimpleMayChoice(
MagicSimpleMayChoice.DRAW_CARDS,
2,
MagicSimpleMayChoice.DEFAULT_NONE
),
this,
"You may\$ draw two cards. If you do, discard a card."
) :
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
if (event.isYes()) {
final MagicPlayer player = event.getPlayer();
game.doAction(new MagicDrawAction(player, 2));
game.addEvent(new MagicDiscardEvent(
event.getSource(),
player,
1,
false
));
}
}
}
]