diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 277721f1631..ca114e05c57 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -35,7 +35,6 @@ import com.esotericsoftware.minlog.Log; import forge.card.CardCharacteristics; import forge.card.CardManaCost; -import forge.card.DeckWants; import forge.card.EditionInfo; import forge.card.abilityfactory.AbilityFactory; import forge.card.cardfactory.CardFactoryUtil; @@ -225,9 +224,6 @@ public class Card extends GameEntity implements Comparable { private Card haunting = null; private Card effectSource = null; - private DeckWants deckWants = null; - private boolean isDeckWantsConstructed = false; - // Soulbond pairing card private Card pairedWith = null; @@ -8977,23 +8973,4 @@ public class Card extends GameEntity implements Comparable { this.startsGameInPlay = startsGameInPlay; } - /** - * @return the deckWants - */ - public DeckWants getDeckWants() { - if (!isDeckWantsConstructed) { - deckWants = new DeckWants(getSVar("DeckWants")); - isDeckWantsConstructed = true; - } - return deckWants; - } - - /** - * @param deckWants the deckWants to set - */ - public void setDeckWants(DeckWants deckWants) { - this.deckWants = deckWants; - } - - } // end Card class diff --git a/src/main/java/forge/card/CardRuleCharacteristics.java b/src/main/java/forge/card/CardRuleCharacteristics.java index 28ba86f010f..f97116ec8f8 100644 --- a/src/main/java/forge/card/CardRuleCharacteristics.java +++ b/src/main/java/forge/card/CardRuleCharacteristics.java @@ -33,6 +33,7 @@ public class CardRuleCharacteristics { private String[] cardRules = null; private Map setsData = new TreeMap(); private String dlUrl; + private DeckWants deckHints; /** * Gets the card name. @@ -175,4 +176,16 @@ public class CardRuleCharacteristics { public void setDlUrl(String dlUrl) { this.dlUrl = dlUrl; } + + /** + * TODO: Write javadoc for this method. + * @param valueAfterKey + */ + public void setDeckHints(String valueAfterKey) { + deckHints = new DeckWants(valueAfterKey); + } + + public DeckWants getDeckHints() { + return deckHints; + } } diff --git a/src/main/java/forge/card/CardRules.java b/src/main/java/forge/card/CardRules.java index b408712363e..fd5c75a3676 100644 --- a/src/main/java/forge/card/CardRules.java +++ b/src/main/java/forge/card/CardRules.java @@ -60,6 +60,7 @@ public final class CardRules { private final boolean hasOtherFace; private List originalScript; + // Ctor and builders are needed here /** @@ -353,6 +354,29 @@ public final class CardRules { } } + /** + * TODO: Write javadoc for this method. + * @return + */ + public Iterable getCardScript() { + return originalScript; + } + + /** + * TODO: Write javadoc for this method. + * @return + */ + public String getPictureUrl() { + return characteristics.getDlUrl(); + } + + /** + * @return the deckWants + */ + public DeckWants getDeckWants() { + return characteristics.getDeckHints(); + } + /** * Filtering conditions specific for CardRules class, defined here along * with some presets. @@ -899,20 +923,6 @@ public final class CardRules { CardRarity.Special); } } - - /** - * TODO: Write javadoc for this method. - * @return - */ - public Iterable getCardScript() { - return originalScript; - } - - /** - * TODO: Write javadoc for this method. - * @return - */ - public String getPictureUrl() { - return characteristics.getDlUrl(); - } } + + diff --git a/src/main/java/forge/card/CardRulesReader.java b/src/main/java/forge/card/CardRulesReader.java index 38d137d2a20..0fb54379c8c 100644 --- a/src/main/java/forge/card/CardRulesReader.java +++ b/src/main/java/forge/card/CardRulesReader.java @@ -40,9 +40,7 @@ public class CardRulesReader { null }; private int curCharacteristics = 0; - // private boolean isFlipCard = false; - // private boolean isDoubleFacedCard = false; - + private boolean removedFromAIDecks = false; private boolean removedFromRandomDecks = false; private List originalScript = new ArrayList(); @@ -152,6 +150,9 @@ public class CardRulesReader { this.removedFromRandomDecks = "True".equalsIgnoreCase(CardRulesReader.getValueAfterKey(line, "SVar:RemRandomDeck:")); } else if (line.startsWith("SVar:Picture:")) { this.characteristics[this.curCharacteristics].setDlUrl(CardRulesReader.getValueAfterKey(line, "SVar:Picture:")); + } else if (line.startsWith("SVar:DeckWants:")) { + this.characteristics[this.curCharacteristics].setDeckHints(CardRulesReader.getValueAfterKey(line, "SVar:DeckWants:")); + } else if (line.startsWith("SetInfo:")) { CardRulesReader.parseSetInfoLine(line, this.characteristics[this.curCharacteristics].getSetsData()); } diff --git a/src/main/java/forge/deck/DeckSection.java b/src/main/java/forge/deck/DeckSection.java index b48d05c6e41..ef239d9051a 100644 --- a/src/main/java/forge/deck/DeckSection.java +++ b/src/main/java/forge/deck/DeckSection.java @@ -17,7 +17,6 @@ */ package forge.deck; -import java.util.List; import java.util.Map.Entry; import forge.Card; @@ -111,7 +110,7 @@ public class DeckSection extends ItemPool { * @param list * CardPrinteds to add */ - public void add(final List list) { + public void add(final Iterable list) { for (CardPrinted cp : list) { this.add(cp); } diff --git a/src/test/java/forge/DeckWantsTest.java b/src/test/java/forge/DeckWantsTest.java index 06aeede3aae..2592cde65de 100644 --- a/src/test/java/forge/DeckWantsTest.java +++ b/src/test/java/forge/DeckWantsTest.java @@ -21,7 +21,7 @@ public class DeckWantsTest { /** * Card test. - */ + *_/ @Test(timeOut = 1000, enabled = true) void test() { List cardLines = FileUtil @@ -48,7 +48,7 @@ public class DeckWantsTest { /** * Filter for cards. - */ + *_/ @Test(timeOut = 1000, enabled = true) void testCards() { List cardLines = FileUtil @@ -78,7 +78,7 @@ public class DeckWantsTest { /** * Filter for keywords. - */ + *_/ @Test(timeOut = 1000, enabled = true) void testKeywords() { List cardLines = FileUtil @@ -104,7 +104,7 @@ public class DeckWantsTest { /** * Filter for color. - */ + *_/ @Test(timeOut = 1000, enabled = true) void testColor() { List cardLines = FileUtil @@ -130,7 +130,7 @@ public class DeckWantsTest { /** * Failing filter for cards. - */ + *_/ @Test(timeOut = 1000, enabled = true) void testFailCards() { List cardLines = FileUtil @@ -156,7 +156,7 @@ public class DeckWantsTest { /** * Card test for junk deck wants. - */ + *_/ @Test(timeOut = 1000, enabled = true) void testJunk() { List cardLines = FileUtil @@ -170,7 +170,7 @@ public class DeckWantsTest { /** * * Test for no wants. - */ + *_/ @Test(timeOut = 1000, enabled = true) void testNoFilter() { List cardLines = FileUtil @@ -186,4 +186,5 @@ public class DeckWantsTest { Assert.assertEquals(1, c.getDeckWants().filter(cl).size()); } + */ }