convert from java code to groovy code

master
melvin 2013-05-18 15:11:11 +08:00
parent 2195a7eb1d
commit 5dd3a21503
3 changed files with 28 additions and 39 deletions

View File

@ -0,0 +1,27 @@
[
new MagicWhenAttacksTrigger(1) {
@Override
public MagicEvent executeTrigger(
final MagicGame game,
final MagicPermanent permanent,
final MagicPermanent creature) {
final MagicPermanent equippedCreature = permanent.getEquippedCreature();
return (equippedCreature.isValid() &&
equippedCreature == creature) ?
new MagicEvent(
permanent,
this,
"PN puts a 4/4 white Angel " +
"creature token with flying onto the battlefield."
):
MagicEvent.NONE;
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
game.doAction(new MagicPlayTokenAction(
event.getPlayer(),
TokenCardDefinitions.get("Angel4")
));
}
}
]

View File

@ -9,4 +9,4 @@ cost={4}
equip={4} equip={4}
given_ability=first strike given_ability=first strike
timing=equipment timing=equipment
requires_card_code requires_groovy_code

View File

@ -1,38 +0,0 @@
package magic.card;
import magic.data.TokenCardDefinitions;
import magic.model.MagicGame;
import magic.model.MagicPermanent;
import magic.model.action.MagicPlayTokenAction;
import magic.model.event.MagicEvent;
import magic.model.trigger.MagicWhenAttacksTrigger;
public class Moonsilver_Spear {
public static final MagicWhenAttacksTrigger T = new MagicWhenAttacksTrigger(1) {
@Override
public MagicEvent executeTrigger(
final MagicGame game,
final MagicPermanent permanent,
final MagicPermanent creature) {
final MagicPermanent equippedCreature = permanent.getEquippedCreature();
return (equippedCreature.isValid() &&
equippedCreature == creature) ?
new MagicEvent(
permanent,
permanent.getController(),
this,
permanent.getController() + " puts a 4/4 white Angel " +
"creature token with flying onto the battlefield."):
MagicEvent.NONE;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
game.doAction(new MagicPlayTokenAction(
event.getPlayer(),
TokenCardDefinitions.get("Angel4")));
}
};
}