convert from java code to groovy code

master
melvin 2013-05-19 10:33:57 +08:00
parent a7f7b76c99
commit 06e1de1c32
3 changed files with 25 additions and 41 deletions

View File

@ -0,0 +1,24 @@
[
new MagicWhenComesIntoPlayTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPlayer player) {
return MagicCondition.METALCRAFT_CONDITION.accept(permanent) ?
new MagicEvent(
permanent,
MagicTargetChoice.TARGET_CREATURE,
MagicBounceTargetPicker.getInstance(),
this,
"Return target creature\$ to its owner's hand."
) :
MagicEvent.NONE;
}
@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.OwnersHand));
}
});
}
}
]

View File

@ -9,4 +9,4 @@ cost={3}{U}
pt=2/2 pt=2/2
ability=flying ability=flying
timing=main timing=main
requires_card_code requires_groovy_code

View File

@ -1,40 +0,0 @@
package magic.card;
import magic.model.MagicGame;
import magic.model.MagicLocationType;
import magic.model.MagicPermanent;
import magic.model.MagicPlayer;
import magic.model.action.MagicPermanentAction;
import magic.model.action.MagicRemoveFromPlayAction;
import magic.model.choice.MagicTargetChoice;
import magic.model.condition.MagicCondition;
import magic.model.event.MagicEvent;
import magic.model.target.MagicBounceTargetPicker;
import magic.model.trigger.MagicWhenComesIntoPlayTrigger;
public class Lumengrid_Drake {
public static final MagicWhenComesIntoPlayTrigger T = new MagicWhenComesIntoPlayTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPlayer player) {
return MagicCondition.METALCRAFT_CONDITION.accept(permanent) ?
new MagicEvent(
permanent,
MagicTargetChoice.TARGET_CREATURE,
MagicBounceTargetPicker.getInstance(),
this,
"Return target creature$ to its owner's hand."
) :
MagicEvent.NONE;
}
@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.OwnersHand));
}
});
}
};
}