From c982822bacbd620ca82498b324df1d011305b5e8 Mon Sep 17 00:00:00 2001 From: melvin Date: Sun, 9 Sep 2012 15:14:36 +0800 Subject: [PATCH] simplify Bloodhusk Ritualist using multikicker in card script --- .../Magarena/scripts/Bloodhusk_Ritualist.txt | 1 + src/magic/card/Bloodhusk_Ritualist.java | 44 ++++++++----------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/release/Magarena/scripts/Bloodhusk_Ritualist.txt b/release/Magarena/scripts/Bloodhusk_Ritualist.txt index 5b8867fc71..e7ae160e7d 100644 --- a/release/Magarena/scripts/Bloodhusk_Ritualist.txt +++ b/release/Magarena/scripts/Bloodhusk_Ritualist.txt @@ -8,4 +8,5 @@ subtype=Vampire,Shaman cost={2}{B} pt=2/2 timing=main +ability=multikicker {B} target opponent discards a card for each time it was kicked requires_card_code diff --git a/src/magic/card/Bloodhusk_Ritualist.java b/src/magic/card/Bloodhusk_Ritualist.java index 3e4ee869e9..ffcfab12b7 100644 --- a/src/magic/card/Bloodhusk_Ritualist.java +++ b/src/magic/card/Bloodhusk_Ritualist.java @@ -1,33 +1,31 @@ package magic.card; -import magic.model.MagicCard; +import magic.model.MagicPermanent; import magic.model.MagicGame; import magic.model.MagicManaCost; import magic.model.MagicPayedCost; import magic.model.MagicPlayer; -import magic.model.action.MagicPlayCardFromStackAction; import magic.model.action.MagicPlayerAction; -import magic.model.choice.MagicKickerChoice; import magic.model.choice.MagicTargetChoice; import magic.model.event.MagicDiscardEvent; import magic.model.event.MagicEvent; -import magic.model.event.MagicSpellCardEvent; -import magic.model.stack.MagicCardOnStack; +import magic.model.trigger.MagicWhenComesIntoPlayTrigger; public class Bloodhusk_Ritualist { - public static final MagicSpellCardEvent S = new MagicSpellCardEvent() { + public static final MagicWhenComesIntoPlayTrigger T = new MagicWhenComesIntoPlayTrigger() { @Override - public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) { - final MagicPlayer player = cardOnStack.getController(); - final MagicCard card = cardOnStack.getCard(); - return new MagicEvent( - card, + public MagicEvent executeTrigger( + final MagicGame game, + final MagicPermanent permanent, + final MagicPlayer player) { + return permanent.isKicked() ? + new MagicEvent( + permanent, player, - new MagicKickerChoice(MagicTargetChoice.TARGET_OPPONENT,MagicManaCost.BLACK,true), - new Object[]{cardOnStack}, + MagicTargetChoice.TARGET_OPPONENT, this, - "Play " + card + ". Target opponent$ discards " + - "a card for each time it was kicked$."); + "Target opponent$ discards " + permanent.getKicker() + " card(s)."): + MagicEvent.NONE; } @Override public void executeEvent( @@ -35,17 +33,11 @@ public class Bloodhusk_Ritualist { 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) { - event.processTargetPlayer(game,choiceResults,0,new MagicPlayerAction() { - public void doAction(final MagicPlayer player) { - game.addEvent(new MagicDiscardEvent(cardOnStack.getCard(),player,kickerCount,false)); - } - }); - } + event.processTargetPlayer(game,choiceResults,0,new MagicPlayerAction() { + public void doAction(final MagicPlayer player) { + game.addEvent(new MagicDiscardEvent(event.getSource(),player,event.getPermanent().getKicker(),false)); + } + }); } }; }