mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
- Fixed a bug in booster generator that caused the foil from a wrong print sheet to be generated for sets that did not have a foil always in common slot.
This commit is contained in:
@@ -71,6 +71,7 @@ public class BoosterGenerator {
|
||||
|
||||
CardEdition edition = StaticData.instance().getEditions().get(template.getEdition());
|
||||
boolean hasFoil = edition != null && MyRandom.getRandom().nextInt(10000) <= edition.getFoilChanceInBooster() && edition.getFoilType() != FoilType.NOT_SUPPORTED; // FoilChanceInBooster is given with 1/10000th precision for a closer 1:6 (16.67%) approximation.
|
||||
boolean foilAlwaysCommon = !hasFoil ? false : edition.getFoilAlwaysInCommonSlot();
|
||||
String foilSlot = !hasFoil ? null : edition.getFoilAlwaysInCommonSlot() ? BoosterSlots.COMMON : Aggregates.random(template.getSlots()).getKey();
|
||||
|
||||
for(Pair<String, Integer> slot : template.getSlots()) {
|
||||
@@ -87,9 +88,13 @@ public class BoosterGenerator {
|
||||
PrintSheet ps = getPrintSheet(sheetKey);
|
||||
result.addAll(ps.random(numCards, true));
|
||||
sheetsUsed.add(ps);
|
||||
|
||||
if (hasFoil && !foilAlwaysCommon && slotType.equals(foilSlot)) {
|
||||
result.add(generateFoilCard(ps));
|
||||
}
|
||||
}
|
||||
|
||||
if (hasFoil) {
|
||||
if (hasFoil && foilAlwaysCommon) {
|
||||
PrintSheet foilSheet = Aggregates.random(sheetsUsed);
|
||||
result.add(generateFoilCard(foilSheet));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user