diff --git a/forge-gui/src/main/java/forge/limited/BoosterDraft.java b/forge-gui/src/main/java/forge/limited/BoosterDraft.java index 9b56ec7c369..b23d15fbd39 100644 --- a/forge-gui/src/main/java/forge/limited/BoosterDraft.java +++ b/forge-gui/src/main/java/forge/limited/BoosterDraft.java @@ -179,28 +179,33 @@ public class BoosterDraft implements IBoosterDraft { break; case Chaos: - + /** + * A chaos draft consists of boosters from many different sets. + * Default settings are boosters from all sets with a booster size of 15 cards. + * Alternatively, the sets can be restricted to a format like Modern or to a theme. + * Examples for themes: sets that take place on a certain plane, core sets, masters sets, + * or sets that share a mechanic. + */ + // Get chaos draft themes final List themes = new ArrayList<>(); final IStorage themeStorage = FModel.getThemedChaosDrafts(); - for (final ThemedChaosDraft theme : themeStorage) { themes.add(theme); } - Collections.sort(themes); - + Collections.sort(themes); // sort for user interface + // Ask user to select theme final String dialogQuestion = Localizer.getInstance().getMessage("lblChooseChaosTheme"); final ThemedChaosDraft theme = SGuiChoose.oneOrNone(dialogQuestion, themes); if (theme == null) { - return false; + return false; // abort if no theme is selected } - + // Filter all sets by theme restrictions final Predicate themeFilter = theme.getEditionFilter(); - final CardEdition.Collection allEditions = StaticData.instance().getEditions(); final Iterable chaosDraftEditions = Iterables.filter( allEditions.getOrderedEditions(), themeFilter); - + // Add chaos "boosters" as special suppliers final Supplier> ChaosDraftSupplier; try{ ChaosDraftSupplier = new ChaosBoosterSupplier(chaosDraftEditions); @@ -208,7 +213,6 @@ public class BoosterDraft implements IBoosterDraft { System.out.println(e.getMessage()); return false; } - for (int i = 0; i < 3; i++) { this.product.add(ChaosDraftSupplier); } diff --git a/forge-gui/src/main/java/forge/limited/ThemedChaosDraft.java b/forge-gui/src/main/java/forge/limited/ThemedChaosDraft.java index 1cf8aedcf30..1b207167087 100644 --- a/forge-gui/src/main/java/forge/limited/ThemedChaosDraft.java +++ b/forge-gui/src/main/java/forge/limited/ThemedChaosDraft.java @@ -46,6 +46,9 @@ public class ThemedChaosDraft implements Comparable { */ public int getOrderNumber() { return orderNumber; } + /** + * @return Predicate to sort out editions not belonging to the chaos draft theme + */ public Predicate getEditionFilter() { Predicate filter; switch(tag) { @@ -63,6 +66,10 @@ public class ThemedChaosDraft implements Comparable { return filter; } + /** + * Filter to select editions by ChaosDraftThemes tag defined in edition files. + * Tag must be defined in res/blockdata/chaosdraftthemes.txt + */ private final Predicate themedFilter = new Predicate() { @Override public boolean apply(final CardEdition cardEdition) { @@ -74,6 +81,10 @@ public class ThemedChaosDraft implements Comparable { } }; + /** + * @param formatName format to filter by, currently supported: MODERN, PIONEER, STANDARD + * @return Filter to select editions belonging to a certain constructed format. + */ private Predicate getFormatFilter(String formatName) { GameFormat.Collection formats = FModel.getFormats(); GameFormat format; @@ -96,6 +107,9 @@ public class ThemedChaosDraft implements Comparable { }; } + /** + * Default filter that only allows actual sets that were printed as 15-card boosters + */ private static final Predicate DEFAULT_FILTER = new Predicate() { @Override public boolean apply(final CardEdition cardEdition) {