convert from java code to groovy code

master
melvin 2013-05-31 11:26:35 +08:00
parent 0cbd859a41
commit b7785bee78
6 changed files with 76 additions and 98 deletions

View File

@ -0,0 +1,70 @@
[
new MagicPermanentActivation(
[
MagicCondition.CAN_TAP_CONDITION,
MagicCondition.ONE_CREATURE_CONDITION
],
new MagicActivationHints(MagicTiming.Pump),
"Charge"
) {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return [
new MagicTapEvent(source),
new MagicSacrificePermanentEvent(
source,
MagicTargetChoice.SACRIFICE_CREATURE
)
];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
this,
"Put a charge counter on SN."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
game.doAction(new MagicChangeCountersAction(
event.getPermanent(),
MagicCounterType.Charge,
1,
true
));
}
},
new MagicPermanentActivation(
[
MagicConditionFactory.ManaCost("{1}")
],
new MagicActivationHints(MagicTiming.Pump),
"Draw"
) {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return [
new MagicPayManaCostEvent(source,"{1}"),
new MagicSacrificeEvent(source)
];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) {
return new MagicEvent(
source,
this,
"PN draw a card for each charge counter on SN."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
game.doAction(new MagicDrawAction(
event.getPlayer(),
event.getPermanent().getCounters(MagicCounterType.Charge)
));
}
}
]

View File

@ -6,4 +6,4 @@ rarity=U
type=Artifact
cost={2}
timing=artifact
requires_card_code
requires_groovy_code

View File

@ -28,8 +28,8 @@
final MagicStatic PT = new MagicStatic(MagicLayer.SetPT, MagicStatic.UntilEOT) {
@Override
public void modPowerToughness(
final MagicPermanent source,
final MagicPermanent permanent,
final MagicPermanent S,
final MagicPermanent P,
final MagicPowerToughness pt) {
pt.set(X,X);
}
@ -37,7 +37,7 @@
final MagicStatic ST = new MagicStatic(MagicLayer.Type, MagicStatic.UntilEOT) {
@Override
public void modSubTypeFlags(
final MagicPermanent permanent,
final MagicPermanent P,
final Set<MagicSubType> flags) {
flags.addAll(MagicSubType.ALL_CREATURES);
}

View File

@ -38,7 +38,7 @@
source,
MagicTargetChoice.NEG_TARGET_PLAYER,
this,
"Exile the top card of target player's$ library. " +
"Exile the top card of target player's\$ library. " +
"If it's a land card, PN gains 1 life."
);
}

View File

@ -48,4 +48,4 @@
game.doAction(new MagicDealDamageAction(damage));
}
}
}
]

View File

@ -1,92 +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.MagicDrawAction;
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.MagicSacrificeEvent;
import magic.model.event.MagicSacrificePermanentEvent;
import magic.model.event.MagicTapEvent;
import magic.model.event.MagicTiming;
public class Culling_Dais {
public static final MagicPermanentActivation A1 = new MagicPermanentActivation(
new MagicCondition[]{
MagicCondition.CAN_TAP_CONDITION,
MagicCondition.ONE_CREATURE_CONDITION
},
new MagicActivationHints(MagicTiming.Pump),
"Charge") {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
return new MagicEvent[]{
new MagicTapEvent(source),
new MagicSacrificePermanentEvent(
source,
source.getController(),
MagicTargetChoice.SACRIFICE_CREATURE)};
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
this,
"Put a charge counter on SN.");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
game.doAction(new MagicChangeCountersAction(
event.getPermanent(),
MagicCounterType.Charge,
1,
true));
}
};
public static final MagicPermanentActivation A2 = new MagicPermanentActivation(
new MagicCondition[]{
MagicConditionFactory.ManaCost("{1}")
},
new MagicActivationHints(MagicTiming.Pump),
"Draw") {
@Override
public MagicEvent[] getCostEvent(final MagicPermanent source) {
final MagicPermanent permanent = source;
return new MagicEvent[]{
new MagicPayManaCostEvent(source,"{1}"),
new MagicSacrificeEvent(permanent)};
}
@Override
public MagicEvent getPermanentEvent(
final MagicPermanent source,
final MagicPayedCost payedCost) {
return new MagicEvent(
source,
this,
"PN draw a card for each charge counter on SN.");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event) {
final int amount = event.getPermanent().getCounters(MagicCounterType.Charge);
game.doAction(new MagicDrawAction(
event.getPlayer(),
amount));
}
};
}