Fix defaults booster box counts for certain edition types

This commit is contained in:
friarsol
2021-02-21 21:38:59 -05:00
parent 1d1483185b
commit e73bca72b6
3 changed files with 16 additions and 3 deletions

View File

@@ -65,7 +65,17 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
FROM_THE_VAULT,
OTHER,
THIRDPARTY // custom sets
THIRDPARTY; // custom sets
public String getBoosterBoxDefault() {
switch (this) {
case CORE:
case EXPANSION:
return "36";
default:
return "0";
}
}
}
public enum FoilType {
@@ -457,7 +467,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
}
res.type = enumType;
res.prerelease = section.get("Prerelease", null);
res.boosterBoxCount = Integer.parseInt(section.get("BoosterBox", "36"));
res.boosterBoxCount = Integer.parseInt(section.get("BoosterBox", enumType.getBoosterBoxDefault()));
switch(section.get("foil", "newstyle").toLowerCase()) {
case "notsupported":

View File

@@ -57,7 +57,9 @@ public abstract class SealedProduct implements InventoryItemFromSet {
public SealedProduct(String name0, Template boosterData) {
if (null == name0) { throw new IllegalArgumentException("name0 must not be null"); }
if (null == boosterData) { throw new IllegalArgumentException("boosterData must not be null"); }
if (null == boosterData) {
throw new IllegalArgumentException("boosterData must not be null");
}
contents = boosterData;
name = name0;
hash = name.hashCode() ^ getClass().hashCode() ^ contents.hashCode();