diff --git a/src/forge/AllZone.java b/src/forge/AllZone.java index c0aee6295e6..7cb497bcd8a 100644 --- a/src/forge/AllZone.java +++ b/src/forge/AllZone.java @@ -19,7 +19,8 @@ public class AllZone implements NewConstants { public static EndOfTurn EndOfTurn = new EndOfTurn(); public static EndOfCombat EndOfCombat = new EndOfCombat(); - public static final CardFactory CardFactory = new CardFactory(ForgeProps.getFile(CARDS)); + //public static final CardFactory CardFactory = new CardFactory(ForgeProps.getFile(CARDS)); + public static final CardFactory CardFactory = new CardFactory(ForgeProps.getFile(CARDSFOLDER)); public static final Phase Phase = new Phase(); public static final MagicStack Stack = new MagicStack(); diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index c2a2aedcfb1..eee16d388df 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -86,7 +86,8 @@ public class CardFactory implements NewConstants { private void readCards(File file) { map.clear(); - ReadCard read = new ReadCard(ForgeProps.getFile(CARDS)); + //ReadCard read = new ReadCard(ForgeProps.getFile(CARDS)); + ReadCard read = new ReadCard(ForgeProps.getFile(CARDSFOLDER)); try { read.run(); // javax.swing.SwingUtilities.invokeAndWait(read); @@ -2946,6 +2947,7 @@ public class CardFactory implements NewConstants { card.addSpellAbility(evDestroyTgt); } } // etbDestoryTgt + // Generic destroy all card if(hasKeyword(card, "spDestroyAll") != -1) { diff --git a/src/forge/ReadCard.java b/src/forge/ReadCard.java index c4745c7d5ba..950f70e2cb7 100644 --- a/src/forge/ReadCard.java +++ b/src/forge/ReadCard.java @@ -2,6 +2,7 @@ package forge; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; +import java.io.IOException; import java.util.ArrayList; import java.util.StringTokenizer; @@ -12,6 +13,7 @@ import forge.properties.NewConstants; public class ReadCard implements Runnable, NewConstants { private BufferedReader in; + private String fileList[]; private ArrayList allCards = new ArrayList(); public static void main(String args[]) throws Exception { @@ -50,70 +52,104 @@ public class ReadCard implements Runnable, NewConstants { throw new RuntimeException("ReadCard : constructor error -- file not found -- filename is " + file.getAbsolutePath()); + if (!file.isDirectory()) + throw new RuntimeException("ReadCard : constructor error -- not a direcotry -- " + + file.getAbsolutePath()); + + fileList = file.list(); //makes the checked exception, into an unchecked runtime exception - try { - in = new BufferedReader(new FileReader(file)); - } catch(Exception ex) { - ErrorViewer.showError(ex, "File \"%s\" not found", file.getAbsolutePath()); - throw new RuntimeException("ReadCard : constructor error -- file not found -- filename is " - + file.getPath()); - } + //try { + // in = new BufferedReader(new FileReader(file)); + //} catch(Exception ex) { + // ErrorViewer.showError(ex, "File \"%s\" not found", file.getAbsolutePath()); + // throw new RuntimeException("ReadCard : constructor error -- file not found -- filename is " + // + file.getPath()); + //} }//ReadCard() public void run() { - Card c; - String s = readLine(); - ArrayList cardNames = new ArrayList(); - int linenum = 1; - - while(!s.equals("End")) { + Card c = null; + ArrayList cardNames = new ArrayList(); + File fl = null; + + for (int i=0; i