mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Do not add guaranteed legendary cards to Dominaria boosters from the ones that are reserved for Planeswalker decks.
This commit is contained in:
@@ -329,13 +329,13 @@ public class BoosterGenerator {
|
|||||||
// Guaranteed cards, e.g. Dominaria guaranteed legendary creatures
|
// Guaranteed cards, e.g. Dominaria guaranteed legendary creatures
|
||||||
String boosterMustContain = edition.getBoosterMustContain();
|
String boosterMustContain = edition.getBoosterMustContain();
|
||||||
if (!boosterMustContain.isEmpty()) {
|
if (!boosterMustContain.isEmpty()) {
|
||||||
ensureGuaranteedCardInBooster(result, edition, boosterMustContain);
|
ensureGuaranteedCardInBooster(result, template, boosterMustContain);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ensureGuaranteedCardInBooster(List<PaperCard> result, CardEdition edition, String boosterMustContain) {
|
private static void ensureGuaranteedCardInBooster(List<PaperCard> result, SealedProduct.Template template, String boosterMustContain) {
|
||||||
// First, see if there's already a card of the given type
|
// First, see if there's already a card of the given type
|
||||||
String[] types = TextUtil.split(boosterMustContain, ' ');
|
String[] types = TextUtil.split(boosterMustContain, ' ');
|
||||||
boolean alreadyHaveCard = false;
|
boolean alreadyHaveCard = false;
|
||||||
@@ -356,17 +356,26 @@ public class BoosterGenerator {
|
|||||||
if (!alreadyHaveCard) {
|
if (!alreadyHaveCard) {
|
||||||
// Create a list of all cards that match the criteria
|
// Create a list of all cards that match the criteria
|
||||||
List<PaperCard> possibleCards = Lists.newArrayList();
|
List<PaperCard> possibleCards = Lists.newArrayList();
|
||||||
for (CardEdition.CardInSet card : edition.getCards()) {
|
for (Pair<String, Integer> slot : template.getSlots()) {
|
||||||
PaperCard pc = StaticData.instance().getCommonCards().getCard(card.name, edition.getCode());
|
String slotType = slot.getLeft();
|
||||||
boolean cardHasAllTypes = true;
|
String setCode = template.getEdition();
|
||||||
for (String type : types) {
|
String sheetKey = StaticData.instance().getEditions().contains(setCode) ? slotType.trim() + " " + setCode
|
||||||
if (!pc.getRules().getType().hasStringType(type)) {
|
: slotType.trim();
|
||||||
cardHasAllTypes = false;
|
|
||||||
break;
|
PrintSheet ps = getPrintSheet(sheetKey);
|
||||||
|
List<PaperCard> cardsInSlot = Lists.newArrayList(ps.toFlatList());
|
||||||
|
|
||||||
|
for (PaperCard pc : cardsInSlot) {
|
||||||
|
boolean cardHasAllTypes = true;
|
||||||
|
for (String type : types) {
|
||||||
|
if (!pc.getRules().getType().hasStringType(type)) {
|
||||||
|
cardHasAllTypes = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cardHasAllTypes && !possibleCards.contains(pc)) {
|
||||||
|
possibleCards.add(pc);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (cardHasAllTypes) {
|
|
||||||
possibleCards.add(pc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user