mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
Editions, Boosters, Blocks - all moved to their own collections in FModel, using base classes from util
This commit is contained in:
5
.gitattributes
vendored
5
.gitattributes
vendored
@@ -11046,6 +11046,7 @@ src/main/java/forge/UndoCommand.java svneol=native#text/plain
|
|||||||
src/main/java/forge/Untap.java -text
|
src/main/java/forge/Untap.java -text
|
||||||
src/main/java/forge/Upkeep.java svneol=native#text/plain
|
src/main/java/forge/Upkeep.java svneol=native#text/plain
|
||||||
src/main/java/forge/ZCTrigger.java svneol=native#text/plain
|
src/main/java/forge/ZCTrigger.java svneol=native#text/plain
|
||||||
|
src/main/java/forge/card/BoosterData.java -text
|
||||||
src/main/java/forge/card/BoosterGenerator.java svneol=native#text/plain
|
src/main/java/forge/card/BoosterGenerator.java svneol=native#text/plain
|
||||||
src/main/java/forge/card/CardBlock.java -text
|
src/main/java/forge/card/CardBlock.java -text
|
||||||
src/main/java/forge/card/CardCharacteristics.java -text
|
src/main/java/forge/card/CardCharacteristics.java -text
|
||||||
@@ -11061,9 +11062,9 @@ src/main/java/forge/card/CardRules.java -text
|
|||||||
src/main/java/forge/card/CardRulesReader.java svneol=native#text/plain
|
src/main/java/forge/card/CardRulesReader.java svneol=native#text/plain
|
||||||
src/main/java/forge/card/CardSuperType.java -text
|
src/main/java/forge/card/CardSuperType.java -text
|
||||||
src/main/java/forge/card/CardType.java -text
|
src/main/java/forge/card/CardType.java -text
|
||||||
|
src/main/java/forge/card/EditionCollection.java svneol=native#text/plain
|
||||||
src/main/java/forge/card/EditionInfo.java svneol=native#text/plain
|
src/main/java/forge/card/EditionInfo.java svneol=native#text/plain
|
||||||
src/main/java/forge/card/EditionUtils.java svneol=native#text/plain
|
src/main/java/forge/card/FormatCollection.java -text
|
||||||
src/main/java/forge/card/FormatUtils.java -text
|
|
||||||
src/main/java/forge/card/MtgDataParser.java -text
|
src/main/java/forge/card/MtgDataParser.java -text
|
||||||
src/main/java/forge/card/TriggerReplacementBase.java -text
|
src/main/java/forge/card/TriggerReplacementBase.java -text
|
||||||
src/main/java/forge/card/abilityfactory/AbilityFactory.java svneol=native#text/plain
|
src/main/java/forge/card/abilityfactory/AbilityFactory.java svneol=native#text/plain
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class GuiDownloadSetPicturesLQ extends GuiDownloader {
|
|||||||
final String urlBase = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/fpics/";
|
final String urlBase = ForgeProps.getProperty(NewConstants.CARDFORGE_URL) + "/fpics/";
|
||||||
|
|
||||||
final String setCode3 = c.getEdition();
|
final String setCode3 = c.getEdition();
|
||||||
final CardEdition thisSet = Singletons.getModel().getEditions().getEditionByCode(setCode3);
|
final CardEdition thisSet = Singletons.getModel().getEditions().get(setCode3);
|
||||||
final String setCode2 = thisSet.getCode2();
|
final String setCode2 = thisSet.getCode2();
|
||||||
|
|
||||||
final String imgFN = CardUtil.buildFilename(c, cardName);
|
final String imgFN = CardUtil.buildFilename(c, cardName);
|
||||||
|
|||||||
183
src/main/java/forge/card/BoosterData.java
Normal file
183
src/main/java/forge/card/BoosterData.java
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
package forge.card;
|
||||||
|
|
||||||
|
import forge.item.CardPrinted;
|
||||||
|
import forge.util.FileSection;
|
||||||
|
import forge.util.StorageReaderFile;
|
||||||
|
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||||
|
import net.slightlymagic.maxmtg.Predicate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class BoosterData.
|
||||||
|
*/
|
||||||
|
public class BoosterData {
|
||||||
|
private final String edition;
|
||||||
|
public final String getEdition() {
|
||||||
|
return edition;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final int nCommon;
|
||||||
|
private final int nUncommon;
|
||||||
|
private final int nRare;
|
||||||
|
private final int nSpecial;
|
||||||
|
private final int nDoubleFaced;
|
||||||
|
private final int nLand;
|
||||||
|
private final int foilRate;
|
||||||
|
private static final int CARDS_PER_BOOSTER = 15;
|
||||||
|
|
||||||
|
// private final String landCode;
|
||||||
|
/**
|
||||||
|
* Instantiates a new booster data.
|
||||||
|
*
|
||||||
|
* @param nC
|
||||||
|
* the n c
|
||||||
|
* @param nU
|
||||||
|
* the n u
|
||||||
|
* @param nR
|
||||||
|
* the n r
|
||||||
|
* @param nS
|
||||||
|
* the n s
|
||||||
|
* @param nDF
|
||||||
|
* the n df
|
||||||
|
*/
|
||||||
|
public BoosterData(final String edition, final int nC, final int nU, final int nR, final int nS, final int nDF) {
|
||||||
|
// if this booster has more that 10 cards, there must be a land in
|
||||||
|
// 15th slot unless it's already taken
|
||||||
|
this(edition, nC, nU, nR, nS, nDF, (nC + nR + nU + nS + nDF) > 10 ? BoosterData.CARDS_PER_BOOSTER - nC - nR - nU
|
||||||
|
- nS - nDF : 0, 68);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new booster data.
|
||||||
|
*
|
||||||
|
* @param nC
|
||||||
|
* the n c
|
||||||
|
* @param nU
|
||||||
|
* the n u
|
||||||
|
* @param nR
|
||||||
|
* the n r
|
||||||
|
* @param nS
|
||||||
|
* the n s
|
||||||
|
* @param nDF
|
||||||
|
* the n df
|
||||||
|
* @param nL
|
||||||
|
* the n l
|
||||||
|
* @param oneFoilPer
|
||||||
|
* the one foil per
|
||||||
|
*/
|
||||||
|
public BoosterData(final String edition0, final int nC, final int nU, final int nR, final int nS, final int nDF, final int nL,
|
||||||
|
final int oneFoilPer) {
|
||||||
|
this.nCommon = nC;
|
||||||
|
this.nUncommon = nU;
|
||||||
|
this.nRare = nR;
|
||||||
|
this.nSpecial = nS;
|
||||||
|
this.nDoubleFaced = nDF;
|
||||||
|
this.nLand = nL > 0 ? nL : 0;
|
||||||
|
this.foilRate = oneFoilPer;
|
||||||
|
this.edition = edition0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the common.
|
||||||
|
*
|
||||||
|
* @return the common
|
||||||
|
*/
|
||||||
|
public final int getCommon() {
|
||||||
|
return this.nCommon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Predicate<CardPrinted> getEditionFilter() {
|
||||||
|
return CardPrinted.Predicates.printedInSets(edition);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the uncommon.
|
||||||
|
*
|
||||||
|
* @return the uncommon
|
||||||
|
*/
|
||||||
|
public final int getUncommon() {
|
||||||
|
return this.nUncommon;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the rare.
|
||||||
|
*
|
||||||
|
* @return the rare
|
||||||
|
*/
|
||||||
|
public final int getRare() {
|
||||||
|
return this.nRare;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the special.
|
||||||
|
*
|
||||||
|
* @return the special
|
||||||
|
*/
|
||||||
|
public final int getSpecial() {
|
||||||
|
return this.nSpecial;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the double faced.
|
||||||
|
*
|
||||||
|
* @return the double faced
|
||||||
|
*/
|
||||||
|
public final int getDoubleFaced() {
|
||||||
|
return this.nDoubleFaced;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the land.
|
||||||
|
*
|
||||||
|
* @return the land
|
||||||
|
*/
|
||||||
|
public final int getLand() {
|
||||||
|
return this.nLand;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the total.
|
||||||
|
*
|
||||||
|
* @return the total
|
||||||
|
*/
|
||||||
|
public final int getTotal() {
|
||||||
|
return this.nCommon + this.nUncommon + this.nRare + this.nSpecial + this.nDoubleFaced + this.nLand;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the foil chance.
|
||||||
|
*
|
||||||
|
* @return the foil chance
|
||||||
|
*/
|
||||||
|
public final int getFoilChance() {
|
||||||
|
return this.foilRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Lambda1<String, BoosterData> FN_GET_CODE = new Lambda1<String, BoosterData>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apply(BoosterData arg1) {
|
||||||
|
return arg1.edition;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final class Reader extends StorageReaderFile<BoosterData> {
|
||||||
|
|
||||||
|
public Reader(String pathname) {
|
||||||
|
super(pathname, BoosterData.FN_GET_CODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.util.StorageReaderFile#read(java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected BoosterData read(String line) {
|
||||||
|
final FileSection section = FileSection.parse(line, ":", "|");
|
||||||
|
int nC = section.getInt("Commons", 0);
|
||||||
|
int nU = section.getInt("Uncommons", 0);
|
||||||
|
int nR = section.getInt("Rares", 0);
|
||||||
|
int nS = section.getInt("Special", 0);
|
||||||
|
int nDf = section.getInt("DoubleFaced", 0);
|
||||||
|
return new BoosterData(section.get("Set"), nC, nU, nR, nS, nDf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
package forge.card;
|
package forge.card;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
@@ -132,20 +131,16 @@ public class BoosterGenerator {
|
|||||||
* @param cardSet
|
* @param cardSet
|
||||||
* the card set
|
* the card set
|
||||||
*/
|
*/
|
||||||
public BoosterGenerator(final CardEdition cardSet) {
|
public BoosterGenerator(BoosterData booster) {
|
||||||
this();
|
this();
|
||||||
if (!cardSet.canGenerateBooster()) {
|
|
||||||
throw new InvalidParameterException("BoosterGenerator: Set " + cardSet + " cannot generate boosters!");
|
|
||||||
}
|
|
||||||
final CardEdition.BoosterData bs = cardSet.getBoosterData();
|
|
||||||
|
|
||||||
this.numCommons = bs.getCommon();
|
this.numCommons = booster.getCommon();
|
||||||
this.numUncommons = bs.getUncommon();
|
this.numUncommons = booster.getUncommon();
|
||||||
this.numRareSlots = bs.getRare();
|
this.numRareSlots = booster.getRare();
|
||||||
this.numSpecials = bs.getSpecial();
|
this.numSpecials = booster.getSpecial();
|
||||||
this.numDoubleFaced = bs.getDoubleFaced();
|
this.numDoubleFaced = booster.getDoubleFaced();
|
||||||
|
|
||||||
final Predicate<CardPrinted> filter = CardPrinted.Predicates.printedInSets(cardSet.getCode());
|
final Predicate<CardPrinted> filter = booster.getEditionFilter();
|
||||||
final List<CardPrinted> cardsInThisSet = filter.select(CardDb.instance().getAllCards());
|
final List<CardPrinted> cardsInThisSet = filter.select(CardDb.instance().getAllCards());
|
||||||
|
|
||||||
for (final CardPrinted c : cardsInThisSet) {
|
for (final CardPrinted c : cardsInThisSet) {
|
||||||
|
|||||||
@@ -20,8 +20,10 @@ package forge.card;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||||
import net.slightlymagic.maxmtg.Predicate;
|
import net.slightlymagic.maxmtg.Predicate;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
|
import forge.util.StorageReaderFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a CardBlock class.
|
* This is a CardBlock class.
|
||||||
@@ -188,5 +190,62 @@ public final class CardBlock implements Comparable<CardBlock> {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return this.name + " (block)";
|
return this.name + " (block)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final Lambda1<String, CardBlock> FN_GET_NAME = new Lambda1<String, CardBlock>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apply(CardBlock arg1) {
|
||||||
|
return arg1.getName();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static class Reader extends StorageReaderFile<CardBlock>{
|
||||||
|
|
||||||
|
private final EditionCollection editions;
|
||||||
|
/**
|
||||||
|
* TODO: Write javadoc for Constructor.
|
||||||
|
* @param pathname
|
||||||
|
* @param keySelector0
|
||||||
|
*/
|
||||||
|
public Reader(String pathname, EditionCollection editions0) {
|
||||||
|
super(pathname, CardBlock.FN_GET_NAME);
|
||||||
|
editions = editions0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.util.StorageReaderFile#read(java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected CardBlock read(String line) {
|
||||||
|
final String[] sParts = line.trim().split("\\|");
|
||||||
|
|
||||||
|
String name = null;
|
||||||
|
int index = -1;
|
||||||
|
final List<CardEdition> sets = new ArrayList<CardEdition>(4);
|
||||||
|
CardEdition landSet = null;
|
||||||
|
int draftBoosters = 3;
|
||||||
|
int sealedBoosters = 6;
|
||||||
|
|
||||||
|
for (final String sPart : sParts) {
|
||||||
|
final String[] kv = sPart.split(":", 2);
|
||||||
|
final String key = kv[0].toLowerCase();
|
||||||
|
if ("name".equals(key)) {
|
||||||
|
name = kv[1];
|
||||||
|
} else if ("index".equals(key)) {
|
||||||
|
index = Integer.parseInt(kv[1]);
|
||||||
|
} else if ("set0".equals(key) || "set1".equals(key) || "set2".equals(key)) {
|
||||||
|
sets.add(editions.getEditionByCodeOrThrow(kv[1]));
|
||||||
|
} else if ("landsetcode".equals(key)) {
|
||||||
|
landSet = editions.getEditionByCodeOrThrow(kv[1]);
|
||||||
|
} else if ("draftpacks".equals(key)) {
|
||||||
|
draftBoosters = Integer.parseInt(kv[1]);
|
||||||
|
} else if ("sealedpacks".equals(key)) {
|
||||||
|
sealedBoosters = Integer.parseInt(kv[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return new CardBlock(index, name, sets, landSet, draftBoosters, sealedBoosters);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ package forge.card;
|
|||||||
|
|
||||||
import net.slightlymagic.braids.util.lambda.Lambda1;
|
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||||
import net.slightlymagic.maxmtg.Predicate;
|
import net.slightlymagic.maxmtg.Predicate;
|
||||||
|
import forge.Singletons;
|
||||||
import forge.game.GameFormat;
|
import forge.game.GameFormat;
|
||||||
|
import forge.util.FileSection;
|
||||||
|
import forge.util.StorageReaderFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -34,7 +37,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
private final String code;
|
private final String code;
|
||||||
private final String code2;
|
private final String code2;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final BoosterData boosterData;
|
private final String alias;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new card set.
|
* Instantiates a new card set.
|
||||||
@@ -51,28 +54,13 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
public CardEdition(final int index, final String name, final String code, final String code2) {
|
public CardEdition(final int index, final String name, final String code, final String code2) {
|
||||||
this(index, name, code, code2, null);
|
this(index, name, code, code2, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public CardEdition(final int index, final String name, final String code, final String code2, final String alias0) {
|
||||||
* Instantiates a new card set.
|
|
||||||
*
|
|
||||||
* @param index
|
|
||||||
* the index
|
|
||||||
* @param name
|
|
||||||
* the name
|
|
||||||
* @param code
|
|
||||||
* the code
|
|
||||||
* @param code2
|
|
||||||
* the code2
|
|
||||||
* @param booster
|
|
||||||
* the booster
|
|
||||||
*/
|
|
||||||
public CardEdition(final int index, final String name, final String code, final String code2,
|
|
||||||
final BoosterData booster) {
|
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.code2 = code2;
|
this.code2 = code2;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.boosterData = booster;
|
this.alias = alias0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The Constant unknown. */
|
/** The Constant unknown. */
|
||||||
@@ -114,29 +102,11 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
return this.index;
|
return this.index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Can generate booster.
|
|
||||||
*
|
|
||||||
* @return true, if successful
|
|
||||||
*/
|
|
||||||
public boolean canGenerateBooster() {
|
|
||||||
return this.boosterData != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the booster data.
|
|
||||||
*
|
|
||||||
* @return the booster data
|
|
||||||
*/
|
|
||||||
public BoosterData getBoosterData() {
|
|
||||||
return this.boosterData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The Constant fnGetName. */
|
/** The Constant fnGetName. */
|
||||||
public static final Lambda1<String, CardEdition> FN_GET_NAME = new Lambda1<String, CardEdition>() {
|
public static final Lambda1<String, CardEdition> FN_GET_CODE = new Lambda1<String, CardEdition>() {
|
||||||
@Override
|
@Override
|
||||||
public String apply(final CardEdition arg1) {
|
public String apply(final CardEdition arg1) {
|
||||||
return arg1.name;
|
return arg1.getCode();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -202,158 +172,26 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
return this.name + " (set)";
|
return this.name + " (set)";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public String getAlias() {
|
||||||
* The Class BoosterData.
|
return alias;
|
||||||
*/
|
|
||||||
public static class BoosterData {
|
|
||||||
private final int nCommon;
|
|
||||||
private final int nUncommon;
|
|
||||||
private final int nRare;
|
|
||||||
private final int nSpecial;
|
|
||||||
private final int nDoubleFaced;
|
|
||||||
private final int nLand;
|
|
||||||
private final int foilRate;
|
|
||||||
private static final int CARDS_PER_BOOSTER = 15;
|
|
||||||
|
|
||||||
// private final String landCode;
|
|
||||||
/**
|
|
||||||
* Instantiates a new booster data.
|
|
||||||
*
|
|
||||||
* @param nC
|
|
||||||
* the n c
|
|
||||||
* @param nU
|
|
||||||
* the n u
|
|
||||||
* @param nR
|
|
||||||
* the n r
|
|
||||||
* @param nS
|
|
||||||
* the n s
|
|
||||||
* @param nDF
|
|
||||||
* the n df
|
|
||||||
*/
|
|
||||||
public BoosterData(final int nC, final int nU, final int nR, final int nS, final int nDF) {
|
|
||||||
// if this booster has more that 10 cards, there must be a land in
|
|
||||||
// 15th slot unless it's already taken
|
|
||||||
this(nC, nU, nR, nS, nDF, (nC + nR + nU + nS + nDF) > 10 ? BoosterData.CARDS_PER_BOOSTER - nC - nR - nU
|
|
||||||
- nS - nDF : 0, 68);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new booster data.
|
|
||||||
*
|
|
||||||
* @param nC
|
|
||||||
* the n c
|
|
||||||
* @param nU
|
|
||||||
* the n u
|
|
||||||
* @param nR
|
|
||||||
* the n r
|
|
||||||
* @param nS
|
|
||||||
* the n s
|
|
||||||
* @param nDF
|
|
||||||
* the n df
|
|
||||||
* @param nL
|
|
||||||
* the n l
|
|
||||||
* @param oneFoilPer
|
|
||||||
* the one foil per
|
|
||||||
*/
|
|
||||||
public BoosterData(final int nC, final int nU, final int nR, final int nS, final int nDF, final int nL,
|
|
||||||
final int oneFoilPer) {
|
|
||||||
this.nCommon = nC;
|
|
||||||
this.nUncommon = nU;
|
|
||||||
this.nRare = nR;
|
|
||||||
this.nSpecial = nS;
|
|
||||||
this.nDoubleFaced = nDF;
|
|
||||||
this.nLand = nL > 0 ? nL : 0;
|
|
||||||
this.foilRate = oneFoilPer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the common.
|
|
||||||
*
|
|
||||||
* @return the common
|
|
||||||
*/
|
|
||||||
public final int getCommon() {
|
|
||||||
return this.nCommon;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the uncommon.
|
|
||||||
*
|
|
||||||
* @return the uncommon
|
|
||||||
*/
|
|
||||||
public final int getUncommon() {
|
|
||||||
return this.nUncommon;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the rare.
|
|
||||||
*
|
|
||||||
* @return the rare
|
|
||||||
*/
|
|
||||||
public final int getRare() {
|
|
||||||
return this.nRare;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the special.
|
|
||||||
*
|
|
||||||
* @return the special
|
|
||||||
*/
|
|
||||||
public final int getSpecial() {
|
|
||||||
return this.nSpecial;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the double faced.
|
|
||||||
*
|
|
||||||
* @return the double faced
|
|
||||||
*/
|
|
||||||
public final int getDoubleFaced() {
|
|
||||||
return this.nDoubleFaced;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the land.
|
|
||||||
*
|
|
||||||
* @return the land
|
|
||||||
*/
|
|
||||||
public final int getLand() {
|
|
||||||
return this.nLand;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the total.
|
|
||||||
*
|
|
||||||
* @return the total
|
|
||||||
*/
|
|
||||||
public final int getTotal() {
|
|
||||||
return this.nCommon + this.nUncommon + this.nRare + this.nSpecial + this.nDoubleFaced + this.nLand;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the foil chance.
|
|
||||||
*
|
|
||||||
* @return the foil chance
|
|
||||||
*/
|
|
||||||
public final int getFoilChance() {
|
|
||||||
return this.foilRate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class Predicates.
|
* The Class Predicates.
|
||||||
*/
|
*/
|
||||||
public abstract static class Predicates {
|
public abstract static class Predicates {
|
||||||
|
|
||||||
/** The Constant canMakeBooster. */
|
/** The Constant canMakeBooster. */
|
||||||
public static final Predicate<CardEdition> CAN_MAKE_BOOSTER = new CanMakeBooster();
|
public static final Predicate<CardEdition> CAN_MAKE_BOOSTER = new CanMakeBooster();
|
||||||
|
|
||||||
private static class CanMakeBooster extends Predicate<CardEdition> {
|
private static class CanMakeBooster extends Predicate<CardEdition> {
|
||||||
@Override
|
@Override
|
||||||
public boolean isTrue(final CardEdition subject) {
|
public boolean isTrue(final CardEdition subject) {
|
||||||
return subject.canGenerateBooster();
|
return Singletons.getModel().getBoosters().get(subject.getCode()) != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is legal in format.
|
* Checks if is legal in format.
|
||||||
*
|
*
|
||||||
@@ -377,4 +215,27 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Reader extends StorageReaderFile<CardEdition> {
|
||||||
|
|
||||||
|
public Reader(String pathname) {
|
||||||
|
super(pathname, CardEdition.FN_GET_CODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.util.StorageReaderFile#read(java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected CardEdition read(String line) {
|
||||||
|
final FileSection section = FileSection.parse(line, ":", "|");
|
||||||
|
final String code = section.get("code3");
|
||||||
|
final int index = section.getInt("index", -1);
|
||||||
|
final String code2 = section.get("code2");
|
||||||
|
final String name = section.get("name");
|
||||||
|
final String alias = section.get("alias");
|
||||||
|
|
||||||
|
return new CardEdition(index, name, code, code2, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
81
src/main/java/forge/card/EditionCollection.java
Normal file
81
src/main/java/forge/card/EditionCollection.java
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Forge: Play Magic: the Gathering.
|
||||||
|
* Copyright (C) 2011 Forge Team
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package forge.card;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import forge.util.FolderMapView;
|
||||||
|
|
||||||
|
public final class EditionCollection extends FolderMapView<CardEdition> {
|
||||||
|
|
||||||
|
private final Map<String,CardEdition> aliasToEdition = new TreeMap<String, CardEdition>();
|
||||||
|
|
||||||
|
public EditionCollection() {
|
||||||
|
super(new CardEdition.Reader("res/blockdata/setdata.txt"));
|
||||||
|
|
||||||
|
for( CardEdition ee : this )
|
||||||
|
{
|
||||||
|
String alias = ee.getAlias();
|
||||||
|
if ( null != alias )
|
||||||
|
aliasToEdition.put(alias, ee);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the sets the by code.
|
||||||
|
*
|
||||||
|
* @param code
|
||||||
|
* the code
|
||||||
|
* @return the sets the by code
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CardEdition get(final String code) {
|
||||||
|
CardEdition baseResult = super.get(code);
|
||||||
|
return baseResult == null ? aliasToEdition.get(code) : baseResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the sets the by code or throw.
|
||||||
|
*
|
||||||
|
* @param code
|
||||||
|
* the code
|
||||||
|
* @return the sets the by code or throw
|
||||||
|
*/
|
||||||
|
public CardEdition getEditionByCodeOrThrow(final String code) {
|
||||||
|
final CardEdition set = this.get(code);
|
||||||
|
if (null == set) {
|
||||||
|
throw new RuntimeException(String.format("Edition with code '%s' not found", code));
|
||||||
|
}
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
|
// used by image generating code
|
||||||
|
/**
|
||||||
|
* Gets the code2 by code.
|
||||||
|
*
|
||||||
|
* @param code
|
||||||
|
* the code
|
||||||
|
* @return the code2 by code
|
||||||
|
*/
|
||||||
|
public String getCode2ByCode(final String code) {
|
||||||
|
final CardEdition set = this.get(code);
|
||||||
|
return set == null ? "" : set.getCode2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,224 +0,0 @@
|
|||||||
/*
|
|
||||||
* Forge: Play Magic: the Gathering.
|
|
||||||
* Copyright (C) 2011 Forge Team
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package forge.card;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import forge.util.FileSection;
|
|
||||||
import forge.util.FileUtil;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* SetInfoUtil class.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Forge
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
|
||||||
public final class EditionUtils {
|
|
||||||
|
|
||||||
private final List<CardEdition> allSets;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the all sets.
|
|
||||||
*
|
|
||||||
* @return the all sets
|
|
||||||
*/
|
|
||||||
public List<CardEdition> getAllSets() {
|
|
||||||
return this.allSets;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new edition utils.
|
|
||||||
*/
|
|
||||||
public EditionUtils() {
|
|
||||||
this.allSets = this.loadSetData(this.loadBoosterData());
|
|
||||||
this.allBlocks = this.loadBlockData();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Constant <code>setData</code>. */
|
|
||||||
private final Map<String, CardEdition> setsByCode = new TreeMap<String, CardEdition>(String.CASE_INSENSITIVE_ORDER);
|
|
||||||
private final List<CardBlock> allBlocks;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the blocks.
|
|
||||||
*
|
|
||||||
* @return the blocks
|
|
||||||
*/
|
|
||||||
public List<CardBlock> getBlocks() {
|
|
||||||
return this.allBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the sets the by code.
|
|
||||||
*
|
|
||||||
* @param code
|
|
||||||
* the code
|
|
||||||
* @return the sets the by code
|
|
||||||
*/
|
|
||||||
public CardEdition getEditionByCode(final String code) {
|
|
||||||
return this.setsByCode.get(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the sets the by code or throw.
|
|
||||||
*
|
|
||||||
* @param code
|
|
||||||
* the code
|
|
||||||
* @return the sets the by code or throw
|
|
||||||
*/
|
|
||||||
public CardEdition getEditionByCodeOrThrow(final String code) {
|
|
||||||
final CardEdition set = this.setsByCode.get(code);
|
|
||||||
if (null == set) {
|
|
||||||
throw new RuntimeException(String.format("Edition with code '%s' not found", code));
|
|
||||||
}
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
|
|
||||||
// used by image generating code
|
|
||||||
/**
|
|
||||||
* Gets the code2 by code.
|
|
||||||
*
|
|
||||||
* @param code
|
|
||||||
* the code
|
|
||||||
* @return the code2 by code
|
|
||||||
*/
|
|
||||||
public String getCode2ByCode(final String code) {
|
|
||||||
final CardEdition set = this.setsByCode.get(code);
|
|
||||||
return set == null ? "" : set.getCode2();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, CardEdition.BoosterData> loadBoosterData() {
|
|
||||||
final ArrayList<String> fData = FileUtil.readFile("res/blockdata/boosters.txt");
|
|
||||||
final Map<String, CardEdition.BoosterData> result = new HashMap<String, CardEdition.BoosterData>();
|
|
||||||
|
|
||||||
for (final String s : fData) {
|
|
||||||
if (StringUtils.isBlank(s)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String[] sParts = s.trim().split("\\|");
|
|
||||||
String code = null;
|
|
||||||
int nC = 0, nU = 0, nR = 0, nS = 0, nDF = 0;
|
|
||||||
for (final String sPart : sParts) {
|
|
||||||
final String[] kv = sPart.split(":", 2);
|
|
||||||
final String key = kv[0].toLowerCase();
|
|
||||||
|
|
||||||
if (key.equalsIgnoreCase("Set")) {
|
|
||||||
code = kv[1];
|
|
||||||
}
|
|
||||||
if (key.equalsIgnoreCase("Commons")) {
|
|
||||||
nC = Integer.parseInt(kv[1]);
|
|
||||||
}
|
|
||||||
if (key.equalsIgnoreCase("Uncommons")) {
|
|
||||||
nU = Integer.parseInt(kv[1]);
|
|
||||||
}
|
|
||||||
if (key.equalsIgnoreCase("Rares")) {
|
|
||||||
nR = Integer.parseInt(kv[1]);
|
|
||||||
}
|
|
||||||
if (key.equalsIgnoreCase("Special")) {
|
|
||||||
nS = Integer.parseInt(kv[1]);
|
|
||||||
}
|
|
||||||
if (key.equalsIgnoreCase("DoubleFaced")) {
|
|
||||||
nDF = Integer.parseInt(kv[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result.put(code, new CardEdition.BoosterData(nC, nU, nR, nS, nDF));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// parser code - quite boring.
|
|
||||||
private List<CardEdition> loadSetData(final Map<String, CardEdition.BoosterData> boosters) {
|
|
||||||
final ArrayList<String> fData = FileUtil.readFile("res/blockdata/setdata.txt");
|
|
||||||
|
|
||||||
final List<CardEdition> allSets = new ArrayList<CardEdition>();
|
|
||||||
for (final String s : fData) {
|
|
||||||
if (StringUtils.isBlank(s)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final FileSection section = FileSection.parse(s, ":", "|");
|
|
||||||
final String code = section.get("code3");
|
|
||||||
final int index = section.getInt("index", -1);
|
|
||||||
final String code2 = section.get("code2");
|
|
||||||
final String name = section.get("name");
|
|
||||||
final String alias = section.get("alias");
|
|
||||||
|
|
||||||
final CardEdition set = new CardEdition(index, name, code, code2, boosters.get(code));
|
|
||||||
// boosters.remove(code);
|
|
||||||
this.setsByCode.put(code, set);
|
|
||||||
if (alias != null) {
|
|
||||||
this.setsByCode.put(alias, set);
|
|
||||||
}
|
|
||||||
allSets.add(set);
|
|
||||||
}
|
|
||||||
assert boosters.isEmpty();
|
|
||||||
return allSets;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<CardBlock> loadBlockData() {
|
|
||||||
final ArrayList<String> fData = FileUtil.readFile("res/blockdata/blocks.txt");
|
|
||||||
final List<CardBlock> theBlocks = new ArrayList<CardBlock>();
|
|
||||||
|
|
||||||
for (final String s : fData) {
|
|
||||||
if (StringUtils.isBlank(s)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String[] sParts = s.trim().split("\\|");
|
|
||||||
|
|
||||||
String name = null;
|
|
||||||
int index = -1;
|
|
||||||
final List<CardEdition> sets = new ArrayList<CardEdition>(4);
|
|
||||||
CardEdition landSet = null;
|
|
||||||
int draftBoosters = 3;
|
|
||||||
int sealedBoosters = 6;
|
|
||||||
|
|
||||||
for (final String sPart : sParts) {
|
|
||||||
final String[] kv = sPart.split(":", 2);
|
|
||||||
final String key = kv[0].toLowerCase();
|
|
||||||
if ("name".equals(key)) {
|
|
||||||
name = kv[1];
|
|
||||||
} else if ("index".equals(key)) {
|
|
||||||
index = Integer.parseInt(kv[1]);
|
|
||||||
} else if ("set0".equals(key) || "set1".equals(key) || "set2".equals(key)) {
|
|
||||||
sets.add(this.getEditionByCodeOrThrow(kv[1]));
|
|
||||||
} else if ("landsetcode".equals(key)) {
|
|
||||||
landSet = this.getEditionByCodeOrThrow(kv[1]);
|
|
||||||
} else if ("draftpacks".equals(key)) {
|
|
||||||
draftBoosters = Integer.parseInt(kv[1]);
|
|
||||||
} else if ("sealedpacks".equals(key)) {
|
|
||||||
sealedBoosters = Integer.parseInt(kv[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
theBlocks.add(new CardBlock(index, name, sets, landSet, draftBoosters, sealedBoosters));
|
|
||||||
}
|
|
||||||
Collections.reverse(theBlocks);
|
|
||||||
return Collections.unmodifiableList(theBlocks);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -19,22 +19,25 @@ package forge.card;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import forge.game.GameFormat;
|
import forge.game.GameFormat;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FolderMapView;
|
||||||
|
import forge.util.StorageReaderFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class FormatUtils.
|
* The Class FormatUtils.
|
||||||
*/
|
*/
|
||||||
public final class FormatUtils {
|
public final class FormatCollection extends FolderMapView<GameFormat> {
|
||||||
|
|
||||||
private final Map<String, GameFormat> formats = new TreeMap<String, GameFormat>(String.CASE_INSENSITIVE_ORDER);
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Write javadoc for Constructor.
|
||||||
|
* @param io
|
||||||
|
*/
|
||||||
|
public FormatCollection(String filename) {
|
||||||
|
super(new FormatReader(filename));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the standard.
|
* Gets the standard.
|
||||||
@@ -42,7 +45,7 @@ public final class FormatUtils {
|
|||||||
* @return the standard
|
* @return the standard
|
||||||
*/
|
*/
|
||||||
public GameFormat getStandard() {
|
public GameFormat getStandard() {
|
||||||
return formats.get("Standard");
|
return getMap().get("Standard");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,7 +54,7 @@ public final class FormatUtils {
|
|||||||
* @return the extended
|
* @return the extended
|
||||||
*/
|
*/
|
||||||
public GameFormat getExtended() {
|
public GameFormat getExtended() {
|
||||||
return formats.get("Extended");
|
return getMap().get("Extended");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,30 +63,29 @@ public final class FormatUtils {
|
|||||||
* @return the modern
|
* @return the modern
|
||||||
*/
|
*/
|
||||||
public GameFormat getModern() {
|
public GameFormat getModern() {
|
||||||
return formats.get("Modern");
|
return getMap().get("Modern");
|
||||||
}
|
|
||||||
|
|
||||||
// list are immutable, no worries
|
|
||||||
/**
|
|
||||||
* Gets the formats.
|
|
||||||
*
|
|
||||||
* @return the formats
|
|
||||||
*/
|
|
||||||
public Collection<GameFormat> getFormats() {
|
|
||||||
return formats.values();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new format utils.
|
* Instantiates a new format utils.
|
||||||
*/
|
*/
|
||||||
public FormatUtils() {
|
|
||||||
final List<String> fData = FileUtil.readFile("res/blockdata/formats.txt");
|
public static class FormatReader extends StorageReaderFile<GameFormat> {
|
||||||
|
|
||||||
for (final String s : fData) {
|
/**
|
||||||
if (StringUtils.isBlank(s)) {
|
* TODO: Write javadoc for Constructor.
|
||||||
continue;
|
* @param file0
|
||||||
}
|
* @param keySelector0
|
||||||
|
*/
|
||||||
|
public FormatReader(String file0) {
|
||||||
|
super(file0, GameFormat.FN_GET_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.util.StorageReaderFile#read(java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected GameFormat read(String line) {
|
||||||
String name = null;
|
String name = null;
|
||||||
final List<String> sets = new ArrayList<String>(); // default: all
|
final List<String> sets = new ArrayList<String>(); // default: all
|
||||||
// sets
|
// sets
|
||||||
@@ -92,7 +94,7 @@ public final class FormatUtils {
|
|||||||
// nothing
|
// nothing
|
||||||
// banned
|
// banned
|
||||||
|
|
||||||
final String[] sParts = s.trim().split("\\|");
|
final String[] sParts = line.trim().split("\\|");
|
||||||
for (final String sPart : sParts) {
|
for (final String sPart : sParts) {
|
||||||
final String[] kv = sPart.split(":", 2);
|
final String[] kv = sPart.split(":", 2);
|
||||||
final String key = kv[0].toLowerCase();
|
final String key = kv[0].toLowerCase();
|
||||||
@@ -107,10 +109,10 @@ public final class FormatUtils {
|
|||||||
if (name == null) {
|
if (name == null) {
|
||||||
throw new RuntimeException("Format must have a name! Check formats.txt file");
|
throw new RuntimeException("Format must have a name! Check formats.txt file");
|
||||||
}
|
}
|
||||||
final GameFormat thisFormat = new GameFormat(name, sets, bannedCards);
|
return new GameFormat(name, sets, bannedCards);
|
||||||
|
|
||||||
formats.put(name, thisFormat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,6 +28,8 @@ import java.util.Map.Entry;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import forge.deck.io.DeckFileHeader;
|
import forge.deck.io.DeckFileHeader;
|
||||||
@@ -270,4 +272,11 @@ public class Deck extends DeckBase implements Serializable, IHasName {
|
|||||||
out.addAll(Deck.writeCardPool(this.getSideboard()));
|
out.addAll(Deck.writeCardPool(this.getSideboard()));
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final static Lambda1<String, Deck> FN_NAME_SELECTOR = new Lambda1<String, Deck>() {
|
||||||
|
@Override
|
||||||
|
public String apply(Deck arg1) {
|
||||||
|
return arg1.getName();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ package forge.deck;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||||
|
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
import forge.item.ItemPoolView;
|
import forge.item.ItemPoolView;
|
||||||
import forge.util.IHasName;
|
import forge.util.IHasName;
|
||||||
@@ -110,5 +112,12 @@ public class DeckGroup extends DeckBase implements IHasName {
|
|||||||
protected DeckBase newInstance(final String name0) {
|
protected DeckBase newInstance(final String name0) {
|
||||||
return new DeckGroup(name0);
|
return new DeckGroup(name0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final static Lambda1<String, DeckGroup> FN_NAME_SELECTOR = new Lambda1<String, DeckGroup>() {
|
||||||
|
@Override
|
||||||
|
public String apply(DeckGroup arg1) {
|
||||||
|
return arg1.getName();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class DeckGroupSerializer extends StorageReaderFolder<DeckGroup> implemen
|
|||||||
* @param deckDir0 the deck dir0
|
* @param deckDir0 the deck dir0
|
||||||
*/
|
*/
|
||||||
public DeckGroupSerializer(final File deckDir0) {
|
public DeckGroupSerializer(final File deckDir0) {
|
||||||
super(deckDir0);
|
super(deckDir0, DeckGroup.FN_NAME_SELECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The Constant MAX_DRAFT_PLAYERS. */
|
/** The Constant MAX_DRAFT_PLAYERS. */
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class DeckSerializer extends StorageReaderFolder<Deck> implements IItemSe
|
|||||||
* @param deckDir0 the deck dir0
|
* @param deckDir0 the deck dir0
|
||||||
*/
|
*/
|
||||||
public DeckSerializer(final File deckDir0) {
|
public DeckSerializer(final File deckDir0) {
|
||||||
super(deckDir0);
|
super(deckDir0, Deck.FN_NAME_SELECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Constant <code>DCKFileFilter</code>. */
|
/** Constant <code>DCKFileFilter</code>. */
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ package forge.game;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||||
import net.slightlymagic.maxmtg.Predicate;
|
import net.slightlymagic.maxmtg.Predicate;
|
||||||
import forge.card.CardRules;
|
import forge.card.CardRules;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
@@ -118,5 +119,12 @@ public final class GameFormat {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return this.name + " (format)";
|
return this.name + " (format)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final Lambda1<String,GameFormat> FN_GET_NAME = new Lambda1<String, GameFormat>() {
|
||||||
|
@Override
|
||||||
|
public String apply(GameFormat arg1) {
|
||||||
|
return arg1.getName();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
|
import net.slightlymagic.braids.util.UtilFunctions;
|
||||||
import net.slightlymagic.braids.util.lambda.Lambda1;
|
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||||
import net.slightlymagic.maxmtg.Closure1;
|
import net.slightlymagic.maxmtg.Closure1;
|
||||||
|
|
||||||
@@ -93,9 +94,8 @@ public final class BoosterDraft implements IBoosterDraft {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Block: // Draft from cards by block or set
|
case Block: // Draft from cards by block or set
|
||||||
final List<CardBlock> blocks = Singletons.getModel().getEditions().getBlocks();
|
|
||||||
|
|
||||||
final Object o = GuiUtils.getChoice("Choose Block", blocks.toArray());
|
final Object o = GuiUtils.getChoice("Choose Block", UtilFunctions.iteratorToArray(Singletons.getModel().getBlocks().iterator(), new CardBlock[]{}));
|
||||||
final CardBlock block = (CardBlock) o;
|
final CardBlock block = (CardBlock) o;
|
||||||
|
|
||||||
final CardEdition[] cardSets = block.getSets();
|
final CardEdition[] cardSets = block.getSets();
|
||||||
@@ -124,12 +124,12 @@ public final class BoosterDraft implements IBoosterDraft {
|
|||||||
final Object p = GuiUtils.getChoice("Choose Set Combination", setCombos.toArray());
|
final Object p = GuiUtils.getChoice("Choose Set Combination", setCombos.toArray());
|
||||||
final String[] pp = p.toString().split("/");
|
final String[] pp = p.toString().split("/");
|
||||||
for (int i = 0; i < nPacks; i++) {
|
for (int i = 0; i < nPacks; i++) {
|
||||||
final BoosterGenerator bpMulti = new BoosterGenerator(Singletons.getModel().getEditions().getEditionByCode(pp[i]));
|
final BoosterGenerator bpMulti = new BoosterGenerator(Singletons.getModel().getBoosters().get(pp[i]));
|
||||||
this.packs.add(BoosterGenerator.getSimplePicker(bpMulti));
|
this.packs.add(BoosterGenerator.getSimplePicker(bpMulti));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
final BoosterGenerator bpOne = new BoosterGenerator(Singletons.getModel().getEditions().getEditionByCode(sets[0]));
|
final BoosterGenerator bpOne = new BoosterGenerator(Singletons.getModel().getBoosters().get(sets[0]));
|
||||||
final Closure1<List<CardPrinted>, BoosterGenerator> pick1 = BoosterGenerator.getSimplePicker(bpOne);
|
final Closure1<List<CardPrinted>, BoosterGenerator> pick1 = BoosterGenerator.getSimplePicker(bpOne);
|
||||||
for (int i = 0; i < nPacks; i++) {
|
for (int i = 0; i < nPacks; i++) {
|
||||||
this.packs.add(pick1);
|
this.packs.add(pick1);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
|
import net.slightlymagic.braids.util.UtilFunctions;
|
||||||
import net.slightlymagic.braids.util.lambda.Lambda1;
|
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||||
import net.slightlymagic.maxmtg.Closure1;
|
import net.slightlymagic.maxmtg.Closure1;
|
||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
@@ -79,7 +80,7 @@ public class SealedDeck {
|
|||||||
this.getLandSetCode()[0] = CardDb.instance().getCard("Plains").getEdition();
|
this.getLandSetCode()[0] = CardDb.instance().getCard("Plains").getEdition();
|
||||||
} else if (sealedType.equals("Block")) {
|
} else if (sealedType.equals("Block")) {
|
||||||
|
|
||||||
final Object o = GuiUtils.getChoice("Choose Block", Singletons.getModel().getEditions().getBlocks().toArray());
|
final Object o = GuiUtils.getChoice("Choose Block", UtilFunctions.iteratorToArray(Singletons.getModel().getBlocks().iterator(), new CardBlock[]{}));
|
||||||
final CardBlock block = (CardBlock) o;
|
final CardBlock block = (CardBlock) o;
|
||||||
|
|
||||||
final CardEdition[] cardSets = block.getSets();
|
final CardEdition[] cardSets = block.getSets();
|
||||||
@@ -106,11 +107,11 @@ public class SealedDeck {
|
|||||||
|
|
||||||
final String[] pp = p.toString().split("/");
|
final String[] pp = p.toString().split("/");
|
||||||
for (int i = 0; i < nPacks; i++) {
|
for (int i = 0; i < nPacks; i++) {
|
||||||
final BoosterGenerator bpMulti = new BoosterGenerator(Singletons.getModel().getEditions().getEditionByCode(pp[i]));
|
final BoosterGenerator bpMulti = new BoosterGenerator(Singletons.getModel().getBoosters().get(pp[i]));
|
||||||
this.packs.add(BoosterGenerator.getSimplePicker(bpMulti));
|
this.packs.add(BoosterGenerator.getSimplePicker(bpMulti));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final BoosterGenerator bpOne = new BoosterGenerator(Singletons.getModel().getEditions().getEditionByCode(sets[0]));
|
final BoosterGenerator bpOne = new BoosterGenerator(Singletons.getModel().getBoosters().get(sets[0]));
|
||||||
final Closure1<List<CardPrinted>, BoosterGenerator> picker = BoosterGenerator.getSimplePicker(bpOne);
|
final Closure1<List<CardPrinted>, BoosterGenerator> picker = BoosterGenerator.getSimplePicker(bpOne);
|
||||||
for (int i = 0; i < nPacks; i++) {
|
for (int i = 0; i < nPacks; i++) {
|
||||||
this.packs.add(picker);
|
this.packs.add(picker);
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import java.awt.image.BufferedImage;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.Box;
|
import javax.swing.Box;
|
||||||
@@ -45,7 +44,6 @@ import javax.swing.event.ListSelectionEvent;
|
|||||||
import javax.swing.event.ListSelectionListener;
|
import javax.swing.event.ListSelectionListener;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import net.slightlymagic.braids.util.UtilFunctions;
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
@@ -259,33 +257,6 @@ public final class GuiUtils {
|
|||||||
return choice.isEmpty() ? null : choice.get(0);
|
return choice.isEmpty() ? null : choice.get(0);
|
||||||
} // getChoiceOptional(String,T...)
|
} // getChoiceOptional(String,T...)
|
||||||
|
|
||||||
/**
|
|
||||||
* Like getChoiceOptional, but this takes an Iterator instead of a variable
|
|
||||||
* number of arguments.
|
|
||||||
*
|
|
||||||
* @param <T>
|
|
||||||
* is automatically inferred.
|
|
||||||
* @param message
|
|
||||||
* a {@link java.lang.String} object.
|
|
||||||
* @param choices
|
|
||||||
* an Iterator over T objects.
|
|
||||||
* @return null if choices is missing, empty, or if the users' choices are
|
|
||||||
* empty; otherwise, returns the first item in the List returned by
|
|
||||||
* getChoices.
|
|
||||||
*/
|
|
||||||
public static <T> T getChoiceOptional(final String message, final Iterator<T> choices) {
|
|
||||||
if ((choices == null) | !choices.hasNext()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO this is an expensive operation; it would be better to
|
|
||||||
// update getChoices to accept an Iterator.
|
|
||||||
final T[] choicesArray = UtilFunctions.iteratorToArray(choices);
|
|
||||||
|
|
||||||
final List<T> choice = GuiUtils.getChoices(message, 0, 1, choicesArray);
|
|
||||||
return choice.isEmpty() ? null : choice.get(0);
|
|
||||||
} // getChoiceOptional(String,Iterator<T>)
|
|
||||||
|
|
||||||
// returned Object will never be null
|
// returned Object will never be null
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public abstract class PresetColumns {
|
|||||||
|
|
||||||
private static CardEdition toSetCmp(final InventoryItem i) {
|
private static CardEdition toSetCmp(final InventoryItem i) {
|
||||||
return i instanceof InventoryItemFromSet ? Singletons.getModel().getEditions()
|
return i instanceof InventoryItemFromSet ? Singletons.getModel().getEditions()
|
||||||
.getEditionByCode(((InventoryItemFromSet) i).getEdition()) : CardEdition.UNKNOWN;
|
.get(((InventoryItemFromSet) i).getEdition()) : CardEdition.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String toSetStr(final InventoryItem i) {
|
private static String toSetStr(final InventoryItem i) {
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public class CardPanelLite extends CardPanelBase {
|
|||||||
final BoosterPack booster = (BoosterPack) card;
|
final BoosterPack booster = (BoosterPack) card;
|
||||||
final CardEdition set = Singletons.getModel().getEditions().getEditionByCodeOrThrow(booster.getEdition());
|
final CardEdition set = Singletons.getModel().getEditions().getEditionByCodeOrThrow(booster.getEdition());
|
||||||
final String tpl = "%s booster pack.%n%nContains %d cards.%n%nBuy it to reveal the cards and add them to your inventory.";
|
final String tpl = "%s booster pack.%n%nContains %d cards.%n%nBuy it to reveal the cards and add them to your inventory.";
|
||||||
this.description.setText(String.format(tpl, set.getName(), set.getBoosterData().getTotal()));
|
this.description.setText(String.format(tpl, set.getName(), booster.getTotalCards()));
|
||||||
} else if (card instanceof PreconDeck) {
|
} else if (card instanceof PreconDeck) {
|
||||||
final PreconDeck deck = (PreconDeck) card;
|
final PreconDeck deck = (PreconDeck) card;
|
||||||
final String desc = deck.getDescription();
|
final String desc = deck.getDescription();
|
||||||
|
|||||||
@@ -91,10 +91,10 @@ public class FilterNameTypeSetPanel extends JComponent {
|
|||||||
|
|
||||||
this.searchSetCombo.removeAllItems();
|
this.searchSetCombo.removeAllItems();
|
||||||
this.searchSetCombo.addItem("(all sets and formats)");
|
this.searchSetCombo.addItem("(all sets and formats)");
|
||||||
for (final GameFormat s : Singletons.getModel().getFormats().getFormats()) {
|
for (final GameFormat s : Singletons.getModel().getFormats()) {
|
||||||
this.searchSetCombo.addItem(s);
|
this.searchSetCombo.addItem(s);
|
||||||
}
|
}
|
||||||
for (final CardEdition s : Singletons.getModel().getEditions().getAllSets()) {
|
for (final CardEdition s : Singletons.getModel().getEditions()) {
|
||||||
this.searchSetCombo.addItem(s);
|
this.searchSetCombo.addItem(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,14 @@
|
|||||||
*/
|
*/
|
||||||
package forge.item;
|
package forge.item;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.slightlymagic.braids.util.UtilFunctions;
|
||||||
import net.slightlymagic.braids.util.lambda.Lambda1;
|
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||||
import net.slightlymagic.maxmtg.Predicate;
|
import net.slightlymagic.maxmtg.Predicate;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
|
import forge.card.BoosterData;
|
||||||
import forge.card.BoosterGenerator;
|
import forge.card.BoosterGenerator;
|
||||||
import forge.card.CardRules;
|
import forge.card.CardRules;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
@@ -40,7 +43,7 @@ public class BoosterPack implements InventoryItemFromSet {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final CardEdition cardSet;
|
private final BoosterData contents;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
private List<CardPrinted> cards = null;
|
private List<CardPrinted> cards = null;
|
||||||
@@ -62,8 +65,8 @@ public class BoosterPack implements InventoryItemFromSet {
|
|||||||
* the set
|
* the set
|
||||||
*/
|
*/
|
||||||
public BoosterPack(final CardEdition set) {
|
public BoosterPack(final CardEdition set) {
|
||||||
this.cardSet = set;
|
this.contents = Singletons.getModel().getBoosters().get(set.getCode());
|
||||||
this.name = this.cardSet.getName() + " Booster Pack";
|
this.name = set.getName() + " Booster Pack";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -78,7 +81,7 @@ public class BoosterPack implements InventoryItemFromSet {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final String getEdition() {
|
public final String getEdition() {
|
||||||
return this.cardSet.getCode();
|
return this.contents.getEdition();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -108,7 +111,7 @@ public class BoosterPack implements InventoryItemFromSet {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final String getImageFilename() {
|
public final String getImageFilename() {
|
||||||
return "booster/" + this.cardSet.getCode() + ".png";
|
return "booster/" + this.contents.getEdition() + ".png";
|
||||||
}
|
}
|
||||||
|
|
||||||
private CardPrinted getRandomBasicLand(final CardEdition set) {
|
private CardPrinted getRandomBasicLand(final CardEdition set) {
|
||||||
@@ -118,23 +121,23 @@ public class BoosterPack implements InventoryItemFromSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private CardPrinted getLandFromNearestSet() {
|
private CardPrinted getLandFromNearestSet() {
|
||||||
final List<CardEdition> sets = Singletons.getModel().getEditions().getAllSets();
|
final CardEdition[] editions = UtilFunctions.iteratorToArray(Singletons.getModel().getEditions().iterator(), new CardEdition[]{});
|
||||||
final int iThisSet = sets.indexOf(this.cardSet);
|
final int iThisSet = Arrays.binarySearch(editions, this.contents);
|
||||||
for (int iSet = iThisSet; iSet < sets.size(); iSet++) {
|
for (int iSet = iThisSet; iSet < editions.length; iSet++) {
|
||||||
final CardPrinted land = this.getRandomBasicLand(sets.get(iSet));
|
final CardPrinted land = this.getRandomBasicLand(editions[iSet]);
|
||||||
if (null != land) {
|
if (null != land) {
|
||||||
return land;
|
return land;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if not found (though that's impossible)
|
// if not found (though that's impossible)
|
||||||
return this.getRandomBasicLand(Singletons.getModel().getEditions().getEditionByCode("M12"));
|
return this.getRandomBasicLand(Singletons.getModel().getEditions().get("M12"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generate() {
|
private void generate() {
|
||||||
final BoosterGenerator gen = new BoosterGenerator(this.cardSet);
|
final BoosterGenerator gen = new BoosterGenerator(this.contents);
|
||||||
this.cards = gen.getBoosterPack();
|
this.cards = gen.getBoosterPack();
|
||||||
|
|
||||||
final int cntLands = this.cardSet.getBoosterData().getLand();
|
final int cntLands = this.contents.getLand();
|
||||||
if (cntLands > 0) {
|
if (cntLands > 0) {
|
||||||
this.cards.add(this.getLandFromNearestSet());
|
this.cards.add(this.getLandFromNearestSet());
|
||||||
}
|
}
|
||||||
@@ -166,7 +169,7 @@ public class BoosterPack implements InventoryItemFromSet {
|
|||||||
public final int hashCode() {
|
public final int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
result = (prime * result) + ((this.cardSet == null) ? 0 : this.cardSet.hashCode());
|
result = (prime * result) + ((this.contents == null) ? 0 : this.contents.hashCode());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,11 +190,11 @@ public class BoosterPack implements InventoryItemFromSet {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final BoosterPack other = (BoosterPack) obj;
|
final BoosterPack other = (BoosterPack) obj;
|
||||||
if (this.cardSet == null) {
|
if (this.contents == null) {
|
||||||
if (other.cardSet != null) {
|
if (other.contents != null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (!this.cardSet.equals(other.cardSet)) {
|
} else if (!this.contents.equals(other.contents)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -224,8 +227,16 @@ public class BoosterPack implements InventoryItemFromSet {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final Object clone() {
|
public final Object clone() {
|
||||||
return new BoosterPack(this.cardSet); // it's ok to share a reference to
|
return new BoosterPack(Singletons.getModel().getEditions().getEditionByCodeOrThrow(this.contents.getEdition())); // it's ok to share a reference to
|
||||||
// cardSet which is static anyway
|
// cardSet which is static anyway
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Write javadoc for this method.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getTotalCards() {
|
||||||
|
return contents.getTotal();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -392,10 +392,10 @@ public final class CardDb {
|
|||||||
|
|
||||||
// Find card with maximal set index
|
// Find card with maximal set index
|
||||||
result = namedCards.get(0);
|
result = namedCards.get(0);
|
||||||
int resIndex = Singletons.getModel().getEditions().getEditionByCode((result).getEdition()).getIndex();
|
int resIndex = Singletons.getModel().getEditions().get((result).getEdition()).getIndex();
|
||||||
for (final CardPrinted card : namedCards) {
|
for (final CardPrinted card : namedCards) {
|
||||||
|
|
||||||
final int thisIndex = Singletons.getModel().getEditions().getEditionByCode((card).getEdition()).getIndex();
|
final int thisIndex = Singletons.getModel().getEditions().get((card).getEdition()).getIndex();
|
||||||
if (thisIndex > resIndex) {
|
if (thisIndex > resIndex) {
|
||||||
result = card;
|
result = card;
|
||||||
resIndex = thisIndex;
|
resIndex = thisIndex;
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import java.io.File;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.quest.SellRules;
|
import forge.quest.SellRules;
|
||||||
@@ -88,7 +90,7 @@ public class PreconDeck implements InventoryItemFromSet {
|
|||||||
|
|
||||||
imageFilename = kv.get("Image");
|
imageFilename = kv.get("Image");
|
||||||
description = kv.get("Description");
|
description = kv.get("Description");
|
||||||
if (Singletons.getModel().getEditions().getEditionByCode(kv.get("set").toUpperCase()) != null) {
|
if (Singletons.getModel().getEditions().get(kv.get("set").toUpperCase()) != null) {
|
||||||
setProxy = kv.get("set");
|
setProxy = kv.get("set");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,5 +135,12 @@ public class PreconDeck implements InventoryItemFromSet {
|
|||||||
public final String getDescription() {
|
public final String getDescription() {
|
||||||
return this.description;
|
return this.description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final static Lambda1<String, PreconDeck> FN_NAME_SELECTOR = new Lambda1<String, PreconDeck>() {
|
||||||
|
@Override
|
||||||
|
public String apply(PreconDeck arg1) {
|
||||||
|
return arg1.getName();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,10 @@ import forge.Constant;
|
|||||||
import forge.ConstantStringArrayList;
|
import forge.ConstantStringArrayList;
|
||||||
import forge.GameAction;
|
import forge.GameAction;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.EditionUtils;
|
import forge.card.BoosterData;
|
||||||
import forge.card.FormatUtils;
|
import forge.card.CardBlock;
|
||||||
|
import forge.card.EditionCollection;
|
||||||
|
import forge.card.FormatCollection;
|
||||||
import forge.control.input.InputControl;
|
import forge.control.input.InputControl;
|
||||||
import forge.deck.CardCollections;
|
import forge.deck.CardCollections;
|
||||||
import forge.game.GameState;
|
import forge.game.GameState;
|
||||||
@@ -47,7 +49,9 @@ import forge.properties.NewConstants;
|
|||||||
import forge.quest.data.QuestEventManager;
|
import forge.quest.data.QuestEventManager;
|
||||||
import forge.quest.data.QuestPreferences;
|
import forge.quest.data.QuestPreferences;
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
|
import forge.util.FolderMapView;
|
||||||
import forge.util.HttpUtil;
|
import forge.util.HttpUtil;
|
||||||
|
import forge.util.IFolderMapView;
|
||||||
import forge.view.match.ViewField;
|
import forge.view.match.ViewField;
|
||||||
import forge.view.match.ViewTabber;
|
import forge.view.match.ViewTabber;
|
||||||
import forge.view.toolbox.FSkin;
|
import forge.view.toolbox.FSkin;
|
||||||
@@ -79,13 +83,16 @@ public enum FModel {
|
|||||||
private final GameState gameState;
|
private final GameState gameState;
|
||||||
private final FMatchState matchState;
|
private final FMatchState matchState;
|
||||||
|
|
||||||
private final EditionUtils setUtils;
|
private final EditionCollection editions;
|
||||||
private final FormatUtils formats;
|
private final FormatCollection formats;
|
||||||
|
private final IFolderMapView<BoosterData> boosters;
|
||||||
|
private final FolderMapView<CardBlock> blocks;
|
||||||
|
|
||||||
// have to implement lazy initialization - at the moment of FModel.ctor()
|
// have to implement lazy initialization - at the moment of FModel.ctor()
|
||||||
// CardDb is not ready yet.
|
// CardDb is not ready yet.
|
||||||
private CardCollections decks;
|
private CardCollections decks;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
@@ -124,9 +131,12 @@ public enum FModel {
|
|||||||
this.matchState = new FMatchState();
|
this.matchState = new FMatchState();
|
||||||
this.questPreferences = new QuestPreferences();
|
this.questPreferences = new QuestPreferences();
|
||||||
this.questEventManager = new QuestEventManager();
|
this.questEventManager = new QuestEventManager();
|
||||||
this.setUtils = new EditionUtils();
|
this.editions = new EditionCollection();
|
||||||
this.formats = new FormatUtils();
|
this.formats = new FormatCollection("res/blockdata/formats.txt");
|
||||||
|
this.boosters = new FolderMapView<BoosterData>(new BoosterData.Reader("res/blockdata/boosters.txt"));
|
||||||
|
this.blocks = new FolderMapView<CardBlock>(new CardBlock.Reader("res/blockdata/blocks.txt", editions));
|
||||||
|
|
||||||
|
|
||||||
// TODO this single setting from preferences should not be here, or,
|
// TODO this single setting from preferences should not be here, or,
|
||||||
// it should be here with all the other settings at the same time.
|
// it should be here with all the other settings at the same time.
|
||||||
// Unfortunately, they're tied up in legacy code in the Display
|
// Unfortunately, they're tied up in legacy code in the Display
|
||||||
@@ -156,6 +166,10 @@ public enum FModel {
|
|||||||
FModel.loadDynamicGamedata();
|
FModel.loadDynamicGamedata();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final IFolderMapView<BoosterData> getBoosters() {
|
||||||
|
return boosters;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load dynamic gamedata.
|
* Load dynamic gamedata.
|
||||||
*/
|
*/
|
||||||
@@ -374,8 +388,8 @@ public enum FModel {
|
|||||||
* @return the editions
|
* @return the editions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final EditionUtils getEditions() {
|
public final EditionCollection getEditions() {
|
||||||
return this.setUtils;
|
return this.editions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -383,7 +397,7 @@ public enum FModel {
|
|||||||
*
|
*
|
||||||
* @return the formats
|
* @return the formats
|
||||||
*/
|
*/
|
||||||
public final FormatUtils getFormats() {
|
public final FormatCollection getFormats() {
|
||||||
return this.formats;
|
return this.formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -502,4 +516,10 @@ public enum FModel {
|
|||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FolderMapView<CardBlock> getBlocks() {
|
||||||
|
return blocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class PreconReader extends StorageReaderFolder<PreconDeck> {
|
|||||||
* @param deckDir0 the deck dir0
|
* @param deckDir0 the deck dir0
|
||||||
*/
|
*/
|
||||||
public PreconReader(final File deckDir0) {
|
public PreconReader(final File deckDir0) {
|
||||||
super(deckDir0);
|
super(deckDir0, PreconDeck.FN_NAME_SELECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -109,4 +109,12 @@ public class QuestDeckMap implements IFolderMap<Deck> {
|
|||||||
return !this.map.containsKey(name);
|
return !this.map.containsKey(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.util.IFolderMapView#any(java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean any(String name) {
|
||||||
|
return map.containsKey(name);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import net.slightlymagic.maxmtg.Predicate;
|
|||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.BoosterGenerator;
|
import forge.card.BoosterGenerator;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.FormatUtils;
|
import forge.card.FormatCollection;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.item.BoosterPack;
|
import forge.item.BoosterPack;
|
||||||
import forge.item.CardDb;
|
import forge.item.CardDb;
|
||||||
@@ -313,7 +313,7 @@ public final class QuestUtilCards {
|
|||||||
/**
|
/**
|
||||||
* Generate cards in shop.
|
* Generate cards in shop.
|
||||||
*/
|
*/
|
||||||
private final FormatUtils formats = Singletons.getModel().getFormats();
|
private final FormatCollection formats = Singletons.getModel().getFormats();
|
||||||
private final Predicate<CardEdition> filterExt = CardEdition.Predicates.isLegalInFormat(this.formats.getExtended());
|
private final Predicate<CardEdition> filterExt = CardEdition.Predicates.isLegalInFormat(this.formats.getExtended());
|
||||||
|
|
||||||
/** The filter t2booster. */
|
/** The filter t2booster. */
|
||||||
@@ -342,7 +342,7 @@ public final class QuestUtilCards {
|
|||||||
final Predicate<CardEdition> filter = rollD100 < 40 ? this.filterT2booster
|
final Predicate<CardEdition> filter = rollD100 < 40 ? this.filterT2booster
|
||||||
: (rollD100 < 75 ? this.filterExtButT2 : this.filterNotExt);
|
: (rollD100 < 75 ? this.filterExtButT2 : this.filterNotExt);
|
||||||
this.q.getShopList().addAllFlat(
|
this.q.getShopList().addAllFlat(
|
||||||
filter.random(Singletons.getModel().getEditions().getAllSets(), 1, BoosterPack.FN_FROM_SET));
|
filter.random(Singletons.getModel().getEditions(), 1, BoosterPack.FN_FROM_SET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import java.util.Map;
|
|||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id: DeckManager.java 13590 2012-01-27 20:46:27Z Max mtg $
|
* @version $Id: DeckManager.java 13590 2012-01-27 20:46:27Z Max mtg $
|
||||||
*/
|
*/
|
||||||
public class FolderMapView<T extends IHasName> implements Iterable<T>, IFolderMapView<T> {
|
public class FolderMapView<T> implements Iterable<T>, IFolderMapView<T> {
|
||||||
private final Map<String, T> map;
|
private final Map<String, T> map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,7 +52,7 @@ public class FolderMapView<T extends IHasName> implements Iterable<T>, IFolderMa
|
|||||||
* @see forge.deck.IFolderMapView#get(java.lang.String)
|
* @see forge.deck.IFolderMapView#get(java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final T get(final String name) {
|
public T get(final String name) {
|
||||||
return this.map.get(name);
|
return this.map.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,4 +89,12 @@ public class FolderMapView<T extends IHasName> implements Iterable<T>, IFolderMa
|
|||||||
public Iterator<T> iterator() {
|
public Iterator<T> iterator() {
|
||||||
return this.map.values().iterator();
|
return this.map.values().iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see forge.util.IFolderMapView#any(java.lang.String)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean any(String name) {
|
||||||
|
return this.map.containsKey(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import java.util.Collection;
|
|||||||
*
|
*
|
||||||
* @param <T> the generic type
|
* @param <T> the generic type
|
||||||
*/
|
*/
|
||||||
public interface IFolderMapView<T extends IHasName> extends Iterable<T> {
|
public interface IFolderMapView<T> extends Iterable<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -42,5 +42,7 @@ public interface IFolderMapView<T extends IHasName> extends Iterable<T> {
|
|||||||
* @return a ArrayList<String>
|
* @return a ArrayList<String>
|
||||||
*/
|
*/
|
||||||
Collection<String> getNames();
|
Collection<String> getNames();
|
||||||
|
|
||||||
|
boolean any(final String name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @param <T> the generic type
|
* @param <T> the generic type
|
||||||
*/
|
*/
|
||||||
public interface IItemReader<T extends IHasName> {
|
public interface IItemReader<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read all.
|
* Read all.
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ package forge.util;
|
|||||||
*
|
*
|
||||||
* @param <T> the generic type
|
* @param <T> the generic type
|
||||||
*/
|
*/
|
||||||
public interface IItemSerializer<T extends IHasName> extends IItemReader<T> {
|
public interface IItemSerializer<T> extends IItemReader<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save.
|
* Save.
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
|
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,25 +33,25 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
*
|
*
|
||||||
* @param <T> the generic type
|
* @param <T> the generic type
|
||||||
*/
|
*/
|
||||||
public abstract class StorageReaderFile<T extends IHasName> implements IItemReader<T> {
|
public abstract class StorageReaderFile<T> implements IItemReader<T> {
|
||||||
|
|
||||||
private final File file;
|
private final File file;
|
||||||
|
private final Lambda1<String,T> keySelector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new storage reader file.
|
* Instantiates a new storage reader file.
|
||||||
*
|
*
|
||||||
* @param file0 the file0
|
* @param file0 the file0
|
||||||
*/
|
*/
|
||||||
public StorageReaderFile(final File file0) {
|
public StorageReaderFile(final String pathname, Lambda1<String,T> keySelector0) {
|
||||||
this.file = file0;
|
this(new File(pathname), keySelector0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// only accepts numbers, letters or dashes up to 20 characters in length
|
|
||||||
/**
|
public StorageReaderFile(final File file0, Lambda1<String,T> keySelector0) {
|
||||||
* Clean deck name.
|
this.file = file0;
|
||||||
*
|
keySelector = keySelector0;
|
||||||
* @return a String
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, T> readAll() {
|
public Map<String, T> readAll() {
|
||||||
@@ -69,7 +71,7 @@ public abstract class StorageReaderFile<T extends IHasName> implements IItemRead
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.put(item.getName(), item);
|
result.put(keySelector.apply(item), item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
|
import net.slightlymagic.braids.util.lambda.Lambda1;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import forge.deck.io.OldDeckFileFormatException;
|
import forge.deck.io.OldDeckFileFormatException;
|
||||||
@@ -40,9 +42,10 @@ import forge.error.ErrorViewer;
|
|||||||
*
|
*
|
||||||
* @param <T> the generic type
|
* @param <T> the generic type
|
||||||
*/
|
*/
|
||||||
public abstract class StorageReaderFolder<T extends IHasName> implements IItemReader<T> {
|
public abstract class StorageReaderFolder<T> implements IItemReader<T> {
|
||||||
|
|
||||||
private final File directory;
|
private final File directory;
|
||||||
|
private final Lambda1<String,T> keySelector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the directory.
|
* Gets the directory.
|
||||||
@@ -58,9 +61,10 @@ public abstract class StorageReaderFolder<T extends IHasName> implements IItemRe
|
|||||||
*
|
*
|
||||||
* @param deckDir0 the deck dir0
|
* @param deckDir0 the deck dir0
|
||||||
*/
|
*/
|
||||||
public StorageReaderFolder(final File deckDir0) {
|
public StorageReaderFolder(final File deckDir0, Lambda1<String,T> keySelector0) {
|
||||||
|
|
||||||
this.directory = deckDir0;
|
this.directory = deckDir0;
|
||||||
|
keySelector = keySelector0;
|
||||||
|
|
||||||
if (this.directory == null) {
|
if (this.directory == null) {
|
||||||
throw new IllegalArgumentException("No deck directory specified");
|
throw new IllegalArgumentException("No deck directory specified");
|
||||||
@@ -99,7 +103,7 @@ public abstract class StorageReaderFolder<T extends IHasName> implements IItemRe
|
|||||||
JOptionPane.showMessageDialog(null, msg);
|
JOptionPane.showMessageDialog(null, msg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result.put(newDeck.getName(), newDeck);
|
result.put(keySelector.apply(newDeck), newDeck);
|
||||||
} catch (final OldDeckFileFormatException ex) {
|
} catch (final OldDeckFileFormatException ex) {
|
||||||
if (!hasWarnedOfOldFormat) {
|
if (!hasWarnedOfOldFormat) {
|
||||||
JOptionPane
|
JOptionPane
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ import javax.swing.ImageIcon;
|
|||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
|
|
||||||
|
import net.slightlymagic.braids.util.UtilFunctions;
|
||||||
|
|
||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
@@ -518,8 +520,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void awardBooster() {
|
private void awardBooster() {
|
||||||
final GameFormat[] emptyFormatArray = {};
|
final GameFormat[] formats = UtilFunctions.iteratorToArray(Singletons.getModel().getFormats().iterator(), new GameFormat[]{});
|
||||||
final GameFormat[] formats = Singletons.getModel().getFormats().getFormats().toArray(emptyFormatArray);
|
|
||||||
final ListChooser<GameFormat> ch = new ListChooser<GameFormat>("Choose bonus booster format", 1, formats);
|
final ListChooser<GameFormat> ch = new ListChooser<GameFormat>("Choose bonus booster format", 1, formats);
|
||||||
|
|
||||||
String prefferedFormat = Singletons.getModel().getQuestPreferences().getPreference(QPref.BOOSTER_FORMAT);
|
String prefferedFormat = Singletons.getModel().getQuestPreferences().getPreference(QPref.BOOSTER_FORMAT);
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public final class UtilFunctions {
|
|||||||
*
|
*
|
||||||
* @return an array of (the rest of) the iterator's values
|
* @return an array of (the rest of) the iterator's values
|
||||||
*/
|
*/
|
||||||
public static <T> T[] iteratorToArray(final Iterator<T> iter) {
|
public static <T> T[] iteratorToArray(final Iterator<T> iter, T[] destArray) {
|
||||||
final ArrayList<T> list = new ArrayList<T>();
|
final ArrayList<T> list = new ArrayList<T>();
|
||||||
|
|
||||||
T item;
|
T item;
|
||||||
@@ -132,8 +132,7 @@ public final class UtilFunctions {
|
|||||||
list.add(item);
|
list.add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
final T[] result = list.toArray(destArray);
|
||||||
final T[] result = (T[]) list.toArray();
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class BoosterDraftTest implements IBoosterDraft {
|
|||||||
@Override
|
@Override
|
||||||
public ItemPoolView<CardPrinted> nextChoice() {
|
public ItemPoolView<CardPrinted> nextChoice() {
|
||||||
this.n--;
|
this.n--;
|
||||||
final BoosterGenerator pack = new BoosterGenerator(Singletons.getModel().getEditions().getEditionByCode("M11"));
|
final BoosterGenerator pack = new BoosterGenerator(Singletons.getModel().getBoosters().get("M11"));
|
||||||
return ItemPool.createFrom(pack.getBoosterPack(), CardPrinted.class);
|
return ItemPool.createFrom(pack.getBoosterPack(), CardPrinted.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user