From 03d9b2f64677ad21b81b9d3ae49be693854a21c3 Mon Sep 17 00:00:00 2001 From: melvin Date: Fri, 31 May 2013 12:03:43 +0800 Subject: [PATCH] convert from java code to groovy code --- .../Magarena/scripts/Rakdos_Guildmage.groovy | 60 +++++++++++++ release/Magarena/scripts/Rakdos_Guildmage.txt | 2 +- src/magic/card/Rakdos_Guildmage.java | 84 ------------------- 3 files changed, 61 insertions(+), 85 deletions(-) create mode 100644 release/Magarena/scripts/Rakdos_Guildmage.groovy delete mode 100644 src/magic/card/Rakdos_Guildmage.java diff --git a/release/Magarena/scripts/Rakdos_Guildmage.groovy b/release/Magarena/scripts/Rakdos_Guildmage.groovy new file mode 100644 index 0000000000..3145312f6d --- /dev/null +++ b/release/Magarena/scripts/Rakdos_Guildmage.groovy @@ -0,0 +1,60 @@ +[ + new MagicPermanentActivation( + [ + MagicCondition.HAS_CARD_CONDITION, + MagicConditionFactory.ManaCost("{3}{B}") + ], + new MagicActivationHints(MagicTiming.Removal,true), + "-2/-2" + ) { + @Override + public MagicEvent[] getCostEvent(final MagicPermanent source) { + return [ + new MagicPayManaCostEvent(source,"{3}{B}"), + new MagicDiscardEvent(source,source.getController(),1,false) + ]; + } + @Override + public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) { + return new MagicEvent( + source, + MagicTargetChoice.NEG_TARGET_CREATURE, + new MagicWeakenTargetPicker(2,2), + this, + "Target creature\$ gets -2/-2 until end of turn." + ); + } + @Override + public void executeEvent(final MagicGame game, final MagicEvent event) { + event.processTargetPermanent(game,new MagicPermanentAction() { + public void doAction(final MagicPermanent creature) { + game.doAction(new MagicChangeTurnPTAction(creature,-2,-2)); + } + }); + } + }, + new MagicPermanentActivation( + [MagicConditionFactory.ManaCost("{3}{R}")], + new MagicActivationHints(MagicTiming.Token,true), + "Token" + ) { + @Override + public MagicEvent[] getCostEvent(final MagicPermanent source) { + return [new MagicPayManaCostEvent(source,"{3}{R}")]; + } + @Override + public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) { + return new MagicEvent( + source, + this, + "PN puts a 2/1 red Goblin creature token with haste onto the battlefield. Exile it at end of turn." + ); + } + @Override + public void executeEvent(final MagicGame game, final MagicEvent event) { + final MagicPlayer player=event.getPlayer(); + final MagicCard card=MagicCard.createTokenCard(TokenCardDefinitions.get("Goblin2"),player); + game.doAction(new MagicPlayCardAction(card,player,MagicPlayCardAction.REMOVE_AT_END_OF_TURN)); + } + } +] diff --git a/release/Magarena/scripts/Rakdos_Guildmage.txt b/release/Magarena/scripts/Rakdos_Guildmage.txt index 2dd63f3271..aa65c5ddac 100644 --- a/release/Magarena/scripts/Rakdos_Guildmage.txt +++ b/release/Magarena/scripts/Rakdos_Guildmage.txt @@ -8,4 +8,4 @@ subtype=Zombie,Shaman cost={B/R}{B/R} pt=2/2 timing=fmain -requires_card_code +requires_groovy_code diff --git a/src/magic/card/Rakdos_Guildmage.java b/src/magic/card/Rakdos_Guildmage.java deleted file mode 100644 index 156cb3ffab..0000000000 --- a/src/magic/card/Rakdos_Guildmage.java +++ /dev/null @@ -1,84 +0,0 @@ -package magic.card; - -import magic.data.TokenCardDefinitions; -import magic.model.MagicCard; -import magic.model.MagicGame; -import magic.model.MagicManaCost; -import magic.model.MagicPayedCost; -import magic.model.MagicPermanent; -import magic.model.MagicPlayer; -import magic.model.action.MagicChangeTurnPTAction; -import magic.model.action.MagicPermanentAction; -import magic.model.action.MagicPlayCardAction; -import magic.model.choice.MagicTargetChoice; -import magic.model.condition.MagicCondition; -import magic.model.condition.MagicConditionFactory; -import magic.model.event.MagicActivationHints; -import magic.model.event.MagicDiscardEvent; -import magic.model.event.MagicEvent; -import magic.model.event.MagicPayManaCostEvent; -import magic.model.event.MagicPermanentActivation; -import magic.model.event.MagicTiming; -import magic.model.target.MagicWeakenTargetPicker; - -public class Rakdos_Guildmage { - public static final MagicPermanentActivation A = new MagicPermanentActivation( - new MagicCondition[]{ - MagicCondition.HAS_CARD_CONDITION, - MagicConditionFactory.ManaCost("{3}{B}") - }, - new MagicActivationHints(MagicTiming.Removal,true), - "-2/-2") { - @Override - public MagicEvent[] getCostEvent(final MagicPermanent source) { - return new MagicEvent[]{ - new MagicPayManaCostEvent(source,"{3}{B}"), - new MagicDiscardEvent(source,source.getController(),1,false) - }; - } - @Override - public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) { - return new MagicEvent( - source, - MagicTargetChoice.NEG_TARGET_CREATURE, - new MagicWeakenTargetPicker(2,2), - this, - "Target creature$ gets -2/-2 until end of turn."); - } - @Override - public void executeEvent( - final MagicGame game, - final MagicEvent event) { - event.processTargetPermanent(game,new MagicPermanentAction() { - public void doAction(final MagicPermanent creature) { - game.doAction(new MagicChangeTurnPTAction(creature,-2,-2)); - } - }); - } - }; - - public static final MagicPermanentActivation A2 = new MagicPermanentActivation( - new MagicCondition[]{MagicConditionFactory.ManaCost("{3}{R}")}, - new MagicActivationHints(MagicTiming.Token,true), - "Token") { - @Override - public MagicEvent[] getCostEvent(final MagicPermanent source) { - return new MagicEvent[]{new MagicPayManaCostEvent(source,"{3}{R}")}; - } - @Override - public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) { - return new MagicEvent( - source, - this, - "PN puts a 2/1 red Goblin creature token with haste onto the battlefield. Exile it at end of turn."); - } - @Override - public void executeEvent( - final MagicGame game, - final MagicEvent event) { - final MagicPlayer player=event.getPlayer(); - final MagicCard card=MagicCard.createTokenCard(TokenCardDefinitions.get("Goblin2"),player); - game.doAction(new MagicPlayCardAction(card,player,MagicPlayCardAction.REMOVE_AT_END_OF_TURN)); - } - }; -}