mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Merge branch 'booster-guarantee-special-printsheet-slot' into 'master'
Adding BoosterReplaceSlotFromPrintSheet logic, fixing ZNR booster collation Closes #1600 See merge request core-developers/forge!3236
This commit is contained in:
@@ -123,6 +123,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
private String additionalUnlockSet = "";
|
private String additionalUnlockSet = "";
|
||||||
private boolean smallSetOverride = false;
|
private boolean smallSetOverride = false;
|
||||||
private String boosterMustContain = "";
|
private String boosterMustContain = "";
|
||||||
|
private String boosterReplaceSlotFromPrintSheet = "";
|
||||||
private boolean doublePickToStartRound = false;
|
private boolean doublePickToStartRound = false;
|
||||||
private final CardInSet[] cards;
|
private final CardInSet[] cards;
|
||||||
private final Map<String, Integer> tokenNormalized;
|
private final Map<String, Integer> tokenNormalized;
|
||||||
@@ -193,6 +194,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
public boolean getSmallSetOverride() { return smallSetOverride; }
|
public boolean getSmallSetOverride() { return smallSetOverride; }
|
||||||
public boolean getDoublePickToStartRound() { return doublePickToStartRound; }
|
public boolean getDoublePickToStartRound() { return doublePickToStartRound; }
|
||||||
public String getBoosterMustContain() { return boosterMustContain; }
|
public String getBoosterMustContain() { return boosterMustContain; }
|
||||||
|
public String getBoosterReplaceSlotFromPrintSheet() { return boosterReplaceSlotFromPrintSheet; }
|
||||||
public CardInSet[] getCards() { return cards; }
|
public CardInSet[] getCards() { return cards; }
|
||||||
public boolean isModern() { return getDate().after(parseDate("2003-07-27")); } //8ED and above are modern except some promo cards and others
|
public boolean isModern() { return getDate().after(parseDate("2003-07-27")); } //8ED and above are modern except some promo cards and others
|
||||||
|
|
||||||
@@ -382,6 +384,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
|||||||
res.doublePickToStartRound = section.getBoolean("DoublePick", false); // for "small" sets with over 200 cards (e.g. Eldritch Moon)
|
res.doublePickToStartRound = section.getBoolean("DoublePick", false); // for "small" sets with over 200 cards (e.g. Eldritch Moon)
|
||||||
|
|
||||||
res.boosterMustContain = section.get("BoosterMustContain", ""); // e.g. Dominaria guaranteed legendary creature
|
res.boosterMustContain = section.get("BoosterMustContain", ""); // e.g. Dominaria guaranteed legendary creature
|
||||||
|
res.boosterReplaceSlotFromPrintSheet = section.get("BoosterReplaceSlotFromPrintSheet", ""); // e.g. Zendikar Rising guaranteed double-faced card
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -339,6 +339,11 @@ public class BoosterGenerator {
|
|||||||
if (!boosterMustContain.isEmpty()) {
|
if (!boosterMustContain.isEmpty()) {
|
||||||
ensureGuaranteedCardInBooster(result, template, boosterMustContain);
|
ensureGuaranteedCardInBooster(result, template, boosterMustContain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String boosterReplaceSlotFromPrintSheet = edition.getBoosterReplaceSlotFromPrintSheet();
|
||||||
|
if(!boosterReplaceSlotFromPrintSheet.isEmpty()) {
|
||||||
|
replaceCardFromExtraSheet(result, boosterReplaceSlotFromPrintSheet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -390,27 +395,69 @@ public class BoosterGenerator {
|
|||||||
|
|
||||||
if (!possibleCards.isEmpty()) {
|
if (!possibleCards.isEmpty()) {
|
||||||
PaperCard toAdd = Aggregates.random(possibleCards);
|
PaperCard toAdd = Aggregates.random(possibleCards);
|
||||||
PaperCard toRepl = null;
|
BoosterGenerator.replaceCard(result, toAdd);
|
||||||
CardRarity tgtRarity = toAdd.getRarity();
|
|
||||||
|
|
||||||
// remove the first card of the same rarity, replace it with toAdd. Keep the foil state.
|
|
||||||
for (PaperCard repl : result) {
|
|
||||||
if (repl.getRarity() == tgtRarity) {
|
|
||||||
toRepl = repl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (toRepl != null) {
|
|
||||||
if (toRepl.isFoil()) {
|
|
||||||
toAdd = StaticData.instance().getCommonCards().getFoiled(toAdd);
|
|
||||||
}
|
|
||||||
result.remove(toRepl);
|
|
||||||
result.add(toAdd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces an already present card in the booster with a card from the supplied print sheet.
|
||||||
|
* Nothing is replaced if there is no matching rarity found.
|
||||||
|
* @param booster in which a card gets replaced
|
||||||
|
* @param printSheetKey
|
||||||
|
*/
|
||||||
|
public static void replaceCardFromExtraSheet(List<PaperCard> booster, String printSheetKey) {
|
||||||
|
PrintSheet replacementSheet = StaticData.instance().getPrintSheets().get(printSheetKey);
|
||||||
|
PaperCard toAdd = replacementSheet.random(1, false).get(0);
|
||||||
|
BoosterGenerator.replaceCard(booster, toAdd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces an already present card with the supplied card of the same (or similar in case or rare/mythic)
|
||||||
|
* rarity in the supplied booster. Nothing is replaced if there is no matching rarity found.
|
||||||
|
* @param booster in which a card gets replaced
|
||||||
|
* @param toAdd new card which replaces a card in the booster
|
||||||
|
*/
|
||||||
|
public static void replaceCard(List<PaperCard> booster, PaperCard toAdd) {
|
||||||
|
Predicate<PaperCard> rarityPredicate = null;
|
||||||
|
switch(toAdd.getRarity()){
|
||||||
|
case BasicLand:
|
||||||
|
rarityPredicate = Presets.IS_BASIC_LAND;
|
||||||
|
break;
|
||||||
|
case Common:
|
||||||
|
rarityPredicate = Presets.IS_COMMON;
|
||||||
|
break;
|
||||||
|
case Uncommon:
|
||||||
|
rarityPredicate = Presets.IS_UNCOMMON;
|
||||||
|
break;
|
||||||
|
case Rare:
|
||||||
|
case MythicRare:
|
||||||
|
rarityPredicate = Presets.IS_RARE_OR_MYTHIC;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rarityPredicate = Presets.IS_SPECIAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
PaperCard toReplace = null;
|
||||||
|
// Find first card in booster that matches the rarity
|
||||||
|
for (PaperCard card : booster) {
|
||||||
|
if(rarityPredicate.apply(card)) {
|
||||||
|
toReplace = card;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace card if match is found
|
||||||
|
if (toReplace != null) {
|
||||||
|
// Keep the foil state
|
||||||
|
if (toReplace.isFoil()) {
|
||||||
|
toAdd = StaticData.instance().getCommonCards().getFoiled(toAdd);
|
||||||
|
}
|
||||||
|
booster.remove(toReplace);
|
||||||
|
booster.add(toAdd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void addCardsFromExtraSheet(List<PaperCard> dest, String printSheetKey) {
|
public static void addCardsFromExtraSheet(List<PaperCard> dest, String printSheetKey) {
|
||||||
PrintSheet extraSheet = getPrintSheet(printSheetKey);
|
PrintSheet extraSheet = getPrintSheet(printSheetKey);
|
||||||
|
|
||||||
|
|||||||
@@ -6130,3 +6130,41 @@ Bloodchief's Thirst|ZNR|2
|
|||||||
Roil Eruption|ZNR|2
|
Roil Eruption|ZNR|2
|
||||||
Roiling Regrowth|ZNR|2
|
Roiling Regrowth|ZNR|2
|
||||||
Kargan Warleader|ZNR|2
|
Kargan Warleader|ZNR|2
|
||||||
|
|
||||||
|
[ZNRModalDoubleFaceCards]
|
||||||
|
1 Agadeem's Awakening|ZNR
|
||||||
|
1 Emeria's Call|ZNR
|
||||||
|
1 Sea Gate Restoration|ZNR
|
||||||
|
1 Shatterskull Smashing|ZNR
|
||||||
|
1 Turntimber Symbiosis|ZNR
|
||||||
|
2 Branchloft Pathway|ZNR
|
||||||
|
2 Brightclimb Pathway|ZNR
|
||||||
|
2 Clearwater Pathway|ZNR
|
||||||
|
2 Cragcrown Pathway|ZNR
|
||||||
|
2 Glasspool Mimic|ZNR
|
||||||
|
2 Hagra Mauling|ZNR
|
||||||
|
2 Kazandu Mammoth|ZNR
|
||||||
|
2 Needleverge Pathway|ZNR
|
||||||
|
2 Ondu Inversion|ZNR
|
||||||
|
2 Riverglide Pathway|ZNR
|
||||||
|
2 Valakut Awakening|ZNR
|
||||||
|
6 Akoum Warrior|ZNR
|
||||||
|
6 Bala Ged Recovery|ZNR
|
||||||
|
6 Beyeen Veil|ZNR
|
||||||
|
6 Blackbloom Rogue|ZNR
|
||||||
|
6 Jwari Disruption|ZNR
|
||||||
|
6 Kabira Takedown|ZNR
|
||||||
|
6 Kazuul's Fury|ZNR
|
||||||
|
6 Khalni Ambush|ZNR
|
||||||
|
6 Makindi Stampede|ZNR
|
||||||
|
6 Malakir Rebirth|ZNR
|
||||||
|
6 Pelakka Predation|ZNR
|
||||||
|
6 Sejiri Shelter|ZNR
|
||||||
|
6 Silundi Vision|ZNR
|
||||||
|
6 Skyclave Cleric|ZNR
|
||||||
|
6 Song-Mad Treachery|ZNR
|
||||||
|
6 Spikefield Hazard|ZNR
|
||||||
|
6 Tangled Florahedron|ZNR
|
||||||
|
6 Umara Wizard|ZNR
|
||||||
|
6 Vastwood Fortification|ZNR
|
||||||
|
6 Zof Consumption|ZNR
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ Code2=ZNR
|
|||||||
MciCode=znr
|
MciCode=znr
|
||||||
Type=Expansion
|
Type=Expansion
|
||||||
BoosterCovers=3
|
BoosterCovers=3
|
||||||
Booster=9 Common:!dfc:!fromSheet("ZNR Secret Cards"), 3 Uncommon:!dfc:!fromSheet("ZNR Secret Cards"), 1 RareMythic:!dfc:!fromSheet("ZNR Secret Cards"), 1 dfc:!fromSheet("ZNR Secret Cards"), 1 BasicLand
|
Booster=10 Common:!dfc:!fromSheet("ZNR Secret Cards"), 3 Uncommon:!dfc:!fromSheet("ZNR Secret Cards"), 1 RareMythic:!dfc:!fromSheet("ZNR Secret Cards"), 1 BasicLand
|
||||||
|
BoosterReplaceSlotFromPrintSheet=ZNRModalDoubleFaceCards
|
||||||
Prerelease=6 Boosters, 1 RareMythic+
|
Prerelease=6 Boosters, 1 RareMythic+
|
||||||
|
|
||||||
[cards]
|
[cards]
|
||||||
|
|||||||
Reference in New Issue
Block a user