convert from java code to groovy code

master
melvin 2013-05-26 14:02:35 +08:00
parent c01568fe7e
commit a6eb6bca3a
3 changed files with 35 additions and 55 deletions

View File

@ -0,0 +1,34 @@
[
new MagicPermanentActivation(
[
MagicCondition.CAN_TAP_CONDITION,
MagicConditionFactory.ManaCost("{1}{U}{R}")
],
new MagicActivationHints(MagicTiming.Draw),
"Draw"
) {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return [
new MagicPayManaCostTapEvent(source,"{1}{U}{R}")
];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
return new MagicEvent(
source,
this,
"PN draws a card, then discards a card."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicPlayer player = event.getPlayer();
game.doAction(new MagicDrawAction(player,1));
game.addEvent(new MagicDiscardEvent(event.getPermanent(),player,1,false));
}
}
]

View File

@ -6,4 +6,4 @@ rarity=R
type=Land
ability=tap add mana {1}
timing=land
requires_card_code
requires_groovy_code

View File

@ -1,54 +0,0 @@
package magic.card;
import magic.model.MagicGame;
import magic.model.MagicManaCost;
import magic.model.MagicPayedCost;
import magic.model.MagicPermanent;
import magic.model.MagicPlayer;
import magic.model.action.MagicDrawAction;
import magic.model.condition.MagicCondition;
import magic.model.condition.MagicConditionFactory;
import magic.model.event.MagicActivationHints;
import magic.model.event.MagicDiscardEvent;
import magic.model.event.MagicEvent;
import magic.model.event.MagicPayManaCostTapEvent;
import magic.model.event.MagicPermanentActivation;
import magic.model.event.MagicTiming;
public class Desolate_Lighthouse {
public static final MagicPermanentActivation A = new MagicPermanentActivation(
new MagicCondition[] {
MagicCondition.CAN_TAP_CONDITION,
MagicConditionFactory.ManaCost("{1}{U}{R}")
},
new MagicActivationHints(MagicTiming.Draw),
"Draw") {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return new MagicEvent[] {
new MagicPayManaCostTapEvent(source,"{1}{U}{R}")
};
}
@Override
public MagicEvent getPermanentEvent(
final MagicPermanent source,
final MagicPayedCost payedCost) {
return new MagicEvent(
source,
this,
"PN draws a card, then discards a card."
);
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
final MagicPlayer player = event.getPlayer();
game.doAction(new MagicDrawAction(player,1));
game.addEvent(new MagicDiscardEvent(event.getPermanent(),player,1,false));
}
};
}