From 90da0addb63300b485801b3f291752859d93d6a0 Mon Sep 17 00:00:00 2001 From: melvin Date: Tue, 28 May 2013 20:09:55 +0800 Subject: [PATCH] convert from java code to groovy code --- .../Magarena/scripts/Holy_Justiciar.groovy | 44 ++++++++++++ release/Magarena/scripts/Holy_Justiciar.txt | 2 +- src/magic/card/Holy_Justiciar.java | 68 ------------------- 3 files changed, 45 insertions(+), 69 deletions(-) create mode 100644 release/Magarena/scripts/Holy_Justiciar.groovy delete mode 100644 src/magic/card/Holy_Justiciar.java diff --git a/release/Magarena/scripts/Holy_Justiciar.groovy b/release/Magarena/scripts/Holy_Justiciar.groovy new file mode 100644 index 0000000000..0c8f7af5e6 --- /dev/null +++ b/release/Magarena/scripts/Holy_Justiciar.groovy @@ -0,0 +1,44 @@ +[ + new MagicPermanentActivation( + [ + MagicCondition.CAN_TAP_CONDITION, + MagicConditionFactory.ManaCost("{2}{W}") + ], + new MagicActivationHints(MagicTiming.Tapping), + "Tap" + ) { + + @Override + public MagicEvent[] getCostEvent(final MagicPermanent source) { + return [ + new MagicPayManaCostTapEvent(source,"{2}{W}") + ]; + } + + @Override + public MagicEvent getPermanentEvent(final MagicPermanent source, final MagicPayedCost payedCost) { + return new MagicEvent( + source, + MagicTargetChoice.NEG_TARGET_CREATURE, + new MagicTapTargetPicker(true,false), + this, + "Tap target creature\$. If that creature is a Zombie, exile it." + ); + } + + @Override + public void executeEvent(final MagicGame game, final MagicEvent event) { + event.processTargetPermanent(game,new MagicPermanentAction() { + public void doAction(final MagicPermanent creature) { + game.doAction(new MagicTapAction(creature,true)); + if (creature.hasSubType(MagicSubType.Zombie)) { + game.doAction(new MagicRemoveFromPlayAction( + creature, + MagicLocationType.Exile + )); + } + } + }); + } + } +] diff --git a/release/Magarena/scripts/Holy_Justiciar.txt b/release/Magarena/scripts/Holy_Justiciar.txt index e421417b6f..4800625a5a 100644 --- a/release/Magarena/scripts/Holy_Justiciar.txt +++ b/release/Magarena/scripts/Holy_Justiciar.txt @@ -8,4 +8,4 @@ subtype=Human,Cleric cost={3}{W} pt=2/1 timing=main -requires_card_code +requires_groovy_code diff --git a/src/magic/card/Holy_Justiciar.java b/src/magic/card/Holy_Justiciar.java deleted file mode 100644 index af664df380..0000000000 --- a/src/magic/card/Holy_Justiciar.java +++ /dev/null @@ -1,68 +0,0 @@ -package magic.card; - -import magic.model.MagicGame; -import magic.model.MagicLocationType; -import magic.model.MagicManaCost; -import magic.model.MagicPayedCost; -import magic.model.MagicPermanent; -import magic.model.MagicSubType; -import magic.model.action.MagicPermanentAction; -import magic.model.action.MagicRemoveFromPlayAction; -import magic.model.action.MagicTapAction; -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.MagicPayManaCostTapEvent; -import magic.model.event.MagicPermanentActivation; -import magic.model.event.MagicTiming; -import magic.model.target.MagicTapTargetPicker; - -public class Holy_Justiciar { - public static final MagicPermanentActivation A = new MagicPermanentActivation( - new MagicCondition[]{ - MagicCondition.CAN_TAP_CONDITION, - MagicConditionFactory.ManaCost("{2}{W}") - }, - new MagicActivationHints(MagicTiming.Tapping), - "Tap" - ) { - - @Override - public MagicEvent[] getCostEvent(final MagicPermanent source) { - return new MagicEvent[]{ - new MagicPayManaCostTapEvent(source,"{2}{W}") - }; - } - - @Override - public MagicEvent getPermanentEvent( - final MagicPermanent source, - final MagicPayedCost payedCost) { - return new MagicEvent( - source, - MagicTargetChoice.NEG_TARGET_CREATURE, - new MagicTapTargetPicker(true,false), - this, - "Tap target creature$. If that creature is a Zombie, exile it." - ); - } - - @Override - public void executeEvent( - final MagicGame game, - final MagicEvent event) { - event.processTargetPermanent(game,new MagicPermanentAction() { - public void doAction(final MagicPermanent creature) { - game.doAction(new MagicTapAction(creature,true)); - if (creature.hasSubType(MagicSubType.Zombie)) { - game.doAction(new MagicRemoveFromPlayAction( - creature, - MagicLocationType.Exile)); - } - } - }); - } - }; -}