convert from java code to groovy code

master
melvin 2013-05-18 18:45:42 +08:00
parent 54fe7de590
commit 97fc050a48
3 changed files with 25 additions and 38 deletions

View File

@ -0,0 +1,24 @@
[
new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
MagicTargetChoice.NEG_TARGET_CREATURE,
new MagicWeakenTargetPicker(1,1),
this,
"Target creature\$ gets -1/-1 until end of turn. " +
"That creature gets -13/-13 until end of turn instead if a creature died this turn."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
final int amount = game.getCreatureDiedThisTurn() ? -13 : -1;
game.doAction(new MagicChangeTurnPTAction(creature,amount,amount));
}
});
}
}
]

View File

@ -7,4 +7,4 @@ rarity=C
type=Instant type=Instant
cost={B} cost={B}
timing=removal timing=removal
requires_card_code requires_groovy_code

View File

@ -1,37 +0,0 @@
package magic.card;
import magic.model.MagicGame;
import magic.model.MagicPayedCost;
import magic.model.MagicPermanent;
import magic.model.action.MagicChangeTurnPTAction;
import magic.model.action.MagicPermanentAction;
import magic.model.choice.MagicTargetChoice;
import magic.model.event.MagicEvent;
import magic.model.event.MagicSpellCardEvent;
import magic.model.stack.MagicCardOnStack;
import magic.model.target.MagicWeakenTargetPicker;
public class Tragic_Slip {
public static final MagicSpellCardEvent S = new MagicSpellCardEvent() {
@Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) {
return new MagicEvent(
cardOnStack,
MagicTargetChoice.NEG_TARGET_CREATURE,
new MagicWeakenTargetPicker(1,1),
this,
"Target creature$ gets -1/-1 until end of turn.");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
final int amount = game.getCreatureDiedThisTurn() ? -13 : -1;
game.doAction(new MagicChangeTurnPTAction(creature,amount,amount));
}
});
}
};
}