simplify Bloodhusk Ritualist using multikicker in card script

master
melvin 2012-09-09 15:14:36 +08:00
parent 3bb8b609f2
commit c982822bac
2 changed files with 19 additions and 26 deletions

View File

@ -8,4 +8,5 @@ subtype=Vampire,Shaman
cost={2}{B} cost={2}{B}
pt=2/2 pt=2/2
timing=main timing=main
ability=multikicker {B} target opponent discards a card for each time it was kicked
requires_card_code requires_card_code

View File

@ -1,33 +1,31 @@
package magic.card; package magic.card;
import magic.model.MagicCard; import magic.model.MagicPermanent;
import magic.model.MagicGame; import magic.model.MagicGame;
import magic.model.MagicManaCost; import magic.model.MagicManaCost;
import magic.model.MagicPayedCost; import magic.model.MagicPayedCost;
import magic.model.MagicPlayer; import magic.model.MagicPlayer;
import magic.model.action.MagicPlayCardFromStackAction;
import magic.model.action.MagicPlayerAction; import magic.model.action.MagicPlayerAction;
import magic.model.choice.MagicKickerChoice;
import magic.model.choice.MagicTargetChoice; import magic.model.choice.MagicTargetChoice;
import magic.model.event.MagicDiscardEvent; import magic.model.event.MagicDiscardEvent;
import magic.model.event.MagicEvent; import magic.model.event.MagicEvent;
import magic.model.event.MagicSpellCardEvent; import magic.model.trigger.MagicWhenComesIntoPlayTrigger;
import magic.model.stack.MagicCardOnStack;
public class Bloodhusk_Ritualist { public class Bloodhusk_Ritualist {
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, return permanent.isKicked() ?
new MagicEvent(
permanent,
player, player,
new MagicKickerChoice(MagicTargetChoice.TARGET_OPPONENT,MagicManaCost.BLACK,true), MagicTargetChoice.TARGET_OPPONENT,
new Object[]{cardOnStack},
this, this,
"Play " + card + ". Target opponent$ discards " + "Target opponent$ discards " + permanent.getKicker() + " card(s)."):
"a card for each time it was kicked$."); MagicEvent.NONE;
} }
@Override @Override
public void executeEvent( public void executeEvent(
@ -35,17 +33,11 @@ public class Bloodhusk_Ritualist {
final MagicEvent event, final MagicEvent event,
final Object[] data, final Object[] data,
final Object[] choiceResults) { 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) {
event.processTargetPlayer(game,choiceResults,0,new MagicPlayerAction() { event.processTargetPlayer(game,choiceResults,0,new MagicPlayerAction() {
public void doAction(final MagicPlayer player) { public void doAction(final MagicPlayer player) {
game.addEvent(new MagicDiscardEvent(cardOnStack.getCard(),player,kickerCount,false)); game.addEvent(new MagicDiscardEvent(event.getSource(),player,event.getPermanent().getKicker(),false));
} }
}); });
} }
}
}; };
} }