convert from java code to groovy code

master
melvin 2013-05-19 13:55:48 +08:00
parent 26407208d0
commit e2f6b58bd0
3 changed files with 27 additions and 42 deletions

View File

@ -0,0 +1,26 @@
[
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
MagicTargetChoice.NEG_TARGET_CREATURE,
MagicExileTargetPicker.create(),
this,
"Exile target creature\$. Its controller gains life equal to its power."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(new MagicRemoveFromPlayAction(creature,MagicLocationType.Exile));
game.doAction(new MagicChangeLifeAction(
creature.getController(),
creature.getPower()
));
}
});
}
}
]

View File

@ -7,4 +7,4 @@ rarity=U
type=Instant
cost={W}
timing=removal
requires_card_code
requires_groovy_code

View File

@ -1,41 +0,0 @@
package magic.card;
import magic.model.MagicGame;
import magic.model.MagicLocationType;
import magic.model.MagicPayedCost;
import magic.model.MagicPermanent;
import magic.model.action.MagicChangeLifeAction;
import magic.model.action.MagicPermanentAction;
import magic.model.action.MagicRemoveFromPlayAction;
import magic.model.choice.MagicTargetChoice;
import magic.model.event.MagicEvent;
import magic.model.event.MagicSpellCardEvent;
import magic.model.stack.MagicCardOnStack;
import magic.model.target.MagicExileTargetPicker;
public class Swords_to_Plowshares {
public static final MagicSpellCardEvent E = new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
MagicTargetChoice.NEG_TARGET_CREATURE,
MagicExileTargetPicker.create(),
this,
"Exile target creature$. Its controller gains life equal to its power.");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(new MagicChangeLifeAction(
creature.getController(),
creature.getPower()));
game.doAction(new MagicRemoveFromPlayAction(creature,MagicLocationType.Exile));
}
});
}
};
}