convert from java code to groovy code

master
melvin 2013-05-31 12:57:10 +08:00
parent 1fad38b74d
commit 044b01088e
2 changed files with 22 additions and 41 deletions

View File

@ -1,34 +1,12 @@
package magic.card; [
new MagicCDA() {
import magic.model.MagicCard;
import magic.model.MagicGame;
import magic.model.MagicLocationType;
import magic.model.MagicPermanent;
import magic.model.MagicPlayer;
import magic.model.MagicPowerToughness;
import magic.model.action.MagicCardAction;
import magic.model.action.MagicMoveCardAction;
import magic.model.action.MagicRemoveCardAction;
import magic.model.choice.MagicMayChoice;
import magic.model.choice.MagicTargetChoice;
import magic.model.event.MagicEvent;
import magic.model.mstatic.MagicCDA;
import magic.model.target.MagicGraveyardTargetPicker;
import magic.model.target.MagicTargetFilter;
import magic.model.target.MagicTargetHint;
import magic.model.trigger.MagicGraveyardTriggerData;
import magic.model.trigger.MagicWhenPutIntoGraveyardTrigger;
public class Kodama_of_the_Center_Tree {
public static final MagicCDA CDA = new MagicCDA() {
@Override @Override
public void modPowerToughness(final MagicGame game, final MagicPlayer player, final MagicPowerToughness pt) { public void modPowerToughness(final MagicGame game, final MagicPlayer player, final MagicPowerToughness pt) {
final int amount = game.filterPermanents(player,MagicTargetFilter.TARGET_SPIRIT_YOU_CONTROL).size(); final int amount = game.filterPermanents(player,MagicTargetFilter.TARGET_SPIRIT_YOU_CONTROL).size();
pt.set(amount, amount); pt.set(amount, amount);
} }
}; },
new MagicWhenPutIntoGraveyardTrigger() {
public static final MagicWhenPutIntoGraveyardTrigger T = new MagicWhenPutIntoGraveyardTrigger() {
@Override @Override
public MagicEvent executeTrigger( public MagicEvent executeTrigger(
final MagicGame game, final MagicGame game,
@ -53,9 +31,10 @@ public class Kodama_of_the_Center_Tree {
new MagicMayChoice(targetChoice), new MagicMayChoice(targetChoice),
new MagicGraveyardTargetPicker(false), new MagicGraveyardTargetPicker(false),
this, this,
"PN may$ return target Spirit card$ with " + "PN may\$ return target Spirit card\$ with " +
"converted mana cost " + cmc + " or less " + "converted mana cost " + cmc + " or less " +
"from his or her graveyard to his or her hand."); "from his or her graveyard to his or her hand."
);
} }
return MagicEvent.NONE; return MagicEvent.NONE;
} }
@ -68,14 +47,16 @@ public class Kodama_of_the_Center_Tree {
public void doAction(final MagicCard card) { public void doAction(final MagicCard card) {
game.doAction(new MagicRemoveCardAction( game.doAction(new MagicRemoveCardAction(
card, card,
MagicLocationType.Graveyard)); MagicLocationType.Graveyard
));
game.doAction(new MagicMoveCardAction( game.doAction(new MagicMoveCardAction(
card, card,
MagicLocationType.Graveyard, MagicLocationType.Graveyard,
MagicLocationType.OwnersHand)); MagicLocationType.OwnersHand
));
} }
}); });
} }
} }
};
} }
]

View File

@ -7,4 +7,4 @@ type=Legendary,Creature
subtype=Spirit subtype=Spirit
cost={4}{G} cost={4}{G}
timing=main timing=main
requires_card_code requires_groovy_code