convert from java code to groovy code

master
melvin 2013-04-01 22:00:44 +08:00
parent 1ccae9386d
commit 40c20693cc
3 changed files with 25 additions and 36 deletions

View File

@ -0,0 +1,24 @@
[
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
MagicTargetChoice.TARGET_OPPONENT,
this,
"Target opponent$ discards a card at random, then discards a card."
);
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
event.processTargetPlayer(game,new MagicPlayerAction() {
public void doAction(final MagicPlayer player) {
game.addEvent(new MagicDiscardEvent(event.getSource(),player,1,true));
game.addEvent(new MagicDiscardEvent(event.getSource(),player,1,false));
}
});
}
}
]

View File

@ -6,4 +6,4 @@ rarity=U
type=Sorcery
cost={2}{B}
timing=removal
requires_card_code
requires_groovy_code

View File

@ -1,35 +0,0 @@
package magic.card;
import magic.model.MagicGame;
import magic.model.MagicPayedCost;
import magic.model.MagicPlayer;
import magic.model.action.MagicPlayerAction;
import magic.model.choice.MagicTargetChoice;
import magic.model.event.MagicDiscardEvent;
import magic.model.event.MagicEvent;
import magic.model.event.MagicSpellCardEvent;
import magic.model.stack.MagicCardOnStack;
public class Stupor {
public static final MagicSpellCardEvent E = new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
MagicTargetChoice.TARGET_OPPONENT,
this,
"Target opponent$ discards a card at random, then discards a card.");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
event.processTargetPlayer(game,new MagicPlayerAction() {
public void doAction(final MagicPlayer player) {
game.addEvent(new MagicDiscardEvent(event.getSource(),player,1,true));
game.addEvent(new MagicDiscardEvent(event.getSource(),player,1,false));
}
});
}
};
}