DeckWants moved from Card to CardCharacteristics, its test unfortunately is no longer functional

This commit is contained in:
Maxmtg
2012-08-01 06:58:01 +00:00
parent 4384fb140c
commit 182d4545dd
6 changed files with 52 additions and 51 deletions

View File

@@ -35,7 +35,6 @@ import com.esotericsoftware.minlog.Log;
import forge.card.CardCharacteristics; import forge.card.CardCharacteristics;
import forge.card.CardManaCost; import forge.card.CardManaCost;
import forge.card.DeckWants;
import forge.card.EditionInfo; import forge.card.EditionInfo;
import forge.card.abilityfactory.AbilityFactory; import forge.card.abilityfactory.AbilityFactory;
import forge.card.cardfactory.CardFactoryUtil; import forge.card.cardfactory.CardFactoryUtil;
@@ -225,9 +224,6 @@ public class Card extends GameEntity implements Comparable<Card> {
private Card haunting = null; private Card haunting = null;
private Card effectSource = null; private Card effectSource = null;
private DeckWants deckWants = null;
private boolean isDeckWantsConstructed = false;
// Soulbond pairing card // Soulbond pairing card
private Card pairedWith = null; private Card pairedWith = null;
@@ -8977,23 +8973,4 @@ public class Card extends GameEntity implements Comparable<Card> {
this.startsGameInPlay = startsGameInPlay; 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 } // end Card class

View File

@@ -33,6 +33,7 @@ public class CardRuleCharacteristics {
private String[] cardRules = null; private String[] cardRules = null;
private Map<String, CardInSet> setsData = new TreeMap<String, CardInSet>(); private Map<String, CardInSet> setsData = new TreeMap<String, CardInSet>();
private String dlUrl; private String dlUrl;
private DeckWants deckHints;
/** /**
* Gets the card name. * Gets the card name.
@@ -175,4 +176,16 @@ public class CardRuleCharacteristics {
public void setDlUrl(String dlUrl) { public void setDlUrl(String dlUrl) {
this.dlUrl = 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;
}
} }

View File

@@ -60,6 +60,7 @@ public final class CardRules {
private final boolean hasOtherFace; private final boolean hasOtherFace;
private List<String> originalScript; private List<String> originalScript;
// Ctor and builders are needed here // Ctor and builders are needed here
/** /**
@@ -353,6 +354,29 @@ public final class CardRules {
} }
} }
/**
* TODO: Write javadoc for this method.
* @return
*/
public Iterable<String> 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 * Filtering conditions specific for CardRules class, defined here along
* with some presets. * with some presets.
@@ -899,20 +923,6 @@ public final class CardRules {
CardRarity.Special); CardRarity.Special);
} }
} }
/**
* TODO: Write javadoc for this method.
* @return
*/
public Iterable<String> getCardScript() {
return originalScript;
}
/**
* TODO: Write javadoc for this method.
* @return
*/
public String getPictureUrl() {
return characteristics.getDlUrl();
}
} }

View File

@@ -40,9 +40,7 @@ public class CardRulesReader {
null }; null };
private int curCharacteristics = 0; private int curCharacteristics = 0;
// private boolean isFlipCard = false;
// private boolean isDoubleFacedCard = false;
private boolean removedFromAIDecks = false; private boolean removedFromAIDecks = false;
private boolean removedFromRandomDecks = false; private boolean removedFromRandomDecks = false;
private List<String> originalScript = new ArrayList<String>(); private List<String> originalScript = new ArrayList<String>();
@@ -152,6 +150,9 @@ public class CardRulesReader {
this.removedFromRandomDecks = "True".equalsIgnoreCase(CardRulesReader.getValueAfterKey(line, "SVar:RemRandomDeck:")); this.removedFromRandomDecks = "True".equalsIgnoreCase(CardRulesReader.getValueAfterKey(line, "SVar:RemRandomDeck:"));
} else if (line.startsWith("SVar:Picture:")) { } else if (line.startsWith("SVar:Picture:")) {
this.characteristics[this.curCharacteristics].setDlUrl(CardRulesReader.getValueAfterKey(line, "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:")) { } else if (line.startsWith("SetInfo:")) {
CardRulesReader.parseSetInfoLine(line, this.characteristics[this.curCharacteristics].getSetsData()); CardRulesReader.parseSetInfoLine(line, this.characteristics[this.curCharacteristics].getSetsData());
} }

View File

@@ -17,7 +17,6 @@
*/ */
package forge.deck; package forge.deck;
import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import forge.Card; import forge.Card;
@@ -111,7 +110,7 @@ public class DeckSection extends ItemPool<CardPrinted> {
* @param list * @param list
* CardPrinteds to add * CardPrinteds to add
*/ */
public void add(final List<CardPrinted> list) { public void add(final Iterable<CardPrinted> list) {
for (CardPrinted cp : list) { for (CardPrinted cp : list) {
this.add(cp); this.add(cp);
} }

View File

@@ -21,7 +21,7 @@ public class DeckWantsTest {
/** /**
* Card test. * Card test.
*/ *_/
@Test(timeOut = 1000, enabled = true) @Test(timeOut = 1000, enabled = true)
void test() { void test() {
List<String> cardLines = FileUtil List<String> cardLines = FileUtil
@@ -48,7 +48,7 @@ public class DeckWantsTest {
/** /**
* Filter for cards. * Filter for cards.
*/ *_/
@Test(timeOut = 1000, enabled = true) @Test(timeOut = 1000, enabled = true)
void testCards() { void testCards() {
List<String> cardLines = FileUtil List<String> cardLines = FileUtil
@@ -78,7 +78,7 @@ public class DeckWantsTest {
/** /**
* Filter for keywords. * Filter for keywords.
*/ *_/
@Test(timeOut = 1000, enabled = true) @Test(timeOut = 1000, enabled = true)
void testKeywords() { void testKeywords() {
List<String> cardLines = FileUtil List<String> cardLines = FileUtil
@@ -104,7 +104,7 @@ public class DeckWantsTest {
/** /**
* Filter for color. * Filter for color.
*/ *_/
@Test(timeOut = 1000, enabled = true) @Test(timeOut = 1000, enabled = true)
void testColor() { void testColor() {
List<String> cardLines = FileUtil List<String> cardLines = FileUtil
@@ -130,7 +130,7 @@ public class DeckWantsTest {
/** /**
* Failing filter for cards. * Failing filter for cards.
*/ *_/
@Test(timeOut = 1000, enabled = true) @Test(timeOut = 1000, enabled = true)
void testFailCards() { void testFailCards() {
List<String> cardLines = FileUtil List<String> cardLines = FileUtil
@@ -156,7 +156,7 @@ public class DeckWantsTest {
/** /**
* Card test for junk deck wants. * Card test for junk deck wants.
*/ *_/
@Test(timeOut = 1000, enabled = true) @Test(timeOut = 1000, enabled = true)
void testJunk() { void testJunk() {
List<String> cardLines = FileUtil List<String> cardLines = FileUtil
@@ -170,7 +170,7 @@ public class DeckWantsTest {
/** /**
* *
* Test for no wants. * Test for no wants.
*/ *_/
@Test(timeOut = 1000, enabled = true) @Test(timeOut = 1000, enabled = true)
void testNoFilter() { void testNoFilter() {
List<String> cardLines = FileUtil List<String> cardLines = FileUtil
@@ -186,4 +186,5 @@ public class DeckWantsTest {
Assert.assertEquals(1, c.getDeckWants().filter(cl).size()); Assert.assertEquals(1, c.getDeckWants().filter(cl).size());
} }
*/
} }