diff --git a/forge-core/src/main/java/forge/StaticData.java b/forge-core/src/main/java/forge/StaticData.java index 62c7c6a8130..271063d7ce0 100644 --- a/forge-core/src/main/java/forge/StaticData.java +++ b/forge-core/src/main/java/forge/StaticData.java @@ -149,6 +149,7 @@ public class StaticData { } } + // TODO Remove these in favor of them being associated to the Edition /** @return {@link forge.util.storage.IStorage}<{@link forge.item.SealedProduct.Template}> */ public IStorage getFatPacks() { if (fatPacks == null) @@ -156,12 +157,6 @@ public class StaticData { return fatPacks; } - public IStorage getBoosterBoxes() { - if (boosterBoxes == null) - boosterBoxes = new StorageBase<>("Booster boxes", new BoosterBox.Template.Reader(blockDataFolder + "boosterboxes.txt")); - return boosterBoxes; - } - /** @return {@link forge.util.storage.IStorage}<{@link forge.item.SealedProduct.Template}> */ public final IStorage getTournamentPacks() { if (tournaments == null) diff --git a/forge-core/src/main/java/forge/card/CardEdition.java b/forge-core/src/main/java/forge/card/CardEdition.java index da750253449..d4ad4ff0058 100644 --- a/forge-core/src/main/java/forge/card/CardEdition.java +++ b/forge-core/src/main/java/forge/card/CardEdition.java @@ -143,20 +143,26 @@ public final class CardEdition implements Comparable { // immutable private Type type; private String name; private String alias = null; - private String prerelease = null; private boolean whiteBorder = false; + + // SealedProduct + private String prerelease = null; + private int boosterBoxCount = 36; + + // Booster/draft info + private boolean smallSetOverride = false; + private boolean foilAlwaysInCommonSlot = false; private FoilType foilType = FoilType.NOT_SUPPORTED; private double foilChanceInBooster = 0; - private boolean foilAlwaysInCommonSlot = false; private double chanceReplaceCommonWith = 0; private String slotReplaceCommonWith = "Common"; private String additionalSheetForFoils = ""; private String additionalUnlockSet = ""; - private boolean smallSetOverride = false; private String boosterMustContain = ""; private String boosterReplaceSlotFromPrintSheet = ""; - private String[] chaosDraftThemes = new String[0]; private String doublePickDuringDraft = ""; + private String[] chaosDraftThemes = new String[0]; + private final ListMultimap cardMap; private final Map tokenNormalized; // custom print sheets that will be loaded lazily @@ -220,7 +226,10 @@ public final class CardEdition implements Comparable { // immutable public Type getType() { return type; } public String getName() { return name; } public String getAlias() { return alias; } + public String getPrerelease() { return prerelease; } + public int getBoosterBoxCount() { return boosterBoxCount; } + public FoilType getFoilType() { return foilType; } public double getFoilChanceInBooster() { return foilChanceInBooster; } public boolean getFoilAlwaysInCommonSlot() { return foilAlwaysInCommonSlot; } @@ -448,6 +457,7 @@ public final class CardEdition implements Comparable { // immutable } res.type = enumType; res.prerelease = section.get("Prerelease", null); + res.boosterBoxCount = Integer.parseInt(section.get("BoosterBox", "36")); switch(section.get("foil", "newstyle").toLowerCase()) { case "notsupported": @@ -671,7 +681,7 @@ public final class CardEdition implements Comparable { // immutable private static class CanMakeBoosterBox implements Predicate { @Override public boolean apply(final CardEdition subject) { - return StaticData.instance().getBoosterBoxes().contains(subject.getCode()); + return subject.getBoosterBoxCount() > 0; } } diff --git a/forge-core/src/main/java/forge/item/BoosterBox.java b/forge-core/src/main/java/forge/item/BoosterBox.java index 8b3c5e93f51..ea31ab7f8d9 100644 --- a/forge-core/src/main/java/forge/item/BoosterBox.java +++ b/forge-core/src/main/java/forge/item/BoosterBox.java @@ -36,7 +36,10 @@ public class BoosterBox extends BoxedProduct { public static final Function FN_FROM_SET = new Function() { @Override public BoosterBox apply(final CardEdition arg1) { - BoosterBox.Template d = StaticData.instance().getBoosterBoxes().get(arg1.getCode()); + if (arg1.getBoosterBoxCount() <= 0) { + return null; + } + BoosterBox.Template d = new Template(arg1); if (d == null) { return null; } return new BoosterBox(arg1.getName(), d, d.cntBoosters); } @@ -72,40 +75,13 @@ public class BoosterBox extends BoxedProduct { public static class Template extends SealedProduct.Template { private final int cntBoosters; - public int getCntBoosters() { return cntBoosters; } - private Template(String edition, int boosters, Iterable> itrSlots) - { - super(edition, itrSlots); - cntBoosters = boosters; + private Template(CardEdition edition) { + super(edition.getCode(), new ArrayList<>()); + cntBoosters = edition.getBoosterBoxCount(); } - public static final class Reader extends StorageReaderFile