convert from java code to groovy code

master
melvin 2013-05-30 13:28:45 +08:00
parent b22c82fb11
commit 4f8b56b1d5
3 changed files with 45 additions and 67 deletions

View File

@ -0,0 +1,44 @@
[
new MagicPermanentActivation(
[
MagicConditionFactory.ManaCost("{1}{G}"),
MagicCondition.ONE_HUMAN_CONDITION,
],
new MagicActivationHints(MagicTiming.Removal),
"Pump"
) {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return [
new MagicPayManaCostEvent(source,"{1}{G}"),
new MagicSacrificePermanentEvent(
source,
MagicTargetChoice.SACRIFICE_HUMAN
)
];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.POS_TARGET_CREATURE,
MagicPumpTargetPicker.create(),
this,
"PN puts two +1/+1 counters on target creature\$."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(new MagicChangeCountersAction(
creature,
MagicCounterType.PlusOne,
2,
true
));
}
});
}
}
]

View File

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

View File

@ -1,66 +0,0 @@
package magic.card;
import magic.model.MagicCounterType;
import magic.model.MagicGame;
import magic.model.MagicManaCost;
import magic.model.MagicPayedCost;
import magic.model.MagicPermanent;
import magic.model.action.MagicChangeCountersAction;
import magic.model.action.MagicPermanentAction;
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.MagicPayManaCostEvent;
import magic.model.event.MagicPermanentActivation;
import magic.model.event.MagicSacrificePermanentEvent;
import magic.model.event.MagicTiming;
import magic.model.target.MagicPumpTargetPicker;
public class Deranged_Outcast {
public static final MagicPermanentActivation A = new MagicPermanentActivation(
new MagicCondition[]{
MagicConditionFactory.ManaCost("{1}{G}"),
MagicCondition.ONE_HUMAN_CONDITION,
},
new MagicActivationHints(MagicTiming.Removal),
"Pump") {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return new MagicEvent[]{
new MagicPayManaCostEvent(source,"{1}{G}"),
new MagicSacrificePermanentEvent(
source,
source.getController(),
MagicTargetChoice.SACRIFICE_HUMAN
)
};
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.POS_TARGET_CREATURE,
MagicPumpTargetPicker.create(),
this,
"PN puts two +1/+1 counters on target creature$."
);
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
event.processTargetPermanent(game,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
game.doAction(new MagicChangeCountersAction(
creature,
MagicCounterType.PlusOne,
2,
true
));
}
});
}
};
}