convert from java code to groovy code

master
melvin 2013-05-26 14:00:24 +08:00
parent a5c86771ac
commit 722b3fbc23
3 changed files with 30 additions and 46 deletions

View File

@ -0,0 +1,29 @@
[
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
MagicTargetChoice.NEG_TARGET_NONBLACK_CREATURE,
new MagicDestroyTargetPicker(false),
this,
"Destroy target nonblack creature\$. " +
"Put two 0/1 colorless Eldrazi Spawn creature tokens onto the battlefield. " +
"They have \"Sacrifice this creature: Add {1} to your mana pool.\""
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(new MagicDestroyAction(creature));
game.doAction(new MagicPlayTokensAction(
event.getPlayer(),
TokenCardDefinitions.get("Eldrazi Spawn"),
2
));
}
});
}
}
]

View File

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

View File

@ -1,45 +0,0 @@
package magic.card;
import magic.data.TokenCardDefinitions;
import magic.model.MagicGame;
import magic.model.MagicPayedCost;
import magic.model.MagicPermanent;
import magic.model.action.MagicDestroyAction;
import magic.model.action.MagicPermanentAction;
import magic.model.action.MagicPlayTokensAction;
import magic.model.choice.MagicTargetChoice;
import magic.model.event.MagicEvent;
import magic.model.event.MagicSpellCardEvent;
import magic.model.stack.MagicCardOnStack;
import magic.model.target.MagicDestroyTargetPicker;
public class Corpsehatch {
public static final MagicSpellCardEvent S = new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
MagicTargetChoice.NEG_TARGET_NONBLACK_CREATURE,
new MagicDestroyTargetPicker(false),
this,
"Destroy target nonblack creature$. " +
"Put two 0/1 colorless Eldrazi Spawn creature tokens onto the battlefield. " +
"They have \"Sacrifice this creature: Add {1} to your mana pool.\"");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(new MagicDestroyAction(creature));
game.doAction(new MagicPlayTokensAction(
event.getPlayer(),
TokenCardDefinitions.get("Eldrazi Spawn"),
2
));
}
});
}
};
}