- Do not add guaranteed legendary cards to Dominaria boosters from the ones that are reserved for Planeswalker decks.

This commit is contained in:
Agetian
2018-04-23 22:27:21 +03:00
parent 75d6ea6537
commit 2b34c68057

View File

@@ -329,13 +329,13 @@ public class BoosterGenerator {
// Guaranteed cards, e.g. Dominaria guaranteed legendary creatures
String boosterMustContain = edition.getBoosterMustContain();
if (!boosterMustContain.isEmpty()) {
ensureGuaranteedCardInBooster(result, edition, boosterMustContain);
ensureGuaranteedCardInBooster(result, template, boosterMustContain);
}
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
String[] types = TextUtil.split(boosterMustContain, ' ');
boolean alreadyHaveCard = false;
@@ -356,8 +356,16 @@ public class BoosterGenerator {
if (!alreadyHaveCard) {
// Create a list of all cards that match the criteria
List<PaperCard> possibleCards = Lists.newArrayList();
for (CardEdition.CardInSet card : edition.getCards()) {
PaperCard pc = StaticData.instance().getCommonCards().getCard(card.name, edition.getCode());
for (Pair<String, Integer> slot : template.getSlots()) {
String slotType = slot.getLeft();
String setCode = template.getEdition();
String sheetKey = StaticData.instance().getEditions().contains(setCode) ? slotType.trim() + " " + setCode
: slotType.trim();
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)) {
@@ -365,10 +373,11 @@ public class BoosterGenerator {
break;
}
}
if (cardHasAllTypes) {
if (cardHasAllTypes && !possibleCards.contains(pc)) {
possibleCards.add(pc);
}
}
}
if (!possibleCards.isEmpty()) {
PaperCard toAdd = Aggregates.random(possibleCards);