From 8a57281ae5d5e6dcfa8d04e911fc15b12775b386 Mon Sep 17 00:00:00 2001 From: melvin Date: Sun, 19 May 2013 16:16:38 +0800 Subject: [PATCH] convert from java code to groovy code --- .../scripts/Black_Sun_s_Zenith.groovy | 29 +++++++++++++ .../Magarena/scripts/Black_Sun_s_Zenith.txt | 2 +- src/magic/card/Black_Sun_s_Zenith.java | 43 ------------------- 3 files changed, 30 insertions(+), 44 deletions(-) create mode 100644 release/Magarena/scripts/Black_Sun_s_Zenith.groovy delete mode 100644 src/magic/card/Black_Sun_s_Zenith.java diff --git a/release/Magarena/scripts/Black_Sun_s_Zenith.groovy b/release/Magarena/scripts/Black_Sun_s_Zenith.groovy new file mode 100644 index 0000000000..d228d425be --- /dev/null +++ b/release/Magarena/scripts/Black_Sun_s_Zenith.groovy @@ -0,0 +1,29 @@ +[ + new MagicSpellCardEvent() { + @Override + public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) { + final int amount=payedCost.getX(); + return new MagicEvent( + cardOnStack, + this, + "Put "+amount+" -1/-1 counters on each creature. " + + "Shuffle SN into its owner's library." + ); + } + @Override + public void executeEvent(final MagicGame game, final MagicEvent event) { + final int amount = event.getCardOnStack().getX(); + final Collection targets = + game.filterPermanents(event.getPlayer(),MagicTargetFilter.TARGET_CREATURE); + for (final MagicPermanent target : targets) { + game.doAction(new MagicChangeCountersAction( + target, + MagicCounterType.MinusOne, + amount, + true + )); + } + game.doAction(new MagicChangeCardDestinationAction(event.getCardOnStack(),MagicLocationType.OwnersLibrary)); + } + } +] diff --git a/release/Magarena/scripts/Black_Sun_s_Zenith.txt b/release/Magarena/scripts/Black_Sun_s_Zenith.txt index 547beee172..2393a84c04 100644 --- a/release/Magarena/scripts/Black_Sun_s_Zenith.txt +++ b/release/Magarena/scripts/Black_Sun_s_Zenith.txt @@ -7,4 +7,4 @@ rarity=R type=Sorcery cost={X}{B}{B} timing=removal -requires_card_code +requires_groovy_code diff --git a/src/magic/card/Black_Sun_s_Zenith.java b/src/magic/card/Black_Sun_s_Zenith.java deleted file mode 100644 index 40fb511851..0000000000 --- a/src/magic/card/Black_Sun_s_Zenith.java +++ /dev/null @@ -1,43 +0,0 @@ -package magic.card; - -import magic.model.MagicCounterType; -import magic.model.MagicGame; -import magic.model.MagicLocationType; -import magic.model.MagicPayedCost; -import magic.model.MagicPermanent; -import magic.model.action.MagicChangeCardDestinationAction; -import magic.model.action.MagicChangeCountersAction; -import magic.model.event.MagicEvent; -import magic.model.event.MagicSpellCardEvent; -import magic.model.stack.MagicCardOnStack; -import magic.model.target.MagicTargetFilter; - -import java.util.Collection; - -public class Black_Sun_s_Zenith { - public static final MagicSpellCardEvent S = new MagicSpellCardEvent() { - @Override - public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) { - final int amount=payedCost.getX(); - return new MagicEvent( - cardOnStack, - this, - "Put "+amount+" -1/-1 counters on each creature. " + - "Shuffle SN into its owner's library."); - } - @Override - public void executeEvent( - final MagicGame game, - final MagicEvent event) { - final int amount = event.getCardOnStack().getX(); - final Collection targets = - game.filterPermanents(event.getPlayer(),MagicTargetFilter.TARGET_CREATURE); - for (final MagicPermanent target : targets) { - game.doAction(new MagicChangeCountersAction( - target, - MagicCounterType.MinusOne,amount,true)); - } - game.doAction(new MagicChangeCardDestinationAction(event.getCardOnStack(),MagicLocationType.OwnersLibrary)); - } - }; -}