From 6a0d7cd326b6a05316e7d067c0bbf68fb09b1b5c Mon Sep 17 00:00:00 2001 From: Agetian Date: Sat, 18 Jun 2016 10:11:33 +0000 Subject: [PATCH] - 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. --- forge-gui/src/main/java/forge/quest/QuestEventDraft.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/forge-gui/src/main/java/forge/quest/QuestEventDraft.java b/forge-gui/src/main/java/forge/quest/QuestEventDraft.java index 8ba885a0194..1880c7910d1 100644 --- a/forge-gui/src/main/java/forge/quest/QuestEventDraft.java +++ b/forge-gui/src/main/java/forge/quest/QuestEventDraft.java @@ -881,6 +881,10 @@ public class QuestEventDraft { } } else { final List 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); 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."); } - 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 set1 = allowedSets.get(1); if (allowedSets.size() == 2) {