magarena/release/Magarena/scripts/Stuffy_Doll.groovy

48 lines
1.7 KiB
Groovy
Raw Normal View History

2013-05-30 19:59:31 -07:00
[
new MagicPermanentActivation(
new MagicActivationHints(MagicTiming.Removal),
"Damage"
) {
@Override
public 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
2013-06-23 18:29:26 -07:00
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicDamage damage) {
return damage.getTarget() == permanent ?
new MagicEvent(
2013-05-30 19:59:31 -07:00
permanent,
damage.getDealtAmount(),
2013-05-30 19:59:31 -07:00
this,
"SN deals RN damage to ${permanent.getChosenPlayer()}."
) :
MagicEvent.NONE;
2013-05-30 19:59:31 -07:00
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicDamage damage = new MagicDamage(
event.getPermanent(),
event.getPermanent().getChosenPlayer(),
2013-05-30 19:59:31 -07:00
event.getRefInt()
);
game.doAction(new MagicDealDamageAction(damage));
}
}
2013-05-30 20:26:35 -07:00
]