magarena/release/Magarena/scripts/Kodama_of_the_Center_Tree.g...

63 lines
2.6 KiB
Groovy
Raw Normal View History

2013-05-30 21:57:10 -07:00
[
new MagicCDA() {
2013-04-12 19:32:25 -07:00
@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);
}
2013-05-30 21:57:10 -07:00
},
new MagicWhenPutIntoGraveyardTrigger() {
2013-04-12 19:32:25 -07:00
@Override
public MagicEvent executeTrigger(
final MagicGame game,
final MagicPermanent permanent,
final MagicGraveyardTriggerData triggerData) {
if (triggerData.fromLocation == MagicLocationType.Play) {
2013-06-06 06:03:49 -07:00
final int cmc = game.filterPermanents(
permanent.getController(),
MagicTargetFilter.TARGET_SPIRIT_YOU_CONTROL
).size()+1;
2013-04-12 19:32:25 -07:00
final MagicTargetFilter<MagicCard> targetFilter =
2013-06-06 06:03:49 -07:00
new MagicTargetFilter.MagicCMCCardFilter(
MagicTargetFilter.TARGET_SPIRIT_CARD_FROM_GRAVEYARD,
MagicTargetFilter.Operator.LESS_THAN_OR_EQUAL,
cmc
);
2013-06-23 18:29:26 -07:00
final MagicTargetChoice targetChoice =
2013-06-06 06:03:49 -07:00
new MagicTargetChoice(
2013-04-12 19:32:25 -07:00
targetFilter,false,MagicTargetHint.None,
2013-06-06 06:03:49 -07:00
"a Spirit card from your graveyard"
);
2013-04-12 19:32:25 -07:00
return new MagicEvent(
2013-05-30 21:57:10 -07:00
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."
);
2013-04-12 19:32:25 -07:00
}
return MagicEvent.NONE;
}
@Override
2013-06-06 06:03:49 -07:00
public void executeEvent(final MagicGame game, final MagicEvent event) {
2013-04-12 19:32:25 -07:00
if (event.isYes()) {
event.processTargetCard(game,new MagicCardAction() {
public void doAction(final MagicCard card) {
game.doAction(new MagicRemoveCardAction(
2013-05-30 21:57:10 -07:00
card,
MagicLocationType.Graveyard
));
2013-04-12 19:32:25 -07:00
game.doAction(new MagicMoveCardAction(
2013-05-30 21:57:10 -07:00
card,
MagicLocationType.Graveyard,
MagicLocationType.OwnersHand
));
2013-04-12 19:32:25 -07:00
}
});
}
}
2013-05-30 21:57:10 -07:00
}
]