- 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:
Agetian
2014-02-09 04:41:54 +00:00
parent a8e54c5052
commit 1fa0a2c81c

View File

@@ -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));
}