magarena/release/Magarena/scripts/Stuffy_Doll.groovy

48 lines
1.7 KiB
Groovy

[
new MagicPermanentActivation(
new MagicActivationHints(MagicTiming.Removal),
"Damage"
) {
@Override
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
return [new MagicTapEvent(source)];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
this,
"SN deals 1 damage to itself."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicPermanent permanent=event.getPermanent();
final MagicDamage damage=new MagicDamage(permanent,permanent,1);
game.doAction(new MagicDealDamageAction(damage));
}
},
new MagicWhenDamageIsDealtTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) {
return damage.getTarget() == permanent ?
new MagicEvent(
permanent,
damage.getDealtAmount(),
this,
"SN deals RN damage to ${permanent.getChosenPlayer()}."
) :
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicDamage damage = new MagicDamage(
event.getPermanent(),
event.getPermanent().getChosenPlayer(),
event.getRefInt()
);
game.doAction(new MagicDealDamageAction(damage));
}
}
]