From e2f6b58bd03032685351a86db81d04428f3214dc Mon Sep 17 00:00:00 2001 From: melvin Date: Sun, 19 May 2013 13:55:48 +0800 Subject: [PATCH] convert from java code to groovy code --- .../scripts/Swords_to_Plowshares.groovy | 26 ++++++++++++ .../Magarena/scripts/Swords_to_Plowshares.txt | 2 +- src/magic/card/Swords_to_Plowshares.java | 41 ------------------- 3 files changed, 27 insertions(+), 42 deletions(-) create mode 100644 release/Magarena/scripts/Swords_to_Plowshares.groovy delete mode 100644 src/magic/card/Swords_to_Plowshares.java diff --git a/release/Magarena/scripts/Swords_to_Plowshares.groovy b/release/Magarena/scripts/Swords_to_Plowshares.groovy new file mode 100644 index 0000000000..904ceab873 --- /dev/null +++ b/release/Magarena/scripts/Swords_to_Plowshares.groovy @@ -0,0 +1,26 @@ +[ + new MagicSpellCardEvent() { + @Override + public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) { + return new MagicEvent( + cardOnStack, + MagicTargetChoice.NEG_TARGET_CREATURE, + MagicExileTargetPicker.create(), + this, + "Exile target creature\$. Its controller gains life equal to its power." + ); + } + @Override + public void executeEvent(final MagicGame game, final MagicEvent event) { + event.processTargetPermanent(game,new MagicPermanentAction() { + public void doAction(final MagicPermanent creature) { + game.doAction(new MagicRemoveFromPlayAction(creature,MagicLocationType.Exile)); + game.doAction(new MagicChangeLifeAction( + creature.getController(), + creature.getPower() + )); + } + }); + } + } +] diff --git a/release/Magarena/scripts/Swords_to_Plowshares.txt b/release/Magarena/scripts/Swords_to_Plowshares.txt index 74934002b5..38a27a1685 100644 --- a/release/Magarena/scripts/Swords_to_Plowshares.txt +++ b/release/Magarena/scripts/Swords_to_Plowshares.txt @@ -7,4 +7,4 @@ rarity=U type=Instant cost={W} timing=removal -requires_card_code +requires_groovy_code diff --git a/src/magic/card/Swords_to_Plowshares.java b/src/magic/card/Swords_to_Plowshares.java deleted file mode 100644 index 4b4bbbfc9f..0000000000 --- a/src/magic/card/Swords_to_Plowshares.java +++ /dev/null @@ -1,41 +0,0 @@ -package magic.card; - -import magic.model.MagicGame; -import magic.model.MagicLocationType; -import magic.model.MagicPayedCost; -import magic.model.MagicPermanent; -import magic.model.action.MagicChangeLifeAction; -import magic.model.action.MagicPermanentAction; -import magic.model.action.MagicRemoveFromPlayAction; -import magic.model.choice.MagicTargetChoice; -import magic.model.event.MagicEvent; -import magic.model.event.MagicSpellCardEvent; -import magic.model.stack.MagicCardOnStack; -import magic.model.target.MagicExileTargetPicker; - -public class Swords_to_Plowshares { - public static final MagicSpellCardEvent E = new MagicSpellCardEvent() { - @Override - public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) { - return new MagicEvent( - cardOnStack, - MagicTargetChoice.NEG_TARGET_CREATURE, - MagicExileTargetPicker.create(), - this, - "Exile target creature$. Its controller gains life equal to its power."); - } - @Override - public void executeEvent( - final MagicGame game, - final MagicEvent event) { - event.processTargetPermanent(game,new MagicPermanentAction() { - public void doAction(final MagicPermanent creature) { - game.doAction(new MagicChangeLifeAction( - creature.getController(), - creature.getPower())); - game.doAction(new MagicRemoveFromPlayAction(creature,MagicLocationType.Exile)); - } - }); - } - }; -}