diff --git a/.gitattributes b/.gitattributes index 9c757c2070f..fef51892bdc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -136,6 +136,7 @@ src/forge/Deck.java svneol=native#text/plain src/forge/DeckIO.java svneol=native#text/plain src/forge/DefaultPlayerZone.java svneol=native#text/plain src/forge/Display.java svneol=native#text/plain +src/forge/DownloadDeck.java -text svneol=native#text/plain src/forge/EndOfTurn.java svneol=native#text/plain src/forge/ExternalPanel.java svneol=native#text/plain src/forge/FileUtil.java -text svneol=native#text/plain diff --git a/res/cards.txt b/res/cards.txt index cc049cbe901..8ee328bbadc 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,43 @@ +Jace Beleren +1 U U +Planeswalker - Jace +no text + +Spell Snare +U +Instant +Counter target spell with converted mana cost 2. + +Timber Protector +4 G +Creature Treefolk Warrior +Other Treefolk creatures you control get +1/+1. Other Treefolk and Forests you control are indestructible. +4/6 + +Viridian Zealot +G G +Creature Elf Warrior +no text +2/1 + +Ronom Unicorn +1 W +Creature Unicorn +no text +2/2 + +Kami of Ancient Law +1 W +Creature Spirit +no text +2/2 + +Capashen Unicorn +1 W +Creature Unicorn +no text +1/2 + Qasali Pridemage G W Creature Cat Wizard @@ -2929,7 +2969,7 @@ Cycling:2 Nissa Revane 2 G G -Legendary Planeswalker - Nissa +Planeswalker - Nissa no text Nissa's Chosen @@ -7713,7 +7753,7 @@ Whenever you draw a card, you may put a hoofprint counter on Hoofprints of the S Nicol Bolas, Planeswalker 4 U B B R -Legendary Planeswalker - Bolas +Planeswalker - Bolas no text Aven Squire @@ -8769,7 +8809,7 @@ Exalted Elspeth, Knight-Errant 2 W W -Legendary Planeswalker - Elspeth +Planeswalker - Elspeth no text Ratcatcher @@ -11694,7 +11734,7 @@ Flying Mishra's Factory no cost Land -1: Mishra's Factory becomes a 2/2 Assembly-Worker artifact creature until end of turn. It's still a land. +no text tap: add 1 Cranial Extraction @@ -11765,22 +11805,22 @@ Choose two - Incendiary Command deals 4 damage to target player; or Incendiary C Ajani Goldmane 2 W W -Legendary Planeswalker - Ajani +Planeswalker - Ajani no text Chandra Nalaar 3 R R -Legendary Planeswalker - Chandra +Planeswalker - Chandra no text Garruk Wildspeaker 2 G G -Legendary Planeswalker - Garruk +Planeswalker - Garruk no text Liliana Vess 3 B B -Legendary Planeswalker - Liliana +Planeswalker - Liliana no text Dark Banishing diff --git a/res/main.properties b/res/main.properties index 6f6922c0196..07ecc2d2d88 100644 --- a/res/main.properties +++ b/res/main.properties @@ -1,6 +1,6 @@ program/mail=mtgerror@yahoo.com program/forum=http://www.slightlymagic.net/forum/viewforum.php?f=26 -program/version=MTG Forge -- official beta: 09/11/02, SVN revision: 96 +program/version=MTG Forge -- official beta: 09/11/02, SVN revision: 97 tokens--file=AllTokens.txt diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 6785bd4cda1..baf845ad6da 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -17433,6 +17433,34 @@ return land.size() > 1 && CardFactoryUtil.AI_isMainPhase(); ability.setBeforePayMana(runtime); }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if(cardName.equals("Spell Snare")) + { + SpellAbility spell = new Spell(card) + { + private static final long serialVersionUID = -3254886985412814994L; + public void resolve() + { + SpellAbility sa = AllZone.Stack.pop(); + AllZone.GameAction.moveToGraveyard(sa.getSourceCard()); + } + public boolean canPlay() + { + if(AllZone.Stack.size() == 0) + return false; + + //see if spell is on stack and that opponent played it + String opponent = AllZone.GameAction.getOpponent(card.getController()); + SpellAbility sa = AllZone.Stack.peek(); + + return sa.isSpell() && opponent.equals(sa.getSourceCard().getController()) + && CardFactoryUtil.isCounterable(sa.getSourceCard()) && CardUtil.getConvertedManaCost(sa.getSourceCard().getManaCost()) == 2; + } + }; + card.clearSpellAbility(); + card.addSpellAbility(spell); + }//*************** END ************ END ************************** diff --git a/src/forge/CardFactory_Creatures.java b/src/forge/CardFactory_Creatures.java index 704bcb60cd5..af23e7d23ed 100644 --- a/src/forge/CardFactory_Creatures.java +++ b/src/forge/CardFactory_Creatures.java @@ -16528,13 +16528,27 @@ public class CardFactory_Creatures { final Ability ability = new Ability(card, "1") { public void resolve() { - if (AllZone.GameAction.isCardInPlay(card)) + if (AllZone.GameAction.isCardInPlay(card)) { AllZone.GameAction.sacrifice(card); - Card c = getTargetCard(); - AllZone.GameAction.destroy(c); + Card c = getTargetCard(); + AllZone.GameAction.destroy(c); + } } + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i= 4; + } + }); + + if (list.size() > 0) + { + list.shuffle(); + setTargetCard(list.get(0)); + } + + return list.size() > 0; + } + + + }; + ability.setDescription("1 G, Sacrifice Viridian Zealot: Destroy target artifact or enchantment."); + ability.setBeforePayMana(new Input() + { + private static final long serialVersionUID = -3565024591921095303L; + + public void showMessage() + { + PlayerZone hPlay = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); + PlayerZone cPlay = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + + CardList list = new CardList(); + list.addAll(hPlay.getCards()); + list.addAll(cPlay.getCards()); + + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.isArtifact() || c.isEnchantment(); + } + }); + + stopSetNext(CardFactoryUtil.input_targetSpecific(ability, list, "Select an Artifact or Enchantment", true)); + } + }); + card.addSpellAbility(ability); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if (cardName.equals("Ronom Unicorn") || cardName.equals("Kami of Ancient Law")) + { + final Ability ability = new Ability(card, "0") + { + public void resolve() { + if (AllZone.GameAction.isCardInPlay(card)) { + AllZone.GameAction.sacrifice(card); + + Card c = getTargetCard(); + AllZone.GameAction.destroy(c); + } + } + + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i= 4; + } + }); + + if (list.size() > 0) + { + list.shuffle(); + setTargetCard(list.get(0)); + } + + return list.size() > 0; + } + + + }; + ability.setDescription("Sacrifice " +cardName +": Destroy target enchantment."); + ability.setBeforePayMana(new Input() + { + private static final long serialVersionUID = -2023409303136493987L; + + public void showMessage() + { + PlayerZone hPlay = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); + PlayerZone cPlay = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + + CardList list = new CardList(); + list.addAll(hPlay.getCards()); + list.addAll(cPlay.getCards()); + + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.isEnchantment(); + } + }); + + stopSetNext(CardFactoryUtil.input_targetSpecific(ability, list, "Select target Enchantment", true)); + } + }); + card.addSpellAbility(ability); + }//*************** END ************ END ************************** + + //*************** START *********** START ************************** + else if (cardName.equals("Capashen Unicorn")) + { + final Ability_Tap ability = new Ability_Tap(card, "1 W") + { + + private static final long serialVersionUID = 3723881006291076691L; + + public void resolve() { + if (AllZone.GameAction.isCardInPlay(card)) { + AllZone.GameAction.sacrifice(card); + + Card c = getTargetCard(); + AllZone.GameAction.destroy(c); + } + } + + public boolean canPlay() + { + SpellAbility sa; + for (int i=0; i= 4; + } + }); + + if (list.size() > 0) + { + list.shuffle(); + setTargetCard(list.get(0)); + } + + return list.size() > 0; + } + + + }; + ability.setDescription("1 W, tap, Sacrifice Capashen Unicorn: Destroy target artifact or enchantment."); + ability.setBeforePayMana(new Input() + { + private static final long serialVersionUID = -4032330058005016682L; + + public void showMessage() + { + PlayerZone hPlay = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); + PlayerZone cPlay = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + + CardList list = new CardList(); + list.addAll(hPlay.getCards()); + list.addAll(cPlay.getCards()); + + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) { + return c.isArtifact() || c.isEnchantment(); + } + }); + + stopSetNext(CardFactoryUtil.input_targetSpecific(ability, list, "Select an Artifact or Enchantment", true)); + } + }); + card.addSpellAbility(ability); + }//*************** END ************ END ************************** + // Cards with Cycling abilities // -1 means keyword "Cycling" not found if (shouldCycle(card) != -1) diff --git a/src/forge/CardFactory_Lands.java b/src/forge/CardFactory_Lands.java index d7ff85ef567..8894cfe8be2 100644 --- a/src/forge/CardFactory_Lands.java +++ b/src/forge/CardFactory_Lands.java @@ -557,6 +557,7 @@ class CardFactory_Lands { } };//SpellAbility card.addSpellAbility(a1); + a1.setDescription("1: Mishra's Factory becomes a 2/2 Assembly-Worker artifact creature until end of turn. It's still a land."); a1.setStackDescription(card +" - becomes a 2/2 creature until EOT"); Command paid1 = new Command() { diff --git a/src/forge/CardFactory_Planeswalkers.java b/src/forge/CardFactory_Planeswalkers.java index 5676cef2c02..a5c3b738407 100644 --- a/src/forge/CardFactory_Planeswalkers.java +++ b/src/forge/CardFactory_Planeswalkers.java @@ -1866,6 +1866,143 @@ class CardFactory_Planeswalkers { return card2; }//*************** END ************ END ************************** + //*************** START *********** START ************************** + else if (cardName.equals("Jace Beleren")) + { + + final int turn[] = new int[1]; + turn[0] = -1; + + final Card card2 = new Card() + { + public void addDamage(int n) + { + subtractCounter(Counters.LOYALTY,n); + AllZone.GameAction.checkStateEffects(); + } + }; + card2.addCounter(Counters.LOYALTY,3); + + card2.setOwner(owner); + card2.setController(owner); + + card2.setName(card.getName()); + card2.setType(card.getType()); + card2.setManaCost(card.getManaCost()); + card2.addSpellAbility(new Spell_Permanent(card2)); + + + //ability1 + final SpellAbility ability1 = new Ability(card2, "0") + { + public void resolve() + { + card2.addCounter(Counters.LOYALTY, 2); + + turn[0] = AllZone.Phase.getTurn(); + + AllZone.GameAction.drawCard(Constant.Player.Computer); + AllZone.GameAction.drawCard(Constant.Player.Human); + + }//resolve() + public boolean canPlayAI() + { + return card2.getCounters(Counters.LOYALTY) < 11 && AllZone.Phase.getPhase().equals(Constant.Phase.Main2); + } + public boolean canPlay() + { + return AllZone.getZone(card2).is(Constant.Zone.Play) && + turn[0] != AllZone.Phase.getTurn() && + AllZone.Phase.getActivePlayer().equals(card2.getController()) && + !AllZone.Phase.getPhase().equals("End of Turn") && + (AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2")); + }//canPlay() + }; + + ability1.setDescription("+2: Each player draws a card."); + ability1.setStackDescription(cardName + " - Each player draws a card."); + + //ability2 + final SpellAbility ability2 = new Ability(card2, "0") + { + public void resolve() + { + card2.subtractCounter(Counters.LOYALTY, 1); + + turn[0] = AllZone.Phase.getTurn(); + String player = getTargetPlayer(); + + AllZone.GameAction.drawCard(player); + + }//resolve() + public boolean canPlayAI() + { + return false; + } + public boolean canPlay() + { + return AllZone.getZone(card2).is(Constant.Zone.Play) && + card2.getCounters(Counters.LOYALTY) >= 1 && + turn[0] != AllZone.Phase.getTurn() && + AllZone.Phase.getActivePlayer().equals(card2.getController()) && + !AllZone.Phase.getPhase().equals("End of Turn") && + (AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2")); + }//canPlay() + }; + ability2.setDescription("-1: Target player draws a card."); + ability2.setBeforePayMana(CardFactoryUtil.input_targetPlayer(ability2)); + + //ability3 + final SpellAbility ability3 = new Ability(card2, "0") + { + public void resolve() + { + card2.subtractCounter(Counters.LOYALTY, 10); + + turn[0] = AllZone.Phase.getTurn(); + String player = getTargetPlayer(); + + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player); + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player); + CardList libList = new CardList(lib.getCards()); + + int max = 20; + if (libList.size() < 20) + max = libList.size(); + + for (int i=0;i= 11; + } + public boolean canPlay() + { + return AllZone.getZone(card2).is(Constant.Zone.Play) && + card2.getCounters(Counters.LOYALTY) >= 10 && + turn[0] != AllZone.Phase.getTurn() && + AllZone.Phase.getActivePlayer().equals(card2.getController()) && + !AllZone.Phase.getPhase().equals("End of Turn") && + (AllZone.Phase.getPhase().equals("Main1") || AllZone.Phase.getPhase().equals("Main2")); + }//canPlay() + }; + ability3.setDescription("-10: Target player puts the top twenty cards of his or her library into his or her graveyard."); + ability3.setBeforePayMana(CardFactoryUtil.input_targetPlayer(ability3)); + + card2.addSpellAbility(ability1); + card2.addSpellAbility(ability2); + card2.addSpellAbility(ability3); + + return card2; + }//*************** END ************ END ************************** + return card; } } \ No newline at end of file diff --git a/src/forge/DownloadDeck.java b/src/forge/DownloadDeck.java new file mode 100644 index 00000000000..c74b5846d46 --- /dev/null +++ b/src/forge/DownloadDeck.java @@ -0,0 +1,147 @@ +package forge; + + public class DownloadDeck { + + private Card DownloadCard; + + public String FoundNumberCard(String rStr) + { + int temp; + int i; + + for(i=0; i=48 && temp<=57) + { + break; + + } + + } + if(rStr.codePointAt(i+1)>=48 &&rStr.codePointAt(i+1)<=57) + { + return rStr.substring(i,i+2); + }else + { + return rStr.substring(i,i+1); + } + } + + public String FoundNameCard(String rStr) + { + int temp; + int i; + + for(i=0; i=48 && temp<=57) + { + break; + + } + + } + return rStr.substring(0,i-1); + } + + + + public String RemoveSpace(String rStr) + { + int temp; + int i; + + for(i=0; i-1;i=i-1) + { + temp=rStr.codePointAt(i) ; + if(temp!=32) + { + break; + + } + + } + return rStr.substring(0,i+1); + } + + public String RemoveFoundNumberCard(String rStr, String Number) + { + int a; + int temp; + a=rStr.indexOf(Number); + temp=rStr.codePointAt(a+1) ; + if(temp>=48 && temp<=57) + { + return rStr.substring(a+2); + }else + { + return rStr.substring(a+1); + } + + } + + public String RemoveFoundNameCard(String rStr, String Name) + { + int a; + a=Name.length(); + return rStr.substring(a); + + } + + public boolean IsCardSupport(String CardName) + { + CardList all = AllZone.CardFactory.getAllCards(); + + Card gCard = new Card(); + for(int i=0;i 1) + { + for (Card crd : cl) + { + AllZone.GameAction.moveToGraveyard(crd); + } + } } + } private void destroyLegendaryCreatures() @@ -454,6 +467,8 @@ private Card getCurrentCard(int ID) { for(int i = 0; i < b.size(); i++) AllZone.GameAction.destroy((Card)b.get(i)); + + } } }//destroyLegendaryCreatures() @@ -472,6 +487,21 @@ private Card getCurrentCard(int ID) return a; } + public CardList getPlaneswalkerSubtype(CardList search, Card planeswalker) + { + final String type = planeswalker.getType().toString(); + CardList list = search; + list = list.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.getType().toString().equals(type); + } + }); + + return list; + } + public void sacrificeCreature(String player, SpellAbility sa) { diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index 7ea0fb4c2fe..b96d77287d4 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -8809,6 +8809,115 @@ public class GameActionUtil };//Elvish_Champion_Other + public static Command Timber_Protector_Pump = new Command() + { + + private static final long serialVersionUID = 395882142255572162L; + CardList gloriousAnthemList = new CardList(); + + public void execute() + { + + CardList cList = gloriousAnthemList; + Card c; + + for (int i = 0; i < cList.size(); i++) + { + c = cList.get(i); + if (c.isCreature()) { + c.addSemiPermanentAttackBoost(-1); + c.addSemiPermanentDefenseBoost(-1); + c.removeExtrinsicKeyword("Indestructible"); + } + else //forest + { + c.removeExtrinsicKeyword("Indestructible"); + } + } + cList.clear(); + PlayerZone[] zone = getZone("Timber Protector"); + + // for each zone found add +1/+1 to each card + for (int outer = 0; outer < zone.length; outer++) + { + CardList creature = new CardList(); + creature.addAll(AllZone.Human_Play.getCards()); + creature.addAll(AllZone.Computer_Play.getCards()); + creature = creature.filter(new CardListFilter() + { + public boolean addCard(Card c) + { + return c.getType().equals("Treefolk") || c.getType().equals("Forest") || c.getKeyword().contains("Changeling"); + } + }); + + for (int i = 0; i < creature.size(); i++) + { + c = creature.get(i); + if (c.isCreature() + && !c.getName().equals("Timber Protector")) + { + c.addSemiPermanentAttackBoost(1); + c.addSemiPermanentDefenseBoost(1); + c.addExtrinsicKeyword("Indestructible"); + gloriousAnthemList.add(c); + } + else if (c.getKeyword().contains("Forest")) + { + c.addExtrinsicKeyword("Indestructible"); + } + + } // for + } // for + + }// execute() + + };//Timber_Protector_Pump + + public static Command Timber_Protector_Other = new Command() + { + private static final long serialVersionUID = -3107498901233064819L; + int otherLords=0; + + private int countOtherLords() + { + PlayerZone hPlay = AllZone.getZone(Constant.Zone.Play, Constant.Player.Human); + PlayerZone cPlay = AllZone.getZone(Constant.Zone.Play, Constant.Player.Computer); + CardList lords = new CardList(); + lords.addAll(hPlay.getCards()); + lords.addAll(cPlay.getCards()); + lords = lords.getName("Timber Protector"); + return lords.size()-1; + + } + + public void execute() + { + + + CardList creature = new CardList(); + creature.addAll(AllZone.Human_Play.getCards()); + creature.addAll(AllZone.Computer_Play.getCards()); + + creature = creature.getName("Timber Protector"); + + for (int i = 0; i < creature.size(); i++) + { + Card c = creature.get(i); + otherLords = countOtherLords(); + c.setOtherAttackBoost(otherLords); + c.setOtherDefenseBoost(otherLords); + if (!c.getExtrinsicKeyword().contains("Indestructible") && otherLords > 0) + c.addExtrinsicKeyword("Indestructible"); + //else if (c.getExtrinsicKeyword().contains("Mountainwalk") && otherLords == 0 ) + + + }// for inner + }// execute() + + };//Timber_Protector_Other + + public static Command Goblin_Chieftain_Pump = new Command() { @@ -11582,6 +11691,8 @@ public class GameActionUtil commands.put("Merfolk_Sovereign_Other", Merfolk_Sovereign_Other); commands.put("Lord_of_Atlantis_Pump", Lord_of_Atlantis_Pump); commands.put("Lord_of_Atlantis_Other", Lord_of_Atlantis_Other); + commands.put("Timber_Protector_Pump", Timber_Protector_Pump); + commands.put("Timber_Protector_Other", Timber_Protector_Other); commands.put("Goblin_Chieftain_Pump", Goblin_Chieftain_Pump); commands.put("Goblin_Chieftain_Other", Goblin_Chieftain_Other); commands.put("Goblin_King_Pump", Goblin_King_Pump); diff --git a/src/forge/Gui_DeckEditor_Menu.java b/src/forge/Gui_DeckEditor_Menu.java index 151e36db875..7f5219dafc8 100644 --- a/src/forge/Gui_DeckEditor_Menu.java +++ b/src/forge/Gui_DeckEditor_Menu.java @@ -4,12 +4,18 @@ package forge; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.FileReader; import java.io.FileWriter; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import java.net.Proxy; +import java.net.URL; import java.nio.channels.FileChannel; import java.util.ArrayList; import java.util.Collections; @@ -26,6 +32,7 @@ import javax.swing.filechooser.FileFilter; import forge.error.ErrorViewer; import forge.properties.ForgeProps; import forge.properties.NewConstants; +import forge.properties.NewConstants.LANG.Gui_DownloadPictures.ERRORS; interface DeckDisplay { @@ -66,6 +73,7 @@ public class Gui_DeckEditor_Menu extends JMenuBar implements NewConstants { private DeckDisplay deckDisplay; private Command exitCommand; + public Gui_DeckEditor_Menu(DeckDisplay in_display, Command exit) { deckDisplay = in_display; @@ -308,6 +316,8 @@ public class Gui_DeckEditor_Menu extends JMenuBar implements NewConstants { } }; + + private File getImportFilename() { JFileChooser chooser = new JFileChooser(previousDirectory); @@ -402,6 +412,153 @@ public class Gui_DeckEditor_Menu extends JMenuBar implements NewConstants { }//importDeck() + private void downloadDeck(){ + + Object o = JOptionPane.showInputDialog(null, "URL(only from http://magic.tcgplayer.com):", "Download Deck", JOptionPane.OK_CANCEL_OPTION); + if(o==null ) + { + return; + } + String url = o.toString(); + + if((url.length()<37)||(url.substring(0, 39).equalsIgnoreCase("http://magic.tcgplayer.com/db/deck.asp") ) ) + { + JOptionPane.showMessageDialog(null, "Bad URL." +"\n"+ "Support only deck from http://magic.tcgplayer.com"+ "\n"+ "Example: http://magic.tcgplayer.com/db/deck.asp?deck_id=474146", "Information", JOptionPane.INFORMATION_MESSAGE ); + return; + } + Proxy p = null; + p = Proxy.NO_PROXY; + BufferedInputStream in; + BufferedOutputStream out; + try { + byte[] buf = new byte[1024]; + int len; + File f = new File("deck_temp.html"); + in = new BufferedInputStream(new URL(url).openConnection(p).getInputStream()); + out = new BufferedOutputStream(new FileOutputStream(f)); + //while - read and write file + while((len = in.read(buf)) != -1) { + out.write(buf, 0, len); + + }//while - read and write file + in.close(); + out.flush(); + out.close(); + String fileName = "deck_temp.html"; + FileReader fr = new FileReader(fileName); + BufferedReader br = new BufferedReader(fr); + String s = ""; + String z = ""; + while((z=br.readLine())!=null){s=s+z;} + br.close(); + int start = s.indexOf("MAIN DECK"); + int finish = s.indexOf("SIDEBOARD"); + String rStr = ""; + rStr = s.substring(start+9, finish); + int first; + int second; + while (rStr.indexOf("<")!=-1) + { + first = rStr.indexOf("<"); + second = rStr.indexOf(">", first); + if(first==0){ + rStr =rStr.substring(second+1); + }else + { + rStr = rStr.substring(0, first)+" "+rStr.substring(second+1); + } + } + first = rStr.indexOf("Creatures ["); + second = rStr.indexOf("]", first); + if (first!=-1){ + rStr = rStr.substring(0,first)+rStr.substring(second+1); + } + first = rStr.indexOf("Spells ["); + second = rStr.indexOf("]", first); + if (first!=-1){ + rStr = rStr.substring(0,first)+rStr.substring(second+1); + } + first = rStr.indexOf("Lands ["); + second = rStr.indexOf("]", first); + if (first!=-1){ + rStr = rStr.substring(0,first)+rStr.substring(second+1); + } + String number[] =new String[59]; + String name[]=new String[59]; + int count=0; + DownloadDeck download = new DownloadDeck(); + while(rStr.length()!=0) + { + rStr=download.RemoveSpace(rStr); + number[count]=download.FoundNumberCard(rStr); + rStr=download.RemoveFoundNumberCard(rStr, number[count]); + rStr=download.RemoveSpace(rStr); + name[count]=download.FoundNameCard(rStr); + name[count]=download.RemoveSpaceBack(name[count]); + rStr=download.RemoveFoundNameCard(rStr, name[count]); + rStr=download.RemoveSpace(rStr); + count=count+1; + } + String trueName[]=new String[59]; + String trueNumber[]=new String[59]; + String falseName[]=new String[59]; + int trueCount=0; + int falseCount=0; + for(int i=0;i