convert from java code to groovy code

master
melvin 2013-05-19 10:25:10 +08:00
parent 12545c21b1
commit 4112bb93d3
3 changed files with 27 additions and 44 deletions

View File

@ -0,0 +1,26 @@
[
new MagicPermanentActivation(
[MagicCondition.CAN_TAP_CONDITION],
new MagicActivationHints(MagicTiming.Token),
"Draw"
) {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return [new MagicTapEvent(source)];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
this,
"PN draws a card for each Ally he or she controls."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicPlayer player = event.getPlayer();
final int amount = player.getNrOfPermanentsWithSubType(MagicSubType.Ally);
game.doAction(new MagicDrawAction(player,amount));
}
}
]

View File

@ -8,4 +8,4 @@ subtype=Merfolk,Wizard,Ally
cost={4}{U} cost={4}{U}
pt=1/3 pt=1/3
timing=main timing=main
requires_card_code requires_groovy_code

View File

@ -1,43 +0,0 @@
package magic.card;
import magic.model.MagicGame;
import magic.model.MagicPayedCost;
import magic.model.MagicPermanent;
import magic.model.MagicPlayer;
import magic.model.MagicSubType;
import magic.model.action.MagicDrawAction;
import magic.model.condition.MagicCondition;
import magic.model.event.MagicActivationHints;
import magic.model.event.MagicEvent;
import magic.model.event.MagicPermanentActivation;
import magic.model.event.MagicTapEvent;
import magic.model.event.MagicTiming;
public class Sea_Gate_Loremaster {
public static final MagicPermanentActivation A = new MagicPermanentActivation(
new MagicCondition[]{MagicCondition.CAN_TAP_CONDITION},
new MagicActivationHints(MagicTiming.Token),
"Draw") {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return new MagicEvent[]{new MagicTapEvent(source)};
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
this,
"PN draws a card for each Ally he or she controls."
);
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
final MagicPlayer player = event.getPlayer();
final int amount =
player.getNrOfPermanentsWithSubType(MagicSubType.Ally);
game.doAction(new MagicDrawAction(player,amount));
}
};
}