mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
allow ALL cards to be (de)serialized
This is needed by network play variants like: - Vanguard - Planechase Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
This commit is contained in:
@@ -29,6 +29,7 @@ public class StaticData {
|
||||
private final String blockDataFolder;
|
||||
private final CardDb commonCards;
|
||||
private final CardDb variantCards;
|
||||
private final CardDb allCards;
|
||||
private final TokenDb allTokens;
|
||||
private final CardEdition.Collection editions;
|
||||
|
||||
@@ -54,6 +55,7 @@ public class StaticData {
|
||||
lastInstance = this;
|
||||
|
||||
{
|
||||
final Map<String, CardRules> allCardsMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
final Map<String, CardRules> regularCards = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
final Map<String, CardRules> variantsCards = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
@@ -61,6 +63,7 @@ public class StaticData {
|
||||
if (null == card) continue;
|
||||
|
||||
final String cardName = card.getName();
|
||||
allCardsMap.put(cardName, card);
|
||||
if (card.isVariant()) {
|
||||
variantsCards.put(cardName, card);
|
||||
} else {
|
||||
@@ -68,10 +71,12 @@ public class StaticData {
|
||||
}
|
||||
}
|
||||
|
||||
allCards = new CardDb(allCardsMap, editions);
|
||||
commonCards = new CardDb(regularCards, editions);
|
||||
variantCards = new CardDb(variantsCards, editions);
|
||||
|
||||
//muse initialize after establish field values for the sake of card image logic
|
||||
//must initialize after establish field values for the sake of card image logic
|
||||
allCards.initialize(false, false);
|
||||
commonCards.initialize(false, false);
|
||||
variantCards.initialize(false, false);
|
||||
}
|
||||
@@ -184,6 +189,8 @@ public class StaticData {
|
||||
return variantCards;
|
||||
}
|
||||
|
||||
public CardDb getAllCards() { return allCards; }
|
||||
|
||||
public TokenDb getAllTokens() { return allTokens; }
|
||||
|
||||
public PaperCard getCardByEditionDate(PaperCard card, Date editionDate) {
|
||||
|
||||
@@ -212,7 +212,7 @@ public final class PaperCard implements Comparable<IPaperCard>, InventoryItemFro
|
||||
// default deserialization
|
||||
ois.defaultReadObject();
|
||||
|
||||
final IPaperCard pc = StaticData.instance().getCommonCards().getCard(name, edition, artIndex);
|
||||
final IPaperCard pc = StaticData.instance().getAllCards().getCard(name, edition, artIndex);
|
||||
if (pc == null) {
|
||||
throw new IOException(TextUtil.concatWithSpace("Card", name, "not found"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user