mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Add a feature to be able to Sideboard for the AI
This commit is contained in:
@@ -234,10 +234,10 @@ public class GuiChoose {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T extends Comparable<? super T>> List<T> sideboard(final CMatchUI matchUI, final List<T> sideboard, final List<T> deck) {
|
||||
public static <T extends Comparable<? super T>> List<T> sideboard(final CMatchUI matchUI, final List<T> sideboard, final List<T> deck, final String message) {
|
||||
Collections.sort(deck);
|
||||
Collections.sort(sideboard);
|
||||
return order("Sideboard", "Main Deck", -1, -1, sideboard, deck, null, true, matchUI);
|
||||
return order("Sideboard" + message, "Main Deck", -1, -1, sideboard, deck, null, true, matchUI);
|
||||
}
|
||||
|
||||
public static <T> List<T> order(final String title, final String top, final int remainingObjectsMin, final int remainingObjectsMax,
|
||||
|
||||
@@ -107,6 +107,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
lstControls.add(Pair.of(view.getCbRandomArtInPools(), FPref.UI_RANDOM_ART_IN_POOLS));
|
||||
lstControls.add(Pair.of(view.getCbEnforceDeckLegality(), FPref.ENFORCE_DECK_LEGALITY));
|
||||
lstControls.add(Pair.of(view.getCbPerformanceMode(), FPref.PERFORMANCE_MODE));
|
||||
lstControls.add(Pair.of(view.getCbSideboardForAI(), FPref.MATCH_SIDEBOARD_FOR_AI));
|
||||
lstControls.add(Pair.of(view.getCbFilteredHands(), FPref.FILTERED_HANDS));
|
||||
lstControls.add(Pair.of(view.getCbCloneImgSource(), FPref.UI_CLONE_MODE_SOURCE));
|
||||
lstControls.add(Pair.of(view.getCbRemoveSmall(), FPref.DECKGEN_NOSMALL));
|
||||
@@ -147,7 +148,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
|
||||
|
||||
for(final Pair<JCheckBox, FPref> kv : lstControls) {
|
||||
kv.getKey().addItemListener(new ItemListener() {
|
||||
kv.getKey().addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(final ItemEvent arg0) {
|
||||
if (updating) { return; }
|
||||
|
||||
@@ -75,6 +75,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
private final JCheckBox cbLoadHistoricFormats = new OptionsCheckBox(localizer.getMessage("cbLoadHistoricFormats"));
|
||||
private final JCheckBox cbWorkshopSyntax = new OptionsCheckBox(localizer.getMessage("cbWorkshopSyntax"));
|
||||
private final JCheckBox cbEnforceDeckLegality = new OptionsCheckBox(localizer.getMessage("cbEnforceDeckLegality"));
|
||||
private final JCheckBox cbSideboardForAI = new OptionsCheckBox(localizer.getMessage("cbSideboardForAI"));
|
||||
private final JCheckBox cbPerformanceMode = new OptionsCheckBox(localizer.getMessage("cbPerformanceMode"));
|
||||
private final JCheckBox cbFilteredHands = new OptionsCheckBox(localizer.getMessage("cbFilteredHands"));
|
||||
private final JCheckBox cbImageFetcher = new OptionsCheckBox(localizer.getMessage("cbImageFetcher"));
|
||||
@@ -195,6 +196,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
pnlPrefs.add(cbPerformanceMode, titleConstraints);
|
||||
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlPerformanceMode")), descriptionConstraints);
|
||||
|
||||
pnlPrefs.add(cbSideboardForAI, titleConstraints);
|
||||
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlSideboardForAI")), descriptionConstraints);
|
||||
|
||||
pnlPrefs.add(cbFilteredHands, titleConstraints);
|
||||
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlFilteredHands")), descriptionConstraints);
|
||||
|
||||
@@ -680,6 +684,10 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
return cbPerformanceMode;
|
||||
}
|
||||
|
||||
public JCheckBox getCbSideboardForAI() {
|
||||
return cbSideboardForAI;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JCheckBox} */
|
||||
public JCheckBox getCbFilteredHands() {
|
||||
return cbFilteredHands;
|
||||
|
||||
@@ -1022,8 +1022,8 @@ public final class CMatchUI
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PaperCard> sideboard(final CardPool sideboard, final CardPool main) {
|
||||
return GuiChoose.sideboard(this, sideboard.toFlatList(), main.toFlatList());
|
||||
public List<PaperCard> sideboard(final CardPool sideboard, final CardPool main, final String message) {
|
||||
return GuiChoose.sideboard(this, sideboard.toFlatList(), main.toFlatList(), message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -112,7 +112,7 @@ public class PlayerControllerForTests extends PlayerController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PaperCard> sideboard(Deck deck, GameType gameType) {
|
||||
public List<PaperCard> sideboard(Deck deck, GameType gameType, String message) {
|
||||
return null; // refused to side
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user