magarena/release/Magarena/scripts/Embersmith.groovy

33 lines
1.3 KiB
Groovy

[
new MagicWhenOtherSpellIsCastTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicCardOnStack spell) {
return (spell.isFriend(permanent) &&
spell.hasType(MagicType.Artifact)) ?
new MagicEvent(
permanent,
new MagicMayChoice(
new MagicPayManaCostChoice(MagicManaCost.create("{1}")),
MagicTargetChoice.NEG_TARGET_CREATURE_OR_PLAYER
),
new MagicDamageTargetPicker(2),
this,
"PN may\$ pay {1}\$. If you do, SN deals 1 " +
"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 MagicDamage damage = new MagicDamage(event.getPermanent(),target,1);
game.doAction(new MagicDealDamageAction(damage));
}
});
}
}
}
]