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;
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() {
[
new MagicCDA() {
@Override
public void modPowerToughness(final MagicGame game, final MagicPlayer player, final MagicPowerToughness pt) {
final int amount = game.filterPermanents(player,MagicTargetFilter.TARGET_SPIRIT_YOU_CONTROL).size();
pt.set(amount, amount);
}
};
public static final MagicWhenPutIntoGraveyardTrigger T = new MagicWhenPutIntoGraveyardTrigger() {
},
new MagicWhenPutIntoGraveyardTrigger() {
@Override
public MagicEvent executeTrigger(
final MagicGame game,
@ -49,13 +27,14 @@ public class Kodama_of_the_Center_Tree {
targetFilter,false,MagicTargetHint.None,
"a Spirit card from your graveyard)");
return new MagicEvent(
permanent,
new MagicMayChoice(targetChoice),
new MagicGraveyardTargetPicker(false),
this,
"PN may$ return target Spirit card$ with " +
"converted mana cost " + cmc + " or less " +
"from his or her graveyard to his or her hand.");
permanent,
new MagicMayChoice(targetChoice),
new MagicGraveyardTargetPicker(false),
this,
"PN may\$ return target Spirit card\$ with " +
"converted mana cost " + cmc + " or less " +
"from his or her graveyard to his or her hand."
);
}
return MagicEvent.NONE;
}
@ -67,15 +46,17 @@ public class Kodama_of_the_Center_Tree {
event.processTargetCard(game,new MagicCardAction() {
public void doAction(final MagicCard card) {
game.doAction(new MagicRemoveCardAction(
card,
MagicLocationType.Graveyard));
card,
MagicLocationType.Graveyard
));
game.doAction(new MagicMoveCardAction(
card,
MagicLocationType.Graveyard,
MagicLocationType.OwnersHand));
card,
MagicLocationType.Graveyard,
MagicLocationType.OwnersHand
));
}
});
}
}
};
}
}
]

View File

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