convert from java code to groovy code

master
melvin 2013-05-28 20:09:55 +08:00
parent d65e2e9538
commit 90da0addb6
3 changed files with 45 additions and 69 deletions

View File

@ -0,0 +1,44 @@
[
new MagicPermanentActivation(
[
MagicCondition.CAN_TAP_CONDITION,
MagicConditionFactory.ManaCost("{2}{W}")
],
new MagicActivationHints(MagicTiming.Tapping),
"Tap"
) {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return [
new MagicPayManaCostTapEvent(source,"{2}{W}")
];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.NEG_TARGET_CREATURE,
new MagicTapTargetPicker(true,false),
this,
"Tap target creature\$. If that creature is a Zombie, exile it."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(new MagicTapAction(creature,true));
if (creature.hasSubType(MagicSubType.Zombie)) {
game.doAction(new MagicRemoveFromPlayAction(
creature,
MagicLocationType.Exile
));
}
}
});
}
}
]

View File

@ -8,4 +8,4 @@ subtype=Human,Cleric
cost={3}{W} cost={3}{W}
pt=2/1 pt=2/1
timing=main timing=main
requires_card_code requires_groovy_code

View File

@ -1,68 +0,0 @@
package magic.card;
import magic.model.MagicGame;
import magic.model.MagicLocationType;
import magic.model.MagicManaCost;
import magic.model.MagicPayedCost;
import magic.model.MagicPermanent;
import magic.model.MagicSubType;
import magic.model.action.MagicPermanentAction;
import magic.model.action.MagicRemoveFromPlayAction;
import magic.model.action.MagicTapAction;
import magic.model.choice.MagicTargetChoice;
import magic.model.condition.MagicCondition;
import magic.model.condition.MagicConditionFactory;
import magic.model.event.MagicActivationHints;
import magic.model.event.MagicEvent;
import magic.model.event.MagicPayManaCostTapEvent;
import magic.model.event.MagicPermanentActivation;
import magic.model.event.MagicTiming;
import magic.model.target.MagicTapTargetPicker;
public class Holy_Justiciar {
public static final MagicPermanentActivation A = new MagicPermanentActivation(
new MagicCondition[]{
MagicCondition.CAN_TAP_CONDITION,
MagicConditionFactory.ManaCost("{2}{W}")
},
new MagicActivationHints(MagicTiming.Tapping),
"Tap"
) {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return new MagicEvent[]{
new MagicPayManaCostTapEvent(source,"{2}{W}")
};
}
@Override
public MagicEvent getPermanentEvent(
final MagicPermanent source,
final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.NEG_TARGET_CREATURE,
new MagicTapTargetPicker(true,false),
this,
"Tap target creature$. If that creature is a Zombie, exile it."
);
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(new MagicTapAction(creature,true));
if (creature.hasSubType(MagicSubType.Zombie)) {
game.doAction(new MagicRemoveFromPlayAction(
creature,
MagicLocationType.Exile));
}
}
});
}
};
}