From e73bca72b6ed455c0ca878bfacf9c41a9b72a0c9 Mon Sep 17 00:00:00 2001 From: friarsol Date: Sun, 21 Feb 2021 21:38:59 -0500 Subject: [PATCH] Fix defaults booster box counts for certain edition types --- .../src/main/java/forge/card/CardEdition.java | 14 ++++++++++++-- .../src/main/java/forge/item/SealedProduct.java | 4 +++- forge-gui/res/editions/Mystery Booster.txt | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/forge-core/src/main/java/forge/card/CardEdition.java b/forge-core/src/main/java/forge/card/CardEdition.java index d4ad4ff0058..93cf968eaa5 100644 --- a/forge-core/src/main/java/forge/card/CardEdition.java +++ b/forge-core/src/main/java/forge/card/CardEdition.java @@ -65,7 +65,17 @@ public final class CardEdition implements Comparable { // 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 { // 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": diff --git a/forge-core/src/main/java/forge/item/SealedProduct.java b/forge-core/src/main/java/forge/item/SealedProduct.java index 0e1406c2192..fb9e48c6945 100644 --- a/forge-core/src/main/java/forge/item/SealedProduct.java +++ b/forge-core/src/main/java/forge/item/SealedProduct.java @@ -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(); diff --git a/forge-gui/res/editions/Mystery Booster.txt b/forge-gui/res/editions/Mystery Booster.txt index da3a7a87c2d..9076618b666 100644 --- a/forge-gui/res/editions/Mystery Booster.txt +++ b/forge-gui/res/editions/Mystery Booster.txt @@ -6,6 +6,7 @@ Type=Reprint BoosterCovers=1 Booster=2 fromSheet("MB1 White CommonUncommon"), 2 fromSheet("MB1 Blue CommonUncommon"), 2 fromSheet("MB1 Black CommonUncommon"), 2 fromSheet("MB1 Green CommonUncommon"), 2 fromSheet("MB1 Red CommonUncommon"), 1 fromSheet("MB1 Multi CommonUncommon"), 1 fromSheet("MB1 Artifact Land CommonUncommon"), 1 fromSheet("MB1 Pre M15"), 1 fromSheet("MB1 Post M15 RareMythic"), 1 fromSheet("MB1 Foils") Foil=NotSupported +BoosterBox=60 [cards] 1 R All Is Dust