From 6f1aab1650f66152417315299d9bc7ee6a49347c Mon Sep 17 00:00:00 2001 From: beholder Date: Thu, 10 Nov 2011 17:16:02 +0100 Subject: [PATCH 1/6] removed unused variable. removed unused imports --- src/magic/data/CardDefinitions.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/magic/data/CardDefinitions.java b/src/magic/data/CardDefinitions.java index 675ab52c59..05499d51d6 100644 --- a/src/magic/data/CardDefinitions.java +++ b/src/magic/data/CardDefinitions.java @@ -24,17 +24,14 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; -import java.util.Enumeration; -import java.net.URL; /** * Load card definitions from cards.txt - */public class CardDefinitions { + */ +public class CardDefinitions { private static final CardDefinitions INSTANCE=new CardDefinitions(); - private static final String CARDS_FILENAME="cards.txt"; - public static final String CARD_TEXT_FOLDER = "texts"; public static final String CARD_IMAGE_FOLDER = "cards"; public static final String TOKEN_IMAGE_FOLDER = "tokens"; From 2bb1a502daa76d3f50e003203dfacc01da632342 Mon Sep 17 00:00:00 2001 From: beholder Date: Fri, 11 Nov 2011 09:28:02 +0100 Subject: [PATCH 2/6] added Gemstone Mine --- release/Magarena/scripts/Gemstone_Mine.txt | 11 +++++ src/magic/card/Gemstone_Mine.java | 49 ++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 release/Magarena/scripts/Gemstone_Mine.txt create mode 100644 src/magic/card/Gemstone_Mine.java diff --git a/release/Magarena/scripts/Gemstone_Mine.txt b/release/Magarena/scripts/Gemstone_Mine.txt new file mode 100644 index 0000000000..cce3b755c8 --- /dev/null +++ b/release/Magarena/scripts/Gemstone_Mine.txt @@ -0,0 +1,11 @@ +>Gemstone Mine +url=http://magiccards.info/tsts/en/119.html +image=http://magiccards.info/scans/en/tsts/119.jpg +value=3 +rarity=U +type=Land +mana=b3g3r3u3w3 +basic=bgruw +timing=land + +requires_card_code diff --git a/src/magic/card/Gemstone_Mine.java b/src/magic/card/Gemstone_Mine.java new file mode 100644 index 0000000000..829361b3b7 --- /dev/null +++ b/src/magic/card/Gemstone_Mine.java @@ -0,0 +1,49 @@ +package magic.card; + +import magic.model.MagicCounterType; +import magic.model.MagicManaType; +import magic.model.MagicPermanent; +import magic.model.MagicSource; +import magic.model.condition.MagicCondition; +import magic.model.event.MagicEvent; +import magic.model.event.MagicManaActivation; +import magic.model.event.MagicRemoveCounterEvent; +import magic.model.event.MagicSacrificeEvent; +import magic.model.event.MagicTapEvent; +import magic.model.trigger.MagicComesIntoPlayWithCounterTrigger; + +public class Gemstone_Mine { + private static final MagicCondition CONDITIONS[] = new MagicCondition[]{ + MagicCondition.CAN_TAP_CONDITION, + MagicCondition.CHARGE_COUNTER_CONDITION}; + + public static final MagicComesIntoPlayWithCounterTrigger T = + new MagicComesIntoPlayWithCounterTrigger(MagicCounterType.Charge,"mining",3); + + public static final MagicManaActivation MANA = new MagicManaActivation( + MagicManaType.ALL_TYPES, + CONDITIONS, + 2) { + @Override + public MagicEvent[] getCostEvent(final MagicSource source) { + final MagicPermanent permanent = (MagicPermanent)source; + if (permanent.getCounters(MagicCounterType.Charge) == 1) { + return new MagicEvent[]{ + new MagicTapEvent(permanent), + new MagicRemoveCounterEvent( + permanent, + MagicCounterType.Charge, + 1), + new MagicSacrificeEvent(permanent) + }; + } + return new MagicEvent[]{ + new MagicTapEvent(permanent), + new MagicRemoveCounterEvent( + permanent, + MagicCounterType.Charge, + 1) + }; + } + }; +} From a9d70d70862d000651fc8f8cd7c8bae7646f4133 Mon Sep 17 00:00:00 2001 From: beholder Date: Fri, 11 Nov 2011 11:30:17 +0100 Subject: [PATCH 3/6] added Echoing Calm and Echoing Courage --- release/Magarena/scripts/Echoing_Calm.txt | 13 +++++ release/Magarena/scripts/Echoing_Courage.txt | 12 +++++ src/magic/card/Echoing_Calm.java | 57 ++++++++++++++++++++ src/magic/card/Echoing_Courage.java | 57 ++++++++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 release/Magarena/scripts/Echoing_Calm.txt create mode 100644 release/Magarena/scripts/Echoing_Courage.txt create mode 100644 src/magic/card/Echoing_Calm.java create mode 100644 src/magic/card/Echoing_Courage.java diff --git a/release/Magarena/scripts/Echoing_Calm.txt b/release/Magarena/scripts/Echoing_Calm.txt new file mode 100644 index 0000000000..833699dd6c --- /dev/null +++ b/release/Magarena/scripts/Echoing_Calm.txt @@ -0,0 +1,13 @@ +>Echoing Calm +url=http://magiccards.info/ds/en/2.html +image=http://magiccards.info/scans/en/ds/2.jpg +value=3 +removal=3 +rarity=C +type=Instant +color=w +converted=2 +cost={1}{W} +timing=removal + +requires_card_code diff --git a/release/Magarena/scripts/Echoing_Courage.txt b/release/Magarena/scripts/Echoing_Courage.txt new file mode 100644 index 0000000000..4369d05adf --- /dev/null +++ b/release/Magarena/scripts/Echoing_Courage.txt @@ -0,0 +1,12 @@ +>Echoing Courage +url=http://magiccards.info/ds/en/74.html +image=http://magiccards.info/scans/en/ds/74.jpg +value=3 +rarity=C +type=Instant +color=g +converted=2 +cost={1}{G} +timing=pump + +requires_card_code diff --git a/src/magic/card/Echoing_Calm.java b/src/magic/card/Echoing_Calm.java new file mode 100644 index 0000000000..211fe0c41f --- /dev/null +++ b/src/magic/card/Echoing_Calm.java @@ -0,0 +1,57 @@ +package magic.card; + +import magic.model.MagicGame; +import magic.model.MagicPayedCost; +import magic.model.MagicPermanent; +import magic.model.action.MagicDestroyAction; +import magic.model.action.MagicMoveCardAction; +import magic.model.action.MagicPermanentAction; +import magic.model.choice.MagicTargetChoice; +import magic.model.event.MagicEvent; +import magic.model.event.MagicSpellCardEvent; +import magic.model.stack.MagicCardOnStack; +import magic.model.target.MagicDestroyTargetPicker; +import magic.model.target.MagicTarget; +import magic.model.target.MagicTargetFilter; + +import java.util.Collection; + +public class Echoing_Calm { + public static final MagicSpellCardEvent S = new MagicSpellCardEvent() { + @Override + public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) { + return new MagicEvent( + cardOnStack.getCard(), + cardOnStack.getController(), + MagicTargetChoice.NEG_TARGET_ENCHANTMENT, + new MagicDestroyTargetPicker(false), + new Object[]{cardOnStack}, + this, + "Destroy target enchantment$ and all other enchantments " + + "with the same name as that enchantment."); + } + @Override + public void executeEvent( + final MagicGame game, + final MagicEvent event, + final Object[] data, + final Object[] choiceResults) { + final MagicCardOnStack cardOnStack = (MagicCardOnStack)data[0]; + game.doAction(new MagicMoveCardAction(cardOnStack)); + event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() { + public void doAction(final MagicPermanent targetPermanent) { + final MagicTargetFilter targetFilter = + new MagicTargetFilter.NameTargetFilter(targetPermanent.getName()); + final Collection targets = + game.filterTargets(cardOnStack.getController(),targetFilter); + for (final MagicTarget target : targets) { + final MagicPermanent permanent = (MagicPermanent)target; + if (permanent.isEnchantment()) { + game.doAction(new MagicDestroyAction(permanent)); + } + } + } + }); + } + }; +} diff --git a/src/magic/card/Echoing_Courage.java b/src/magic/card/Echoing_Courage.java new file mode 100644 index 0000000000..24560d7799 --- /dev/null +++ b/src/magic/card/Echoing_Courage.java @@ -0,0 +1,57 @@ +package magic.card; + +import magic.model.MagicGame; +import magic.model.MagicPayedCost; +import magic.model.MagicPermanent; +import magic.model.action.MagicChangeTurnPTAction; +import magic.model.action.MagicMoveCardAction; +import magic.model.action.MagicPermanentAction; +import magic.model.choice.MagicTargetChoice; +import magic.model.event.MagicEvent; +import magic.model.event.MagicSpellCardEvent; +import magic.model.stack.MagicCardOnStack; +import magic.model.target.MagicPumpTargetPicker; +import magic.model.target.MagicTarget; +import magic.model.target.MagicTargetFilter; + +import java.util.Collection; + +public class Echoing_Courage { + public static final MagicSpellCardEvent S = new MagicSpellCardEvent() { + @Override + public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) { + return new MagicEvent( + cardOnStack.getCard(), + cardOnStack.getController(), + MagicTargetChoice.POS_TARGET_CREATURE, + MagicPumpTargetPicker.getInstance(), + new Object[]{cardOnStack}, + this, + "Target creature$ and all other creatures with the same " + + "name as that creature get +2/+2 until end of turn."); + } + @Override + public void executeEvent( + final MagicGame game, + final MagicEvent event, + final Object[] data, + final Object[] choiceResults) { + final MagicCardOnStack cardOnStack = (MagicCardOnStack)data[0]; + game.doAction(new MagicMoveCardAction(cardOnStack)); + event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() { + public void doAction(final MagicPermanent targetPermanent) { + final MagicTargetFilter targetFilter = + new MagicTargetFilter.NameTargetFilter(targetPermanent.getName()); + final Collection targets = + game.filterTargets(cardOnStack.getController(),targetFilter); + for (final MagicTarget target : targets) { + final MagicPermanent permanent = (MagicPermanent)target; + if (permanent.isCreature(game)) { + game.doAction(new MagicChangeTurnPTAction(permanent,2,2)); + } + } + } + }); + } + }; +} From f1cce710423ad018d5ac5e8649b0769122ab521f Mon Sep 17 00:00:00 2001 From: beholder Date: Fri, 11 Nov 2011 11:38:56 +0100 Subject: [PATCH 4/6] added Echoing Decay and Echoing Truth --- release/Magarena/scripts/Echoing_Decay.txt | 13 +++++ release/Magarena/scripts/Echoing_Truth.txt | 13 +++++ src/magic/card/Echoing_Decay.java | 57 ++++++++++++++++++++++ src/magic/card/Echoing_Truth.java | 57 ++++++++++++++++++++++ 4 files changed, 140 insertions(+) create mode 100644 release/Magarena/scripts/Echoing_Decay.txt create mode 100644 release/Magarena/scripts/Echoing_Truth.txt create mode 100644 src/magic/card/Echoing_Decay.java create mode 100644 src/magic/card/Echoing_Truth.java diff --git a/release/Magarena/scripts/Echoing_Decay.txt b/release/Magarena/scripts/Echoing_Decay.txt new file mode 100644 index 0000000000..3617e9c347 --- /dev/null +++ b/release/Magarena/scripts/Echoing_Decay.txt @@ -0,0 +1,13 @@ +>Echoing Decay +url=http://magiccards.info/ds/en/41.html +image=http://magiccards.info/scans/en/ds/41.jpg +value=3 +removal=3 +rarity=C +type=Instant +color=b +converted=2 +cost={1}{B} +timing=removal + +requires_card_code diff --git a/release/Magarena/scripts/Echoing_Truth.txt b/release/Magarena/scripts/Echoing_Truth.txt new file mode 100644 index 0000000000..a03f54d1cd --- /dev/null +++ b/release/Magarena/scripts/Echoing_Truth.txt @@ -0,0 +1,13 @@ +>Echoing Truth +url=http://magiccards.info/ds/en/21.html +image=http://magiccards.info/scans/en/ds/21.jpg +value=3 +removal=3 +rarity=C +type=Instant +color=u +converted=2 +cost={1}{U} +timing=removal + +requires_card_code diff --git a/src/magic/card/Echoing_Decay.java b/src/magic/card/Echoing_Decay.java new file mode 100644 index 0000000000..dc95a159e2 --- /dev/null +++ b/src/magic/card/Echoing_Decay.java @@ -0,0 +1,57 @@ +package magic.card; + +import magic.model.MagicGame; +import magic.model.MagicPayedCost; +import magic.model.MagicPermanent; +import magic.model.action.MagicChangeTurnPTAction; +import magic.model.action.MagicMoveCardAction; +import magic.model.action.MagicPermanentAction; +import magic.model.choice.MagicTargetChoice; +import magic.model.event.MagicEvent; +import magic.model.event.MagicSpellCardEvent; +import magic.model.stack.MagicCardOnStack; +import magic.model.target.MagicTarget; +import magic.model.target.MagicTargetFilter; +import magic.model.target.MagicWeakenTargetPicker; + +import java.util.Collection; + +public class Echoing_Decay { + public static final MagicSpellCardEvent S = new MagicSpellCardEvent() { + @Override + public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) { + return new MagicEvent( + cardOnStack.getCard(), + cardOnStack.getController(), + MagicTargetChoice.NEG_TARGET_CREATURE, + new MagicWeakenTargetPicker(2,2), + new Object[]{cardOnStack}, + this, + "Target creature$ and all other creatures with the same " + + "name as that creature get -2/-2 until end of turn."); + } + @Override + public void executeEvent( + final MagicGame game, + final MagicEvent event, + final Object[] data, + final Object[] choiceResults) { + final MagicCardOnStack cardOnStack = (MagicCardOnStack)data[0]; + game.doAction(new MagicMoveCardAction(cardOnStack)); + event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() { + public void doAction(final MagicPermanent targetPermanent) { + final MagicTargetFilter targetFilter = + new MagicTargetFilter.NameTargetFilter(targetPermanent.getName()); + final Collection targets = + game.filterTargets(cardOnStack.getController(),targetFilter); + for (final MagicTarget target : targets) { + final MagicPermanent permanent = (MagicPermanent)target; + if (permanent.isCreature(game)) { + game.doAction(new MagicChangeTurnPTAction(permanent,-2,-2)); + } + } + } + }); + } + }; +} diff --git a/src/magic/card/Echoing_Truth.java b/src/magic/card/Echoing_Truth.java new file mode 100644 index 0000000000..28737becf8 --- /dev/null +++ b/src/magic/card/Echoing_Truth.java @@ -0,0 +1,57 @@ +package magic.card; + +import magic.model.MagicGame; +import magic.model.MagicLocationType; +import magic.model.MagicPayedCost; +import magic.model.MagicPermanent; +import magic.model.action.MagicMoveCardAction; +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.MagicBounceTargetPicker; +import magic.model.target.MagicTarget; +import magic.model.target.MagicTargetFilter; +import java.util.Collection; + +public class Echoing_Truth { + public static final MagicSpellCardEvent S = new MagicSpellCardEvent() { + @Override + public MagicEvent getEvent(final MagicCardOnStack cardOnStack,final MagicPayedCost payedCost) { + return new MagicEvent( + cardOnStack.getCard(), + cardOnStack.getController(), + MagicTargetChoice.NEG_TARGET_NONLAND_PERMANENT, + MagicBounceTargetPicker.getInstance(), + new Object[]{cardOnStack}, + this, + "Return target nonland permanent$ and all other " + + "permanents with the same name as that permanent " + + "to their owners' hands."); + } + @Override + public void executeEvent( + final MagicGame game, + final MagicEvent event, + final Object[] data, + final Object[] choiceResults) { + final MagicCardOnStack cardOnStack = (MagicCardOnStack)data[0]; + game.doAction(new MagicMoveCardAction(cardOnStack)); + event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() { + public void doAction(final MagicPermanent targetPermanent) { + final MagicTargetFilter targetFilter = + new MagicTargetFilter.NameTargetFilter(targetPermanent.getName()); + final Collection targets = + game.filterTargets(cardOnStack.getController(),targetFilter); + for (final MagicTarget target : targets) { + game.doAction(new MagicRemoveFromPlayAction( + (MagicPermanent)target, + MagicLocationType.OwnersHand)); + } + } + }); + } + }; +} From e10350b1aa77e51386c1ece2197905ad71e9bc55 Mon Sep 17 00:00:00 2001 From: beholder Date: Fri, 11 Nov 2011 11:56:40 +0100 Subject: [PATCH 5/6] do not print a warning when the folder excists --- src/magic/MagicMain.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/magic/MagicMain.java b/src/magic/MagicMain.java index 1f559d43d2..d64af78ca1 100644 --- a/src/magic/MagicMain.java +++ b/src/magic/MagicMain.java @@ -88,14 +88,20 @@ public class MagicMain { } private static void initialize() { - final boolean madeGamePath = new File(getGamePath()).mkdir(); - if (!madeGamePath) { - System.err.println("Unable to create directory " + getGamePath()); + final File gamePathFile = new File(getGamePath()); + if (!gamePathFile.exists()) { + final boolean isCreated = gamePathFile.mkdir(); + if (!isCreated) { + System.err.println("Unable to create directory " + getGamePath()); + } } - final boolean madeModsPath = new File(getModsPath()).mkdir(); - if (!madeModsPath) { - System.err.println("Unable to create directory " + getModsPath()); + final File modsPathFile = new File(getModsPath()); + if (!modsPathFile.exists()) { + final boolean isCreated = modsPathFile.mkdir(); + if (!isCreated) { + System.err.println("Unable to create directory " + getModsPath()); + } } DeckUtils.createDeckFolder(); From d185d509b003f8365c3e407608721d7d81d682d9 Mon Sep 17 00:00:00 2001 From: beholder Date: Fri, 11 Nov 2011 11:57:45 +0100 Subject: [PATCH 6/6] removed unused imports --- src/magic/MagicMain.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/magic/MagicMain.java b/src/magic/MagicMain.java index d64af78ca1..ea956ce0e1 100644 --- a/src/magic/MagicMain.java +++ b/src/magic/MagicMain.java @@ -6,11 +6,6 @@ import magic.data.DeckGenerators; import magic.data.DeckUtils; import magic.data.KeywordDefinitions; import magic.ui.MagicFrame; -import magic.ui.widget.BlankPainter; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Insets; import java.io.File; import javax.swing.SwingUtilities; import javax.swing.UIManager;