simplify Benalish Lancer using kicker in card script

master
melvin 2012-09-09 14:46:21 +08:00
parent 918fc615ae
commit b147a08228
2 changed files with 11 additions and 36 deletions

View File

@ -8,4 +8,5 @@ subtype=Human,Knight
cost={2}{W} cost={2}{W}
pt=2/2 pt=2/2
timing=main timing=main
ability=kicker {2}{W} it enters the battlefield with two +1/+1 counters on it and with first strike
requires_card_code requires_card_code

View File

@ -9,53 +9,27 @@ import magic.model.MagicPayedCost;
import magic.model.MagicPermanent; import magic.model.MagicPermanent;
import magic.model.MagicPlayer; import magic.model.MagicPlayer;
import magic.model.action.MagicChangeCountersAction; import magic.model.action.MagicChangeCountersAction;
import magic.model.action.MagicPlayCardFromStackAction;
import magic.model.action.MagicSetAbilityAction; import magic.model.action.MagicSetAbilityAction;
import magic.model.choice.MagicKickerChoice; import magic.model.trigger.MagicWhenComesIntoPlayTrigger;
import magic.model.event.MagicEvent; import magic.model.event.MagicEvent;
import magic.model.event.MagicSpellCardEvent;
import magic.model.stack.MagicCardOnStack;
import magic.model.mstatic.MagicStatic; import magic.model.mstatic.MagicStatic;
public class Benalish_Lancer { public class Benalish_Lancer {
public static final MagicSpellCardEvent S = new MagicSpellCardEvent() { public static final MagicWhenComesIntoPlayTrigger T = new MagicWhenComesIntoPlayTrigger() {
@Override @Override
public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) { public MagicEvent executeTrigger(
final MagicPlayer player = cardOnStack.getController(); final MagicGame game,
final MagicCard card = cardOnStack.getCard(); final MagicPermanent permanent,
return new MagicEvent( final MagicPlayer player) {
card, if (permanent.isKicked()) {
player,
new MagicKickerChoice(MagicManaCost.TWO_WHITE,false),
new Object[]{cardOnStack,player},
this,
"$Play " + card + ". If " + card + " was kicked$, " +
"it enters the battlefield with two +1/+1 counters " +
"on it and with first strike.");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object[] data,
final Object[] choiceResults) {
final int kickerCount = (Integer)choiceResults[1];
final MagicCardOnStack cardOnStack = (MagicCardOnStack)data[0];
final MagicPlayCardFromStackAction action = new MagicPlayCardFromStackAction(cardOnStack);
game.doAction(action);
if (kickerCount > 0) {
final MagicPermanent permanent = action.getPermanent();
game.doAction(new MagicChangeCountersAction( game.doAction(new MagicChangeCountersAction(
permanent, permanent,
MagicCounterType.PlusOne, MagicCounterType.PlusOne,
2, 2,
true)); true));
game.doAction(new MagicSetAbilityAction( game.doAction(new MagicSetAbilityAction(permanent,MagicAbility.FirstStrike,MagicStatic.Forever));
permanent,
MagicAbility.FirstStrike,
MagicStatic.Forever
));
} }
return MagicEvent.NONE;
} }
}; };
} }