magarena/release/Magarena/scripts/Brush_with_Death.groovy

31 lines
1.2 KiB
Groovy

[
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
new MagicBuybackChoice(
MagicTargetChoice.TARGET_OPPONENT,
MagicManaCost.create("{2}{B}{B}")
),
this,
"Target opponent\$ loses 2 life and PN gains 2 life. " +
"If the buyback cost was payed\$, return SN to its owner's hand as it resolves."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPlayer(game,new MagicPlayerAction() {
public void doAction(final MagicPlayer player) {
game.doAction(new MagicChangeLifeAction(player,-2));
game.doAction(new MagicChangeLifeAction(event.getPlayer(),2));
if (event.isBuyback()) {
game.doAction(new MagicChangeCardDestinationAction(event.getCardOnStack(), MagicLocationType.OwnersHand));
}
}
});
}
}
]