mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Added generation of Zendikar Expeditions foils in BFZ booster packs.
This commit is contained in:
@@ -70,6 +70,7 @@ public class BoosterGenerator {
|
||||
boolean hasFoil = edition != null && !template.getSlots().isEmpty() && MyRandom.getRandom().nextDouble() < edition.getFoilChanceInBooster() && edition.getFoilType() != FoilType.NOT_SUPPORTED;
|
||||
boolean foilAtEndOfPack = hasFoil && edition.getFoilAlwaysInCommonSlot();
|
||||
String foilSlot = !hasFoil ? null : foilAtEndOfPack ? BoosterSlots.COMMON : Aggregates.random(template.getSlots()).getKey();
|
||||
String extraFoilSheetKey = edition != null ? edition.getAdditionalSheetForFoils() : "";
|
||||
|
||||
for(Pair<String, Integer> slot : template.getSlots()) {
|
||||
String slotType = slot.getLeft(); // add expansion symbol here?
|
||||
@@ -88,7 +89,18 @@ public class BoosterGenerator {
|
||||
sheetsUsed.add(ps);
|
||||
|
||||
if (foilInThisSlot && !foilAtEndOfPack) {
|
||||
result.add(generateFoilCard(ps));
|
||||
if (!extraFoilSheetKey.isEmpty()) {
|
||||
List<PaperCard> foilCards = new ArrayList<>();
|
||||
for (PaperCard card : ps.toFlatList()) {
|
||||
if (!foilCards.contains(card)) {
|
||||
foilCards.add(card);
|
||||
}
|
||||
}
|
||||
addCardsFromExtraSheet(foilCards, sheetKey);
|
||||
result.add(generateFoilCard(foilCards));
|
||||
} else {
|
||||
result.add(generateFoilCard(ps));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,12 +113,24 @@ public class BoosterGenerator {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!extraFoilSheetKey.isEmpty()) {
|
||||
addCardsFromExtraSheet(foilCards, extraFoilSheetKey);
|
||||
}
|
||||
result.add(generateFoilCard(foilCards));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void addCardsFromExtraSheet(List<PaperCard> dest, String printSheetKey) {
|
||||
PrintSheet extraSheet = getPrintSheet(printSheetKey);
|
||||
for (PaperCard card : extraSheet.toFlatList()) {
|
||||
if (!dest.contains(card)) {
|
||||
dest.add(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static PrintSheet makeSheet(String sheetKey, Iterable<PaperCard> src) {
|
||||
|
||||
|
||||
@@ -105,6 +105,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
||||
private FoilType foilType = FoilType.NOT_SUPPORTED;
|
||||
private double foilChanceInBooster = 0;
|
||||
private boolean foilAlwaysInCommonSlot = false;
|
||||
private String additionalSheetForFoils = "";
|
||||
private final CardInSet[] cards;
|
||||
|
||||
|
||||
@@ -157,6 +158,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
||||
public FoilType getFoilType() { return foilType; }
|
||||
public double getFoilChanceInBooster() { return foilChanceInBooster; }
|
||||
public boolean getFoilAlwaysInCommonSlot() { return foilAlwaysInCommonSlot; }
|
||||
public String getAdditionalSheetForFoils() { return additionalSheetForFoils; }
|
||||
public CardInSet[] getCards() { return cards; }
|
||||
|
||||
/** The Constant fnGetName. */
|
||||
@@ -291,6 +293,8 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
||||
res.foilChanceInBooster = section.getDouble("FoilChanceInBooster", 21.43F) / 100.0F;
|
||||
res.foilAlwaysInCommonSlot = section.getBoolean("FoilAlwaysInCommonSlot", true);
|
||||
|
||||
res.additionalSheetForFoils = section.get("AdditionalSheetForFoils", "");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user