convert from java code to groovy code

master
melvin 2013-05-31 12:03:43 +08:00
parent 60e67a9a71
commit 03d9b2f646
3 changed files with 61 additions and 85 deletions

View File

@ -0,0 +1,60 @@
[
new MagicPermanentActivation(
[
MagicCondition.HAS_CARD_CONDITION,
MagicConditionFactory.ManaCost("{3}{B}")
],
new MagicActivationHints(MagicTiming.Removal,true),
"-2/-2"
) {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return [
new MagicPayManaCostEvent(source,"{3}{B}"),
new MagicDiscardEvent(source,source.getController(),1,false)
];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.NEG_TARGET_CREATURE,
new MagicWeakenTargetPicker(2,2),
this,
"Target creature\$ gets -2/-2 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 MagicChangeTurnPTAction(creature,-2,-2));
}
});
}
},
new MagicPermanentActivation(
[MagicConditionFactory.ManaCost("{3}{R}")],
new MagicActivationHints(MagicTiming.Token,true),
"Token"
) {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return [new MagicPayManaCostEvent(source,"{3}{R}")];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
this,
"PN puts a 2/1 red Goblin creature token with haste onto the battlefield. Exile it at end of turn."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
final MagicPlayer player=event.getPlayer();
final MagicCard card=MagicCard.createTokenCard(TokenCardDefinitions.get("Goblin2"),player);
game.doAction(new MagicPlayCardAction(card,player,MagicPlayCardAction.REMOVE_AT_END_OF_TURN));
}
}
]

View File

@ -8,4 +8,4 @@ subtype=Zombie,Shaman
cost={B/R}{B/R}
pt=2/2
timing=fmain
requires_card_code
requires_groovy_code

View File

@ -1,84 +0,0 @@
package magic.card;
import magic.data.TokenCardDefinitions;
import magic.model.MagicCard;
import magic.model.MagicGame;
import magic.model.MagicManaCost;
import magic.model.MagicPayedCost;
import magic.model.MagicPermanent;
import magic.model.MagicPlayer;
import magic.model.action.MagicChangeTurnPTAction;
import magic.model.action.MagicPermanentAction;
import magic.model.action.MagicPlayCardAction;
import magic.model.choice.MagicTargetChoice;
import magic.model.condition.MagicCondition;
import magic.model.condition.MagicConditionFactory;
import magic.model.event.MagicActivationHints;
import magic.model.event.MagicDiscardEvent;
import magic.model.event.MagicEvent;
import magic.model.event.MagicPayManaCostEvent;
import magic.model.event.MagicPermanentActivation;
import magic.model.event.MagicTiming;
import magic.model.target.MagicWeakenTargetPicker;
public class Rakdos_Guildmage {
public static final MagicPermanentActivation A = new MagicPermanentActivation(
new MagicCondition[]{
MagicCondition.HAS_CARD_CONDITION,
MagicConditionFactory.ManaCost("{3}{B}")
},
new MagicActivationHints(MagicTiming.Removal,true),
"-2/-2") {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return new MagicEvent[]{
new MagicPayManaCostEvent(source,"{3}{B}"),
new MagicDiscardEvent(source,source.getController(),1,false)
};
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.NEG_TARGET_CREATURE,
new MagicWeakenTargetPicker(2,2),
this,
"Target creature$ gets -2/-2 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 MagicChangeTurnPTAction(creature,-2,-2));
}
});
}
};
public static final MagicPermanentActivation A2 = new MagicPermanentActivation(
new MagicCondition[]{MagicConditionFactory.ManaCost("{3}{R}")},
new MagicActivationHints(MagicTiming.Token,true),
"Token") {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return new MagicEvent[]{new MagicPayManaCostEvent(source,"{3}{R}")};
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
this,
"PN puts a 2/1 red Goblin creature token with haste onto the battlefield. Exile it at end of turn.");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
final MagicPlayer player=event.getPlayer();
final MagicCard card=MagicCard.createTokenCard(TokenCardDefinitions.get("Goblin2"),player);
game.doAction(new MagicPlayCardAction(card,player,MagicPlayCardAction.REMOVE_AT_END_OF_TURN));
}
};
}