mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Revert the previous representation of foil chances in booster (doesn't work the way I thought it would).
- Changed the default chance of a foil in booster to 0.2143 (21.43%) which seems to match the official 1 foil per 70 cards more closely.
This commit is contained in:
@@ -61,7 +61,7 @@ public class BoosterGenerator {
|
||||
List<PrintSheet> sheetsUsed = new ArrayList<PrintSheet>();
|
||||
|
||||
CardEdition edition = StaticData.instance().getEditions().get(template.getEdition());
|
||||
boolean hasFoil = edition != null && MyRandom.getRandom().nextInt(10000) <= edition.getFoilChanceInBooster() && edition.getFoilType() != FoilType.NOT_SUPPORTED;
|
||||
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 21.43% approximation.
|
||||
boolean commonSlotFoil = !hasFoil ? false : edition.getFoilAlwaysInCommonSlot();
|
||||
String foilSlot = !hasFoil ? null : edition.getFoilAlwaysInCommonSlot() ? BoosterSlots.COMMON : Aggregates.random(template.getSlots()).getKey();
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import forge.util.Aggregates;
|
||||
import forge.util.FileSection;
|
||||
import forge.util.FileUtil;
|
||||
import forge.util.IItemReader;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.storage.StorageBase;
|
||||
import forge.util.storage.StorageReaderBase;
|
||||
import forge.util.storage.StorageReaderFolder;
|
||||
@@ -287,15 +286,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
||||
res.foilType = FoilType.NOT_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
// Internally foil chance in booster is represented with 1:10000 precision
|
||||
// to represent ratios like 1:6 more accurately (16.67%).
|
||||
String foilChanceInBoosterStr = section.get("FoilChanceInBooster", "1:6");
|
||||
String[] foilChanceElems = TextUtil.split(foilChanceInBoosterStr, ':');
|
||||
int numerator = Integer.parseInt(foilChanceElems[0]);
|
||||
int denominator = Integer.parseInt(foilChanceElems[1]);
|
||||
res.foilChanceInBooster = Math.round((float)numerator / denominator * 10000);
|
||||
|
||||
res.foilChanceInBooster = section.getInt("FoilChanceInBooster", 2143); // uses 1:10000 precision, 21.43% is roughly every 70th card foiled
|
||||
res.foilAlwaysInCommonSlot = section.getBoolean("FoilAlwaysInCommonSlot", false);
|
||||
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user