convert from java code to groovy code

master
melvin 2013-04-01 13:40:41 +08:00
parent a8bcb65cbc
commit c66a78046c
3 changed files with 24 additions and 34 deletions

View File

@ -0,0 +1,23 @@
[
new MagicWhenAttacksTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent creature) {
final MagicPlayer player=permanent.getController();
return (creature.getController()==player&&player.getNrOfAttackers()==1)?
new MagicEvent(
permanent,
player,
creature,
this,
creature+" gains lifelink until end of turn."
):
MagicEvent.NONE;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
game.doAction(new MagicSetAbilityAction(event.getRefPermanent(),MagicAbility.LifeLink));
}
}
]

View File

@ -9,4 +9,4 @@ cost={3}{W}{W}
pt=4/4
ability=flying,exalted
timing=fmain
requires_card_code
requires_groovy_code

View File

@ -1,33 +0,0 @@
package magic.card;
import magic.model.MagicAbility;
import magic.model.MagicGame;
import magic.model.MagicPermanent;
import magic.model.MagicPlayer;
import magic.model.action.MagicSetAbilityAction;
import magic.model.event.MagicEvent;
import magic.model.trigger.MagicWhenAttacksTrigger;
public class Battlegrace_Angel {
public static final MagicWhenAttacksTrigger T = new MagicWhenAttacksTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPermanent creature) {
final MagicPlayer player=permanent.getController();
return (creature.getController()==player&&player.getNrOfAttackers()==1)?
new MagicEvent(
permanent,
player,
creature,
this,
creature+" gains lifelink until end of turn."):
MagicEvent.NONE;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
game.doAction(new MagicSetAbilityAction(event.getRefPermanent(),MagicAbility.LifeLink));
}
};
}