36 lines
1.5 KiB
Groovy
36 lines
1.5 KiB
Groovy
[
|
|
new MagicWhenAttacksTrigger() {
|
|
@Override
|
|
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent creature) {
|
|
return (permanent==creature) ?
|
|
new MagicEvent(
|
|
permanent,
|
|
new MagicMayChoice(
|
|
new MagicPayManaCostChoice(MagicManaCost.create("{X}{R}")),
|
|
MagicTargetChoice.NEG_TARGET_CREATURE_OR_PLAYER
|
|
),
|
|
new MagicDamageTargetPicker(
|
|
permanent.getController().getMaximumX(game,MagicManaCost.create("{X}{R}"))
|
|
),
|
|
this,
|
|
"You may pay\$ {X}{R}\$. If you do, SN " +
|
|
"deals X damage to target creature or player\$."
|
|
):
|
|
MagicEvent.NONE;
|
|
}
|
|
|
|
@Override
|
|
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
|
if (event.isYes()) {
|
|
event.processTarget(game,new MagicTargetAction() {
|
|
public void doAction(final MagicTarget target) {
|
|
final MagicPayManaCostResult payedManaCost = event.getPaidMana();
|
|
final MagicDamage damage=new MagicDamage(event.getPermanent(),target,payedManaCost.getX());
|
|
game.doAction(new MagicDealDamageAction(damage));
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
]
|