- Prevent a crash when generating a draft tournament with an incomplete block specification (e.g. ICE/ALL for the ICE/ALL/CSP block). Currently allowed only in custom worlds, please revise if necessary.

This commit is contained in:
Agetian
2016-06-18 10:11:33 +00:00
parent 58d88ac2b1
commit 6a0d7cd326

View File

@@ -881,6 +881,10 @@ public class QuestEventDraft {
} }
} else { } else {
final List<String> possibleSetCombinations = new ArrayList<>(getSetCombos(quest, format.block)); final List<String> possibleSetCombinations = new ArrayList<>(getSetCombos(quest, format.block));
if (possibleSetCombinations.isEmpty()) {
System.err.println("Warning: no valid set combinations were detected when trying to generate a draft tournament for the format: " + format);
return null;
}
Collections.shuffle(possibleSetCombinations); Collections.shuffle(possibleSetCombinations);
event.boosterConfiguration = possibleSetCombinations.get(0); event.boosterConfiguration = possibleSetCombinations.get(0);
} }
@@ -1015,7 +1019,8 @@ public class QuestEventDraft {
throw new IllegalStateException(allowedSets + " does not contain a large set for quest draft generation."); throw new IllegalStateException(allowedSets + " does not contain a large set for quest draft generation.");
} }
if (allowedSets.containsAll(sets)) { // FIXME: Currently explicitly allow generation of draft tournaments with irregular (incomplete) blocks for the sake of custom quest worlds
if (allowedSets.containsAll(sets) || !quest.getWorld().getName().toLowerCase().equals("main world")) {
CardEdition set0 = allowedSets.get(0); CardEdition set0 = allowedSets.get(0);
CardEdition set1 = allowedSets.get(1); CardEdition set1 = allowedSets.get(1);
if (allowedSets.size() == 2) { if (allowedSets.size() == 2) {