From d93b1414ac7d74f99fe4ce53229fe5ed213c9d44 Mon Sep 17 00:00:00 2001 From: melvin Date: Mon, 27 May 2013 13:27:50 +0800 Subject: [PATCH] convert from java code to groovy code --- release/Magarena/scripts/Torch_Fiend.groovy | 38 +++++++++++++ release/Magarena/scripts/Torch_Fiend.txt | 2 +- src/magic/card/Torch_Fiend.java | 59 --------------------- 3 files changed, 39 insertions(+), 60 deletions(-) create mode 100644 release/Magarena/scripts/Torch_Fiend.groovy delete mode 100644 src/magic/card/Torch_Fiend.java diff --git a/release/Magarena/scripts/Torch_Fiend.groovy b/release/Magarena/scripts/Torch_Fiend.groovy new file mode 100644 index 0000000000..ba41d15836 --- /dev/null +++ b/release/Magarena/scripts/Torch_Fiend.groovy @@ -0,0 +1,38 @@ +[ + new MagicPermanentActivation( + [ + MagicConditionFactory.ManaCost("{R}") + ], + new MagicActivationHints(MagicTiming.Removal), + "Destroy" + ) { + + @Override + public MagicEvent[] getCostEvent(final MagicPermanent source) { + return [ + new MagicPayManaCostEvent(source,"{R}"), + new MagicSacrificeEvent(source) + ]; + } + + @Override + public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) { + return new MagicEvent( + source, + MagicTargetChoice.TARGET_ARTIFACT, + new MagicDestroyTargetPicker(false), + this, + "Destroy target artifact\$." + ); + } + + @Override + public void executeEvent(final MagicGame game, final MagicEvent event) { + event.processTargetPermanent(game, new MagicPermanentAction() { + public void doAction(final MagicPermanent permanent) { + game.doAction(new MagicDestroyAction(permanent)); + } + }); + } + } +] diff --git a/release/Magarena/scripts/Torch_Fiend.txt b/release/Magarena/scripts/Torch_Fiend.txt index e7af4f95cd..98d3795f36 100644 --- a/release/Magarena/scripts/Torch_Fiend.txt +++ b/release/Magarena/scripts/Torch_Fiend.txt @@ -8,4 +8,4 @@ subtype=Devil cost={1}{R} pt=2/1 timing=smain -requires_card_code +requires_groovy_code diff --git a/src/magic/card/Torch_Fiend.java b/src/magic/card/Torch_Fiend.java deleted file mode 100644 index 045eb3c0cd..0000000000 --- a/src/magic/card/Torch_Fiend.java +++ /dev/null @@ -1,59 +0,0 @@ -package magic.card; - -import magic.model.MagicGame; -import magic.model.MagicManaCost; -import magic.model.MagicPayedCost; -import magic.model.MagicPermanent; -import magic.model.action.MagicDestroyAction; -import magic.model.action.MagicPermanentAction; -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.MagicTiming; -import magic.model.target.MagicDestroyTargetPicker; - -public class Torch_Fiend { - - public static final MagicPermanentActivation A = new MagicPermanentActivation( - new MagicCondition[]{ - MagicConditionFactory.ManaCost("{R}") - }, - new MagicActivationHints(MagicTiming.Removal), - "Destroy") { - - @Override - public MagicEvent[] getCostEvent(final MagicPermanent source) { - return new MagicEvent[]{ - new MagicPayManaCostEvent(source,"{R}"), - new MagicSacrificeEvent(source) - }; - } - - @Override - public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) { - return new MagicEvent( - source, - MagicTargetChoice.TARGET_ARTIFACT, - new MagicDestroyTargetPicker(false), - this, - "Destroy target artifact$." - ); - } - - @Override - public void executeEvent( - final MagicGame game, - final MagicEvent event) { - event.processTargetPermanent(game, new MagicPermanentAction() { - public void doAction(final MagicPermanent permanent) { - game.doAction(new MagicDestroyAction(permanent)); - } - }); - } - }; -}