- 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:
Agetian
2014-02-10 07:38:13 +00:00
parent bd5471cb30
commit 485aa06339
3 changed files with 3 additions and 12 deletions

View File

@@ -61,7 +61,7 @@ public class BoosterGenerator {
List<PrintSheet> sheetsUsed = new ArrayList<PrintSheet>(); List<PrintSheet> sheetsUsed = new ArrayList<PrintSheet>();
CardEdition edition = StaticData.instance().getEditions().get(template.getEdition()); 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(); boolean commonSlotFoil = !hasFoil ? false : edition.getFoilAlwaysInCommonSlot();
String foilSlot = !hasFoil ? null : edition.getFoilAlwaysInCommonSlot() ? BoosterSlots.COMMON : Aggregates.random(template.getSlots()).getKey(); String foilSlot = !hasFoil ? null : edition.getFoilAlwaysInCommonSlot() ? BoosterSlots.COMMON : Aggregates.random(template.getSlots()).getKey();

View File

@@ -30,7 +30,6 @@ import forge.util.Aggregates;
import forge.util.FileSection; import forge.util.FileSection;
import forge.util.FileUtil; import forge.util.FileUtil;
import forge.util.IItemReader; import forge.util.IItemReader;
import forge.util.TextUtil;
import forge.util.storage.StorageBase; import forge.util.storage.StorageBase;
import forge.util.storage.StorageReaderBase; import forge.util.storage.StorageReaderBase;
import forge.util.storage.StorageReaderFolder; import forge.util.storage.StorageReaderFolder;
@@ -287,15 +286,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
res.foilType = FoilType.NOT_SUPPORTED; res.foilType = FoilType.NOT_SUPPORTED;
break; break;
} }
res.foilChanceInBooster = section.getInt("FoilChanceInBooster", 2143); // uses 1:10000 precision, 21.43% is roughly every 70th card foiled
// 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.foilAlwaysInCommonSlot = section.getBoolean("FoilAlwaysInCommonSlot", false); res.foilAlwaysInCommonSlot = section.getBoolean("FoilAlwaysInCommonSlot", false);
return res; return res;

View File

@@ -5,7 +5,7 @@ Date=2013-06-07
Type=Reprint Type=Reprint
BoosterCovers=3 BoosterCovers=3
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 Any Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 Any
FoilChanceInBooster=1:1 FoilChanceInBooster=10000
[cards] [cards]
R Adarkar Valkyrie R Adarkar Valkyrie