convert from java code to groovy code

master
melvin 2013-05-26 17:44:11 +08:00
parent 83ca8090d7
commit 38f6dda49c
3 changed files with 34 additions and 53 deletions

View File

@ -0,0 +1,33 @@
[
new MagicPermanentActivation(
[MagicCondition.CAN_TAP_CONDITION],
new MagicActivationHints(MagicTiming.Animate),
"Shadow"
) {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return [new MagicTapEvent(source)];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.TARGET_CREATURE,
MagicShadowTargetPicker.getInstance(),
this,
"Target creature\$ gains shadow 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) {
game.doAction(new MagicSetAbilityAction(creature,MagicAbility.Shadow));
}
});
}
}
]

View File

@ -8,4 +8,4 @@ subtype=Dauthi,Minion
cost={2}{B}
pt=1/1
timing=main
requires_card_code
requires_groovy_code

View File

@ -1,52 +0,0 @@
package magic.card;
import magic.model.MagicAbility;
import magic.model.MagicGame;
import magic.model.MagicPayedCost;
import magic.model.MagicPermanent;
import magic.model.action.MagicPermanentAction;
import magic.model.action.MagicSetAbilityAction;
import magic.model.choice.MagicTargetChoice;
import magic.model.condition.MagicCondition;
import magic.model.event.MagicActivationHints;
import magic.model.event.MagicEvent;
import magic.model.event.MagicPermanentActivation;
import magic.model.event.MagicTapEvent;
import magic.model.event.MagicTiming;
import magic.model.target.MagicShadowTargetPicker;
public class Dauthi_Trapper {
public static final MagicPermanentActivation A = new MagicPermanentActivation(
new MagicCondition[]{MagicCondition.CAN_TAP_CONDITION},
new MagicActivationHints(MagicTiming.Animate,false),
"Shadow"
) {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return new MagicEvent[]{new MagicTapEvent(source)};
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.TARGET_CREATURE,
MagicShadowTargetPicker.getInstance(),
this,
"Target creature$ gains shadow 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) {
game.doAction(new MagicSetAbilityAction(creature,MagicAbility.Shadow));
}
});
}
};
}