mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Cleaned up and the new quest section for readability and added an option to allow duplicate cards in a quest's starting pool
This commit is contained in:
@@ -1,17 +1,5 @@
|
|||||||
package forge.screens.home.quest;
|
package forge.screens.home.quest;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FilenameFilter;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
|
|
||||||
import forge.UiCommand;
|
import forge.UiCommand;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.DeckSection;
|
import forge.deck.DeckSection;
|
||||||
@@ -20,18 +8,19 @@ import forge.gui.framework.ICDoc;
|
|||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.properties.ForgeConstants;
|
import forge.properties.ForgeConstants;
|
||||||
import forge.quest.QuestController;
|
import forge.quest.*;
|
||||||
import forge.quest.QuestMode;
|
|
||||||
import forge.quest.QuestUtil;
|
|
||||||
import forge.quest.QuestWorld;
|
|
||||||
import forge.quest.StartingPoolPreferences;
|
|
||||||
import forge.quest.StartingPoolType;
|
|
||||||
import forge.quest.data.GameFormatQuest;
|
import forge.quest.data.GameFormatQuest;
|
||||||
import forge.quest.data.QuestData;
|
import forge.quest.data.QuestData;
|
||||||
import forge.quest.data.QuestPreferences.QPref;
|
import forge.quest.data.QuestPreferences.QPref;
|
||||||
import forge.quest.io.QuestDataIO;
|
import forge.quest.io.QuestDataIO;
|
||||||
import forge.toolbox.FOptionPane;
|
import forge.toolbox.FOptionPane;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FilenameFilter;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls the quest data submenu in the home UI.
|
* Controls the quest data submenu in the home UI.
|
||||||
*
|
*
|
||||||
@@ -80,27 +69,33 @@ public enum CSubmenuQuestData implements ICDoc {
|
|||||||
unselectableSets.add("ARC");
|
unselectableSets.add("ARC");
|
||||||
unselectableSets.add("PC2");
|
unselectableSets.add("PC2");
|
||||||
|
|
||||||
view.getBtnCustomFormat().setCommand(new UiCommand() { @Override public void run() {
|
view.getBtnCustomFormat().setCommand(new UiCommand() {
|
||||||
final DialogChooseSets dialog = new DialogChooseSets(customFormatCodes, unselectableSets, false);
|
@Override
|
||||||
dialog.setOkCallback(new Runnable() {
|
public void run() {
|
||||||
@Override
|
final DialogChooseSets dialog = new DialogChooseSets(customFormatCodes, unselectableSets, false);
|
||||||
public void run() {
|
dialog.setOkCallback(new Runnable() {
|
||||||
customFormatCodes.clear();
|
@Override
|
||||||
customFormatCodes.addAll(dialog.getSelectedSets());
|
public void run() {
|
||||||
}
|
customFormatCodes.clear();
|
||||||
});
|
customFormatCodes.addAll(dialog.getSelectedSets());
|
||||||
} });
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
view.getBtnPrizeCustomFormat().setCommand(new UiCommand() { @Override public void run() {
|
view.getBtnPrizeCustomFormat().setCommand(new UiCommand() {
|
||||||
final DialogChooseSets dialog = new DialogChooseSets(customPrizeFormatCodes, unselectableSets, false);
|
@Override
|
||||||
dialog.setOkCallback(new Runnable() {
|
public void run() {
|
||||||
@Override
|
final DialogChooseSets dialog = new DialogChooseSets(customPrizeFormatCodes, unselectableSets, false);
|
||||||
public void run() {
|
dialog.setOkCallback(new Runnable() {
|
||||||
customPrizeFormatCodes.clear();
|
@Override
|
||||||
customPrizeFormatCodes.addAll(dialog.getSelectedSets());
|
public void run() {
|
||||||
}
|
customPrizeFormatCodes.clear();
|
||||||
});
|
customPrizeFormatCodes.addAll(dialog.getSelectedSets());
|
||||||
} });
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -152,7 +147,10 @@ public enum CSubmenuQuestData implements ICDoc {
|
|||||||
view.getLstQuests().setEditCommand(cmdQuestUpdate);
|
view.getLstQuests().setEditCommand(cmdQuestUpdate);
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override public void run() { view.getBtnEmbark().requestFocusInWindow(); }
|
@Override
|
||||||
|
public void run() {
|
||||||
|
view.getBtnEmbark().requestFocusInWindow();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +251,7 @@ public enum CSubmenuQuestData implements ICDoc {
|
|||||||
// } else {
|
// } else {
|
||||||
// fmtPrizes = worldFormat;
|
// fmtPrizes = worldFormat;
|
||||||
// }
|
// }
|
||||||
final StartingPoolPreferences userPrefs = new StartingPoolPreferences(view.randomizeColorDistribution(), view.getPreferredColor(), view.startWithCompleteSet());
|
final StartingPoolPreferences userPrefs = new StartingPoolPreferences(view.randomizeColorDistribution(), view.getPreferredColor(), view.startWithCompleteSet(), view.allowDuplicateCards());
|
||||||
|
|
||||||
String questName;
|
String questName;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|||||||
@@ -1,20 +1,5 @@
|
|||||||
package forge.screens.home.quest;
|
package forge.screens.home.quest;
|
||||||
|
|
||||||
import java.awt.Component;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.swing.JList;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.SwingConstants;
|
|
||||||
import javax.swing.plaf.basic.BasicComboBoxRenderer;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.text.WordUtils;
|
|
||||||
|
|
||||||
import forge.card.MagicColor;
|
import forge.card.MagicColor;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.DeckGroup;
|
import forge.deck.DeckGroup;
|
||||||
@@ -32,29 +17,32 @@ import forge.quest.StartingPoolType;
|
|||||||
import forge.screens.home.EMenuGroup;
|
import forge.screens.home.EMenuGroup;
|
||||||
import forge.screens.home.IVSubmenu;
|
import forge.screens.home.IVSubmenu;
|
||||||
import forge.screens.home.VHomeUI;
|
import forge.screens.home.VHomeUI;
|
||||||
import forge.toolbox.FCheckBox;
|
import forge.toolbox.*;
|
||||||
import forge.toolbox.FComboBoxWrapper;
|
|
||||||
import forge.toolbox.FLabel;
|
|
||||||
import forge.toolbox.FRadioButton;
|
|
||||||
import forge.toolbox.FScrollPane;
|
|
||||||
import forge.toolbox.FSkin;
|
|
||||||
import forge.toolbox.JXButtonPanel;
|
|
||||||
import forge.util.storage.IStorage;
|
import forge.util.storage.IStorage;
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.plaf.basic.BasicComboBoxRenderer;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assembles Swing components of quest data submenu singleton.
|
* Assembles Swing components of quest data submenu singleton.
|
||||||
*
|
*
|
||||||
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
|
* <br><br><i>(V at beginning of class name denotes a view class.)</i>
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("FieldCanBeLocal")
|
||||||
public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
||||||
/** */
|
|
||||||
SINGLETON_INSTANCE;
|
SINGLETON_INSTANCE;
|
||||||
|
|
||||||
// Fields used with interface IVDoc
|
// Fields used with interface IVDoc
|
||||||
private DragCell parentCell;
|
private DragCell parentCell;
|
||||||
private final DragTab tab = new DragTab("Quest Data");
|
private final DragTab tab = new DragTab("Quest Data");
|
||||||
|
|
||||||
/** */
|
|
||||||
private final FLabel lblTitle = new FLabel.Builder()
|
private final FLabel lblTitle = new FLabel.Builder()
|
||||||
.text("Load Quest Data").fontAlign(SwingConstants.CENTER)
|
.text("Load Quest Data").fontAlign(SwingConstants.CENTER)
|
||||||
.opaque(true).fontSize(16).build();
|
.opaque(true).fontSize(16).build();
|
||||||
@@ -70,50 +58,52 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
|||||||
private final FScrollPane scrQuests = new FScrollPane(lstQuests, false);
|
private final FScrollPane scrQuests = new FScrollPane(lstQuests, false);
|
||||||
private final JPanel pnlOptions = new JPanel();
|
private final JPanel pnlOptions = new JPanel();
|
||||||
|
|
||||||
/* Fist column */
|
/* First column */
|
||||||
private final FRadioButton radEasy = new FRadioButton("Easy");
|
private final FRadioButton radEasy = new FRadioButton("Easy");
|
||||||
private final FRadioButton radMedium = new FRadioButton("Medium");
|
private final FRadioButton radMedium = new FRadioButton("Medium");
|
||||||
private final FRadioButton radHard = new FRadioButton("Hard");
|
private final FRadioButton radHard = new FRadioButton("Hard");
|
||||||
private final FRadioButton radExpert = new FRadioButton("Expert");
|
private final FRadioButton radExpert = new FRadioButton("Expert");
|
||||||
private final FCheckBox boxFantasy = new FCheckBox("Fantasy Mode");
|
private final FCheckBox boxFantasy = new FCheckBox("Fantasy Mode");
|
||||||
private final FCheckBox boxCompleteSet = new FCheckBox("Start with all cards in selected sets");
|
|
||||||
|
|
||||||
private final FLabel lblStartingWorld = new FLabel.Builder().text("Starting world:").build();
|
private final FLabel lblStartingWorld = new FLabel.Builder().text("Starting world:").build();
|
||||||
private final FComboBoxWrapper<QuestWorld> cbxStartingWorld = new FComboBoxWrapper<QuestWorld>();
|
private final FComboBoxWrapper<QuestWorld> cbxStartingWorld = new FComboBoxWrapper<>();
|
||||||
|
|
||||||
private final FLabel lblPreferredColor = new FLabel.Builder().text("Starting pool colors:").build();
|
|
||||||
private final FComboBoxWrapper<String> cbxPreferredColor = new FComboBoxWrapper<String>();
|
|
||||||
private final String stringBalancedDistribution = new String("balanced distribution");
|
|
||||||
private final String stringRandomizedDistribution = new String("randomized distribution");
|
|
||||||
private final String stringBias = new String(" bias");
|
|
||||||
|
|
||||||
/* Second column */
|
/* Second column */
|
||||||
|
|
||||||
private final FLabel lblStartingPool = new FLabel.Builder().text("Starting pool:").build();
|
private final FLabel lblStartingPool = new FLabel.Builder().text("Starting pool:").build();
|
||||||
private final FComboBoxWrapper<StartingPoolType> cbxStartingPool = new FComboBoxWrapper<StartingPoolType>();
|
private final FComboBoxWrapper<StartingPoolType> cbxStartingPool = new FComboBoxWrapper<>();
|
||||||
|
|
||||||
private final FLabel lblUnrestricted = new FLabel.Builder().text("All cards will be available to play.").build();
|
private final FLabel lblUnrestricted = new FLabel.Builder().text("All cards will be available to play.").build();
|
||||||
|
|
||||||
private final FLabel lblPreconDeck = new FLabel.Builder().text("Starter/Event deck:").build();
|
private final FLabel lblPreconDeck = new FLabel.Builder().text("Starter/Event deck:").build();
|
||||||
private final FComboBoxWrapper<String> cbxPreconDeck = new FComboBoxWrapper<String>();
|
private final FComboBoxWrapper<String> cbxPreconDeck = new FComboBoxWrapper<>();
|
||||||
|
|
||||||
private final FLabel lblFormat = new FLabel.Builder().text("Sanctioned format:").build();
|
private final FLabel lblFormat = new FLabel.Builder().text("Sanctioned format:").build();
|
||||||
private final FComboBoxWrapper<GameFormat> cbxFormat = new FComboBoxWrapper<GameFormat>();
|
private final FComboBoxWrapper<GameFormat> cbxFormat = new FComboBoxWrapper<>();
|
||||||
|
|
||||||
private final FLabel lblCustomDeck = new FLabel.Builder().text("Custom deck:").build();
|
private final FLabel lblCustomDeck = new FLabel.Builder().text("Custom deck:").build();
|
||||||
private final FComboBoxWrapper<Deck> cbxCustomDeck = new FComboBoxWrapper<Deck>();
|
private final FComboBoxWrapper<Deck> cbxCustomDeck = new FComboBoxWrapper<>();
|
||||||
|
|
||||||
private final FLabel btnDefineCustomFormat = new FLabel.Builder().opaque(true).hoverable(true).text("Define custom format").build();
|
private final FLabel btnDefineCustomFormat = new FLabel.Builder().opaque(true).hoverable(true).text("Define custom format").build();
|
||||||
|
|
||||||
|
private final FCheckBox boxCompleteSet = new FCheckBox("Start with all cards in selected sets");
|
||||||
|
private final FCheckBox boxAllowDuplicates = new FCheckBox("Allow duplicate cards");
|
||||||
|
|
||||||
|
private final FLabel lblPreferredColor = new FLabel.Builder().text("Starting pool colors:").build();
|
||||||
|
private final FComboBoxWrapper<String> cbxPreferredColor = new FComboBoxWrapper<>();
|
||||||
|
private final String stringBalancedDistribution = "balanced distribution";
|
||||||
|
private final String stringRandomizedDistribution = "randomized distribution";
|
||||||
|
private final String stringBias = " bias";
|
||||||
|
|
||||||
private final FLabel btnPrizeDefineCustomFormat = new FLabel.Builder().opaque(true).hoverable(true).text("Define custom format").build();
|
private final FLabel btnPrizeDefineCustomFormat = new FLabel.Builder().opaque(true).hoverable(true).text("Define custom format").build();
|
||||||
|
|
||||||
private final FLabel lblPrizedCards = new FLabel.Builder().text("Prized cards:").build();
|
private final FLabel lblPrizedCards = new FLabel.Builder().text("Prized cards:").build();
|
||||||
private final FComboBoxWrapper<Object> cbxPrizedCards = new FComboBoxWrapper<Object>();
|
private final FComboBoxWrapper<Object> cbxPrizedCards = new FComboBoxWrapper<>();
|
||||||
|
|
||||||
private final FLabel lblPrizeFormat = new FLabel.Builder().text("Sanctioned format:").build();
|
private final FLabel lblPrizeFormat = new FLabel.Builder().text("Sanctioned format:").build();
|
||||||
private final FComboBoxWrapper<GameFormat> cbxPrizeFormat = new FComboBoxWrapper<GameFormat>();
|
private final FComboBoxWrapper<GameFormat> cbxPrizeFormat = new FComboBoxWrapper<>();
|
||||||
|
|
||||||
private final FLabel lblPrizeUnrestricted = new FLabel.Builder().text("All cards will be available to win.").build();
|
private final FLabel lblPrizeUnrestricted = new FLabel.Builder().text("All cards will be available to win.").build();
|
||||||
private final FLabel lblPrizeSameAsStarting = new FLabel.Builder().text("Only sets found in starting pool will be available.").build();
|
private final FLabel lblPrizeSameAsStarting = new FLabel.Builder().text("Only sets in starting pool will be available.").build();
|
||||||
|
|
||||||
private final FCheckBox cboAllowUnlocks = new FCheckBox("Allow unlock of additional editions");
|
private final FCheckBox cboAllowUnlocks = new FCheckBox("Allow unlock of additional editions");
|
||||||
|
|
||||||
@@ -145,15 +135,15 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
|||||||
cbxCustomDeck.removeAllItems();
|
cbxCustomDeck.removeAllItems();
|
||||||
final CardCollections decks = FModel.getDecks();
|
final CardCollections decks = FModel.getDecks();
|
||||||
switch (newVal) {
|
switch (newVal) {
|
||||||
case SealedDeck:
|
case SealedDeck:
|
||||||
for (final DeckGroup d : decks.getSealed()) { cbxCustomDeck.addItem(d.getHumanDeck()); }
|
for (final DeckGroup d : decks.getSealed()) { cbxCustomDeck.addItem(d.getHumanDeck()); }
|
||||||
break;
|
break;
|
||||||
case DraftDeck:
|
case DraftDeck:
|
||||||
for (final DeckGroup d : decks.getDraft()) { cbxCustomDeck.addItem(d.getHumanDeck()); }
|
for (final DeckGroup d : decks.getDraft()) { cbxCustomDeck.addItem(d.getHumanDeck()); }
|
||||||
break;
|
break;
|
||||||
case Cube:
|
case Cube:
|
||||||
for (final Deck d : decks.getCubes()) { cbxCustomDeck.addItem(d); }
|
for (final Deck d : decks.getCubes()) { cbxCustomDeck.addItem(d); }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,12 +192,13 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
|||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private VSubmenuQuestData() {
|
VSubmenuQuestData() {
|
||||||
|
|
||||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
lblTitleNew.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
lblTitleNew.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
|
||||||
final JXButtonPanel difficultyPanel = new JXButtonPanel();
|
final JXButtonPanel difficultyPanel = new JXButtonPanel();
|
||||||
final String difficulty_constraints = "h 27px!, gapbottom 5";
|
final String difficulty_constraints = "h 25px!, gapbottom 5";
|
||||||
difficultyPanel.add(radEasy, difficulty_constraints);
|
difficultyPanel.add(radEasy, difficulty_constraints);
|
||||||
difficultyPanel.add(radMedium, difficulty_constraints);
|
difficultyPanel.add(radMedium, difficulty_constraints);
|
||||||
difficultyPanel.add(radHard, difficulty_constraints);
|
difficultyPanel.add(radHard, difficulty_constraints);
|
||||||
@@ -215,6 +206,7 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
|||||||
radEasy.setSelected(true);
|
radEasy.setSelected(true);
|
||||||
|
|
||||||
boxCompleteSet.setToolTipText("You will start the quest with 4 of each card in the sets you have selected.");
|
boxCompleteSet.setToolTipText("You will start the quest with 4 of each card in the sets you have selected.");
|
||||||
|
boxAllowDuplicates.setToolTipText("When your starting pool is generated duplicates of cards may be included.");
|
||||||
|
|
||||||
cbxStartingPool.addItem(StartingPoolType.Complete);
|
cbxStartingPool.addItem(StartingPoolType.Complete);
|
||||||
cbxStartingPool.addItem(StartingPoolType.Rotating);
|
cbxStartingPool.addItem(StartingPoolType.Rotating);
|
||||||
@@ -261,7 +253,7 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
|||||||
|
|
||||||
cboAllowUnlocks.setSelected(true);
|
cboAllowUnlocks.setSelected(true);
|
||||||
|
|
||||||
final Map<String, String> preconDescriptions = new HashMap<String, String>();
|
final Map<String, String> preconDescriptions = new HashMap<>();
|
||||||
final IStorage<PreconDeck> preconDecks = QuestController.getPrecons();
|
final IStorage<PreconDeck> preconDecks = QuestController.getPrecons();
|
||||||
|
|
||||||
for (final PreconDeck preconDeck : preconDecks) {
|
for (final PreconDeck preconDeck : preconDecks) {
|
||||||
@@ -297,6 +289,7 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
|||||||
boxFantasy.setSelected(true);
|
boxFantasy.setSelected(true);
|
||||||
boxFantasy.setEnabled(true);
|
boxFantasy.setEnabled(true);
|
||||||
boxCompleteSet.setEnabled(true);
|
boxCompleteSet.setEnabled(true);
|
||||||
|
boxAllowDuplicates.setEnabled(true);
|
||||||
|
|
||||||
cbxPreferredColor.setEnabled(true);
|
cbxPreferredColor.setEnabled(true);
|
||||||
|
|
||||||
@@ -305,60 +298,59 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
|||||||
|
|
||||||
final JPanel pnlDifficultyMode = new JPanel(new MigLayout("insets 0, gap 1%, flowy"));
|
final JPanel pnlDifficultyMode = new JPanel(new MigLayout("insets 0, gap 1%, flowy"));
|
||||||
pnlDifficultyMode.add(difficultyPanel, "gapright 4%");
|
pnlDifficultyMode.add(difficultyPanel, "gapright 4%");
|
||||||
pnlDifficultyMode.add(boxFantasy, difficulty_constraints + ", gapright 4%");
|
pnlDifficultyMode.add(boxFantasy, "h 27px!, gapbottom 15, gapright 4%");
|
||||||
|
pnlDifficultyMode.add(lblStartingWorld, "h 27px!, hidemode 3");
|
||||||
|
cbxStartingWorld.addTo(pnlDifficultyMode, "h 27px!, w 40%, pushx, hidemode 3");
|
||||||
pnlDifficultyMode.setOpaque(false);
|
pnlDifficultyMode.setOpaque(false);
|
||||||
pnlOptions.add(pnlDifficultyMode, "w 40%");
|
pnlOptions.add(pnlDifficultyMode, "w 40%");
|
||||||
|
|
||||||
|
|
||||||
final JPanel pnlRestrictions = new JPanel();
|
final JPanel pnlRestrictions = new JPanel();
|
||||||
final String constraints = "h 27px!, ";
|
final String constraints = "h 25px!, ";
|
||||||
final String lblWidth = "w 40%, ";
|
|
||||||
final String hidemode = "hidemode 3, ";
|
final String hidemode = "hidemode 3, ";
|
||||||
final String lblWidthStart = lblWidth + hidemode;
|
final String cboWidth = "w 240px!, pushx, ";
|
||||||
final String cboWidth = "pushx, ";
|
|
||||||
final String cboWidthStart = cboWidth + hidemode;
|
final String cboWidthStart = cboWidth + hidemode;
|
||||||
|
final String btnStartingCustomFormatWidth = "w " + (4 + cbxStartingPool.getAutoSizeWidth()) + "px!, ";
|
||||||
|
|
||||||
pnlRestrictions.setLayout(new MigLayout("insets 0, gap 0, wrap 2", "[120, al right][240, fill]", "[|]12[|]6[]"));
|
pnlRestrictions.setLayout(new MigLayout("insets 0, gap 10", "[right][left]"));
|
||||||
|
|
||||||
|
|
||||||
pnlRestrictions.add(lblStartingPool, constraints + lblWidthStart);
|
pnlRestrictions.add(lblStartingPool, "h 15px!, cell 0 0");
|
||||||
cbxStartingPool.addTo(pnlRestrictions, constraints + cboWidthStart);
|
cbxStartingPool.addTo(pnlRestrictions, constraints + cboWidthStart + " cell 1 0");
|
||||||
|
|
||||||
/* out of these 3 groups only one will be visible */
|
/* --vvv-- out of these 3 groups only one will be visible --vvv-- */
|
||||||
pnlRestrictions.add(lblUnrestricted, constraints + hidemode + "spanx 2");
|
pnlRestrictions.add(lblUnrestricted, constraints + hidemode + " cell 1 1, ");
|
||||||
|
|
||||||
pnlRestrictions.add(lblPreconDeck, constraints + lblWidthStart);
|
pnlRestrictions.add(lblPreconDeck, constraints + hidemode + " cell 0 1");
|
||||||
cbxPreconDeck.addTo(pnlRestrictions, constraints + cboWidthStart);
|
cbxPreconDeck.addTo(pnlRestrictions, constraints + cboWidthStart + " cell 1 1");
|
||||||
|
|
||||||
pnlRestrictions.add(lblCustomDeck, constraints + lblWidthStart);
|
pnlRestrictions.add(lblCustomDeck, constraints + hidemode + " cell 0 1");
|
||||||
cbxCustomDeck.addTo(pnlRestrictions, constraints + cboWidthStart); // , skip 1
|
cbxCustomDeck.addTo(pnlRestrictions, constraints + cboWidthStart + " cell 1 1");
|
||||||
|
/* --^^^-- out of these 3 groups only one will be visible --^^^-- */
|
||||||
|
|
||||||
pnlRestrictions.add(lblFormat, constraints + lblWidthStart);
|
pnlRestrictions.add(lblFormat, constraints + hidemode + " cell 0 1");
|
||||||
cbxFormat.addTo(pnlRestrictions, constraints + cboWidthStart); // , skip 1
|
cbxFormat.addTo(pnlRestrictions, constraints + cboWidthStart + " cell 1 1");
|
||||||
|
|
||||||
pnlRestrictions.add(btnDefineCustomFormat, constraints + hidemode + "spanx 2, w 240px");
|
pnlRestrictions.add(btnDefineCustomFormat, btnStartingCustomFormatWidth + constraints + hidemode + " cell 1 1");
|
||||||
|
|
||||||
|
pnlRestrictions.add(boxAllowDuplicates, "h 15px!, cell 1 2");
|
||||||
|
pnlRestrictions.add(boxCompleteSet, "h 15px!, cell 1 3");
|
||||||
|
|
||||||
|
pnlRestrictions.add(lblPreferredColor, constraints + hidemode + "cell 0 4");
|
||||||
|
cbxPreferredColor.addTo(pnlRestrictions, constraints + cboWidthStart + "cell 1 4");
|
||||||
|
|
||||||
// Prized cards options
|
// Prized cards options
|
||||||
pnlRestrictions.add(lblPrizedCards, constraints + lblWidth);
|
pnlRestrictions.add(lblPrizedCards, constraints + " cell 0 5");
|
||||||
cbxPrizedCards.addTo(pnlRestrictions, constraints + cboWidth);
|
cbxPrizedCards.addTo(pnlRestrictions, constraints + cboWidth + " cell 1 5");
|
||||||
|
|
||||||
pnlRestrictions.add(lblPrizeFormat, constraints + lblWidthStart);
|
pnlRestrictions.add(lblPrizeFormat, constraints + hidemode + "cell 0 6");
|
||||||
cbxPrizeFormat.addTo(pnlRestrictions, constraints + cboWidthStart); // , skip 1
|
cbxPrizeFormat.addTo(pnlRestrictions, constraints + cboWidthStart + "cell 1 6"); // , skip 1
|
||||||
pnlRestrictions.add(btnPrizeDefineCustomFormat, constraints + hidemode + "spanx 2, w 240px");
|
pnlRestrictions.add(btnPrizeDefineCustomFormat, constraints + hidemode + "cell 1 6");
|
||||||
pnlRestrictions.add(lblPrizeSameAsStarting, constraints + hidemode + "spanx 2");
|
pnlRestrictions.add(lblPrizeSameAsStarting, constraints + hidemode + "cell 1 6");
|
||||||
pnlRestrictions.add(lblPrizeUnrestricted, constraints + hidemode + "spanx 2");
|
pnlRestrictions.add(lblPrizeUnrestricted, constraints + hidemode + "cell 1 6");
|
||||||
|
|
||||||
pnlRestrictions.add(cboAllowUnlocks, constraints + "spanx 2, ax right");
|
pnlRestrictions.add(cboAllowUnlocks, constraints + "cell 1 7");
|
||||||
pnlRestrictions.add(boxCompleteSet, constraints + "spanx 2, ax right");
|
|
||||||
|
|
||||||
|
|
||||||
pnlRestrictions.add(lblPreferredColor, constraints + lblWidthStart);
|
|
||||||
cbxPreferredColor.addTo(pnlRestrictions, constraints + cboWidthStart + ", wrap");
|
|
||||||
|
|
||||||
pnlRestrictions.add(lblStartingWorld, constraints + lblWidthStart);
|
|
||||||
cbxStartingWorld.addTo(pnlRestrictions, constraints + cboWidthStart);
|
|
||||||
|
|
||||||
// cboAllowUnlocks.setOpaque(false);
|
|
||||||
pnlRestrictions.setOpaque(false);
|
pnlRestrictions.setOpaque(false);
|
||||||
pnlOptions.add(pnlRestrictions, "pushx, ay top");
|
pnlOptions.add(pnlRestrictions, "pushx, ay top");
|
||||||
|
|
||||||
@@ -477,12 +469,12 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getSelectedPrecon() {
|
public String getSelectedPrecon() {
|
||||||
return cbxPreconDeck.getSelectedItem().toString();
|
return cbxPreconDeck.getSelectedItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Deck getSelectedDeck() {
|
public Deck getSelectedDeck() {
|
||||||
final Object sel = cbxCustomDeck.getSelectedItem();
|
final Object sel = cbxCustomDeck.getSelectedItem();
|
||||||
return sel instanceof Deck ? (Deck) sel : null;
|
return sel != null ? (Deck) sel : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUnlockSetsAllowed() {
|
public boolean isUnlockSetsAllowed() {
|
||||||
@@ -510,6 +502,10 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
|
|||||||
return boxCompleteSet.isSelected();
|
return boxCompleteSet.isSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean allowDuplicateCards() {
|
||||||
|
return boxAllowDuplicates.isSelected();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean randomizeColorDistribution() {
|
public boolean randomizeColorDistribution() {
|
||||||
return stringRandomizedDistribution.equals(cbxPreferredColor.getSelectedItem());
|
return stringRandomizedDistribution.equals(cbxPreferredColor.getSelectedItem());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,6 @@
|
|||||||
package forge.screens.quest;
|
package forge.screens.quest;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.text.WordUtils;
|
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||||
|
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
@@ -25,38 +14,31 @@ import forge.item.PreconDeck;
|
|||||||
import forge.model.CardCollections;
|
import forge.model.CardCollections;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.properties.ForgeConstants;
|
import forge.properties.ForgeConstants;
|
||||||
import forge.quest.QuestController;
|
import forge.quest.*;
|
||||||
import forge.quest.QuestMode;
|
|
||||||
import forge.quest.QuestUtil;
|
|
||||||
import forge.quest.QuestWorld;
|
|
||||||
import forge.quest.StartingPoolPreferences;
|
|
||||||
import forge.quest.StartingPoolType;
|
|
||||||
import forge.quest.data.GameFormatQuest;
|
import forge.quest.data.GameFormatQuest;
|
||||||
import forge.quest.data.QuestPreferences.QPref;
|
import forge.quest.data.QuestPreferences.QPref;
|
||||||
import forge.screens.FScreen;
|
import forge.screens.FScreen;
|
||||||
import forge.screens.LoadingOverlay;
|
import forge.screens.LoadingOverlay;
|
||||||
import forge.screens.home.NewGameMenu;
|
import forge.screens.home.NewGameMenu;
|
||||||
import forge.screens.quest.QuestMenu.LaunchReason;
|
import forge.screens.quest.QuestMenu.LaunchReason;
|
||||||
import forge.toolbox.FCheckBox;
|
import forge.toolbox.*;
|
||||||
import forge.toolbox.FComboBox;
|
|
||||||
import forge.toolbox.FDisplayObject;
|
|
||||||
import forge.toolbox.FEvent;
|
|
||||||
import forge.toolbox.FEvent.FEventHandler;
|
import forge.toolbox.FEvent.FEventHandler;
|
||||||
import forge.toolbox.FLabel;
|
|
||||||
import forge.toolbox.FOptionPane;
|
|
||||||
import forge.toolbox.FScrollPane;
|
|
||||||
import forge.util.FileUtil;
|
import forge.util.FileUtil;
|
||||||
import forge.util.ThreadUtil;
|
import forge.util.ThreadUtil;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
import forge.util.gui.SOptionPane;
|
import forge.util.gui.SOptionPane;
|
||||||
import forge.util.storage.IStorage;
|
import forge.util.storage.IStorage;
|
||||||
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public class NewQuestScreen extends FScreen {
|
public class NewQuestScreen extends FScreen {
|
||||||
private static final float EMBARK_BTN_HEIGHT = 2 * Utils.AVG_FINGER_HEIGHT;
|
private static final float EMBARK_BTN_HEIGHT = 2 * Utils.AVG_FINGER_HEIGHT;
|
||||||
private static final float PADDING = FOptionPane.PADDING;
|
private static final float PADDING = FOptionPane.PADDING;
|
||||||
|
|
||||||
private final List<String> customFormatCodes = new ArrayList<String>();
|
private final List<String> customFormatCodes = new ArrayList<>();
|
||||||
private final List<String> customPrizeFormatCodes = new ArrayList<String>();
|
private final List<String> customPrizeFormatCodes = new ArrayList<>();
|
||||||
|
|
||||||
private final FScrollPane scroller = add(new FScrollPane() {
|
private final FScrollPane scroller = add(new FScrollPane() {
|
||||||
@Override
|
@Override
|
||||||
@@ -99,15 +81,15 @@ public class NewQuestScreen extends FScreen {
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private final FLabel lblDifficulty = scroller.add(new FLabel.Builder().text("Difficulty:").build());
|
private final FLabel lblDifficulty = scroller.add(new FLabel.Builder().text("Difficulty:").build());
|
||||||
private final FComboBox<String> cbxDifficulty = scroller.add(new FComboBox<String>(new String[]{ "Easy", "Medium", "Hard", "Expert" }));
|
private final FComboBox<String> cbxDifficulty = scroller.add(new FComboBox<>(new String[]{ "Easy", "Medium", "Hard", "Expert" }));
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private final FLabel lblPreferredColor = scroller.add(new FLabel.Builder().text("Starting pool colors:").build());
|
private final FLabel lblPreferredColor = scroller.add(new FLabel.Builder().text("Starting pool colors:").build());
|
||||||
private final FComboBox<String> cbxPreferredColor = scroller.add(new FComboBox<String>());
|
private final FComboBox<String> cbxPreferredColor = scroller.add(new FComboBox<String>());
|
||||||
private final String stringBalancedDistribution = new String("balanced distribution");
|
private final String stringBalancedDistribution = "balanced distribution";
|
||||||
private final String stringRandomizedDistribution = new String("randomized distribution");
|
private final String stringRandomizedDistribution = "randomized distribution";
|
||||||
private final String stringBias = new String(" bias");
|
private final String stringBias = " bias";
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private final FLabel lblStartingPool = scroller.add(new FLabel.Builder().text("Starting pool:").build());
|
private final FLabel lblStartingPool = scroller.add(new FLabel.Builder().text("Starting pool:").build());
|
||||||
private final FComboBox<StartingPoolType> cbxStartingPool = scroller.add(new FComboBox<StartingPoolType>());
|
private final FComboBox<StartingPoolType> cbxStartingPool = scroller.add(new FComboBox<StartingPoolType>());
|
||||||
@@ -127,7 +109,7 @@ public class NewQuestScreen extends FScreen {
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private final FLabel lblPrizedCards = scroller.add(new FLabel.Builder().text("Prized cards:").build());
|
private final FLabel lblPrizedCards = scroller.add(new FLabel.Builder().text("Prized cards:").build());
|
||||||
private final FComboBox<Object> cbxPrizedCards = scroller.add(new FComboBox<Object>());
|
private final FComboBox<Object> cbxPrizedCards = scroller.add(new FComboBox<>());
|
||||||
|
|
||||||
private final FLabel lblPrizeFormat = scroller.add(new FLabel.Builder().text("Sanctioned format:").build());
|
private final FLabel lblPrizeFormat = scroller.add(new FLabel.Builder().text("Sanctioned format:").build());
|
||||||
private final FComboBox<GameFormat> cbxPrizeFormat = scroller.add(new FComboBox<GameFormat>());
|
private final FComboBox<GameFormat> cbxPrizeFormat = scroller.add(new FComboBox<GameFormat>());
|
||||||
@@ -138,6 +120,7 @@ public class NewQuestScreen extends FScreen {
|
|||||||
|
|
||||||
private final FCheckBox cbAllowUnlocks = scroller.add(new FCheckBox("Allow unlock of additional editions"));
|
private final FCheckBox cbAllowUnlocks = scroller.add(new FCheckBox("Allow unlock of additional editions"));
|
||||||
private final FCheckBox cbCompleteSet = scroller.add(new FCheckBox("Start with all cards in selected sets"));
|
private final FCheckBox cbCompleteSet = scroller.add(new FCheckBox("Start with all cards in selected sets"));
|
||||||
|
private final FCheckBox cbDuplicateCards = scroller.add(new FCheckBox("Allow duplicates in starting pool"));
|
||||||
private final FCheckBox cbFantasy = scroller.add(new FCheckBox("Fantasy Mode"));
|
private final FCheckBox cbFantasy = scroller.add(new FCheckBox("Fantasy Mode"));
|
||||||
|
|
||||||
private final FLabel btnEmbark = add(new FLabel.ButtonBuilder()
|
private final FLabel btnEmbark = add(new FLabel.ButtonBuilder()
|
||||||
@@ -218,7 +201,7 @@ public class NewQuestScreen extends FScreen {
|
|||||||
|
|
||||||
cbAllowUnlocks.setSelected(true);
|
cbAllowUnlocks.setSelected(true);
|
||||||
|
|
||||||
final Map<String, String> preconDescriptions = new HashMap<String, String>();
|
final Map<String, String> preconDescriptions = new HashMap<>();
|
||||||
IStorage<PreconDeck> preconDecks = QuestController.getPrecons();
|
IStorage<PreconDeck> preconDecks = QuestController.getPrecons();
|
||||||
|
|
||||||
for (PreconDeck preconDeck : preconDecks) {
|
for (PreconDeck preconDeck : preconDecks) {
|
||||||
@@ -237,7 +220,7 @@ public class NewQuestScreen extends FScreen {
|
|||||||
btnPrizeDefineCustomFormat.setEnabled(false);
|
btnPrizeDefineCustomFormat.setEnabled(false);
|
||||||
|
|
||||||
// disable the very powerful sets -- they can be unlocked later for a high price
|
// disable the very powerful sets -- they can be unlocked later for a high price
|
||||||
final List<String> unselectableSets = new ArrayList<String>();
|
final List<String> unselectableSets = new ArrayList<>();
|
||||||
unselectableSets.add("LEA");
|
unselectableSets.add("LEA");
|
||||||
unselectableSets.add("LEB");
|
unselectableSets.add("LEB");
|
||||||
unselectableSets.add("MBP");
|
unselectableSets.add("MBP");
|
||||||
@@ -359,12 +342,12 @@ public class NewQuestScreen extends FScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getSelectedPrecon() {
|
public String getSelectedPrecon() {
|
||||||
return cbxPreconDeck.getSelectedItem().toString();
|
return cbxPreconDeck.getSelectedItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Deck getSelectedDeck() {
|
public Deck getSelectedDeck() {
|
||||||
Object sel = cbxCustomDeck.getSelectedItem();
|
Object sel = cbxCustomDeck.getSelectedItem();
|
||||||
return sel instanceof Deck ? (Deck) sel : null;
|
return sel != null ? (Deck) sel : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUnlockSetsAllowed() {
|
public boolean isUnlockSetsAllowed() {
|
||||||
@@ -375,8 +358,12 @@ public class NewQuestScreen extends FScreen {
|
|||||||
return cbCompleteSet.isSelected();
|
return cbCompleteSet.isSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean allowDuplicateCards() {
|
||||||
|
return cbDuplicateCards.isSelected();
|
||||||
|
}
|
||||||
|
|
||||||
public StartingPoolType getStartingPoolType() {
|
public StartingPoolType getStartingPoolType() {
|
||||||
return (StartingPoolType) cbxStartingPool.getSelectedItem();
|
return cbxStartingPool.getSelectedItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
public StartingPoolType getPrizedPoolType() {
|
public StartingPoolType getPrizedPoolType() {
|
||||||
@@ -405,11 +392,11 @@ public class NewQuestScreen extends FScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public GameFormat getRotatingFormat() {
|
public GameFormat getRotatingFormat() {
|
||||||
return (GameFormat) cbxFormat.getSelectedItem();
|
return cbxFormat.getSelectedItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameFormat getPrizedRotatingFormat() {
|
public GameFormat getPrizedRotatingFormat() {
|
||||||
return (GameFormat) cbxPrizeFormat.getSelectedItem();
|
return cbxPrizeFormat.getSelectedItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -468,7 +455,7 @@ public class NewQuestScreen extends FScreen {
|
|||||||
fmtStartPool = worldFormat;
|
fmtStartPool = worldFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameFormat fmtPrizes = null;
|
GameFormat fmtPrizes;
|
||||||
|
|
||||||
// The starting QuestWorld format should NOT affect what you get if you travel to a world that doesn't have one...
|
// The starting QuestWorld format should NOT affect what you get if you travel to a world that doesn't have one...
|
||||||
// if (worldFormat == null) {
|
// if (worldFormat == null) {
|
||||||
@@ -476,7 +463,7 @@ public class NewQuestScreen extends FScreen {
|
|||||||
if (null == prizedPoolType) {
|
if (null == prizedPoolType) {
|
||||||
fmtPrizes = fmtStartPool;
|
fmtPrizes = fmtStartPool;
|
||||||
if (null == fmtPrizes && dckStartPool != null) { // build it form deck
|
if (null == fmtPrizes && dckStartPool != null) { // build it form deck
|
||||||
Set<String> sets = new HashSet<String>();
|
Set<String> sets = new HashSet<>();
|
||||||
for (Entry<PaperCard, Integer> c : dckStartPool.getMain()) {
|
for (Entry<PaperCard, Integer> c : dckStartPool.getMain()) {
|
||||||
sets.add(c.getKey().getEdition());
|
sets.add(c.getKey().getEdition());
|
||||||
}
|
}
|
||||||
@@ -500,7 +487,7 @@ public class NewQuestScreen extends FScreen {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmtPrizes = customPrizeFormatCodes.isEmpty() ? null : new GameFormat("Custom Prizes", customPrizeFormatCodes, null); // chosen sets and no banend cards
|
fmtPrizes = customPrizeFormatCodes.isEmpty() ? null : new GameFormat("Custom Prizes", customPrizeFormatCodes, null); // chosen sets and no banned cards
|
||||||
break;
|
break;
|
||||||
case Rotating:
|
case Rotating:
|
||||||
fmtPrizes = getPrizedRotatingFormat();
|
fmtPrizes = getPrizedRotatingFormat();
|
||||||
@@ -539,7 +526,7 @@ public class NewQuestScreen extends FScreen {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
final QuestMode mode = isFantasy() ? QuestMode.Fantasy : QuestMode.Classic;
|
final QuestMode mode = isFantasy() ? QuestMode.Fantasy : QuestMode.Classic;
|
||||||
final StartingPoolPreferences userPrefs = new StartingPoolPreferences(randomizeColorDistribution(), getPreferredColor(), startWithCompleteSet());
|
final StartingPoolPreferences userPrefs = new StartingPoolPreferences(randomizeColorDistribution(), getPreferredColor(), startWithCompleteSet(), allowDuplicateCards());
|
||||||
QuestController qc = FModel.getQuest();
|
QuestController qc = FModel.getQuest();
|
||||||
qc.newGame(questName, getSelectedDifficulty(), mode, fmtPrizes, isUnlockSetsAllowed(), dckStartPool, fmtStartPool, getStartingWorldName(), userPrefs);
|
qc.newGame(questName, getSelectedDifficulty(), mode, fmtPrizes, isUnlockSetsAllowed(), dckStartPool, fmtStartPool, getStartingWorldName(), userPrefs);
|
||||||
qc.save();
|
qc.save();
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@@ -39,12 +39,11 @@ import java.util.Collections;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// The BoosterPack generates cards for the Card Pool in Quest Mode
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* QuestBoosterPack class.
|
* QuestBoosterPack class. Generates cards for the Card Pool in Quest Mode
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author Forge
|
* @author Forge
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
@@ -52,7 +51,7 @@ public final class BoosterUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the quest starter deck.
|
* Gets the quest starter deck.
|
||||||
*
|
*
|
||||||
* @param filter
|
* @param filter
|
||||||
* the filter
|
* the filter
|
||||||
* @param numCommon
|
* @param numCommon
|
||||||
@@ -68,13 +67,13 @@ public final class BoosterUtils {
|
|||||||
public static List<PaperCard> getQuestStarterDeck(final Predicate<PaperCard> filter, final int numCommon,
|
public static List<PaperCard> getQuestStarterDeck(final Predicate<PaperCard> filter, final int numCommon,
|
||||||
final int numUncommon, final int numRare, final StartingPoolPreferences userPrefs) {
|
final int numUncommon, final int numRare, final StartingPoolPreferences userPrefs) {
|
||||||
|
|
||||||
final ArrayList<PaperCard> cards = new ArrayList<PaperCard>();
|
final ArrayList<PaperCard> cards = new ArrayList<>();
|
||||||
|
|
||||||
// Each color should have around the same amount of monocolored cards
|
// Each color should have around the same amount of monocolored cards
|
||||||
// There should be 3 Colorless cards for every 4 cards in a single color
|
// There should be 3 Colorless cards for every 4 cards in a single color
|
||||||
// There should be 1 Multicolor card for every 4 cards in a single color
|
// There should be 1 Multicolor card for every 4 cards in a single color
|
||||||
|
|
||||||
final List<Predicate<CardRules>> colorFilters = new ArrayList<Predicate<CardRules>>();
|
final List<Predicate<CardRules>> colorFilters = new ArrayList<>();
|
||||||
final boolean preferred = (userPrefs != null && userPrefs.getPreferredColor() != MagicColor.ALL_COLORS);
|
final boolean preferred = (userPrefs != null && userPrefs.getPreferredColor() != MagicColor.ALL_COLORS);
|
||||||
final boolean randomized = userPrefs != null && userPrefs.useRandomPool();
|
final boolean randomized = userPrefs != null && userPrefs.useRandomPool();
|
||||||
final int colorBias = (preferred && !randomized) ? FModel.getQuestPreferences().getPrefInt(QPref.STARTING_POOL_COLOR_BIAS) : 0;
|
final int colorBias = (preferred && !randomized) ? FModel.getQuestPreferences().getPrefInt(QPref.STARTING_POOL_COLOR_BIAS) : 0;
|
||||||
@@ -108,23 +107,24 @@ public final class BoosterUtils {
|
|||||||
// This will save CPU time when sets are limited
|
// This will save CPU time when sets are limited
|
||||||
final List<PaperCard> cardpool = Lists.newArrayList(Iterables.filter(FModel.getMagicDb().getCommonCards().getAllCards(), filter));
|
final List<PaperCard> cardpool = Lists.newArrayList(Iterables.filter(FModel.getMagicDb().getCommonCards().getAllCards(), filter));
|
||||||
|
|
||||||
if (userPrefs.grantCompleteSet()) {
|
assert userPrefs != null;
|
||||||
for (PaperCard card : cardpool) {
|
if (userPrefs.grantCompleteSet()) {
|
||||||
cards.add(card);
|
for (PaperCard card : cardpool) {
|
||||||
cards.add(card);
|
cards.add(card);
|
||||||
cards.add(card);
|
cards.add(card);
|
||||||
cards.add(card);
|
cards.add(card);
|
||||||
}
|
cards.add(card);
|
||||||
return cards;
|
}
|
||||||
}
|
return cards;
|
||||||
|
}
|
||||||
|
|
||||||
final Predicate<PaperCard> pCommon = IPaperCard.Predicates.Presets.IS_COMMON;
|
final Predicate<PaperCard> pCommon = IPaperCard.Predicates.Presets.IS_COMMON;
|
||||||
cards.addAll(BoosterUtils.generateDefinetlyColouredCards(cardpool, pCommon, biasAdjustedCommons, colorFilters));
|
cards.addAll(BoosterUtils.generateCards(cardpool, pCommon, biasAdjustedCommons, colorFilters, userPrefs.allowDuplicates()));
|
||||||
|
|
||||||
final Predicate<PaperCard> pUncommon = IPaperCard.Predicates.Presets.IS_UNCOMMON;
|
final Predicate<PaperCard> pUncommon = IPaperCard.Predicates.Presets.IS_UNCOMMON;
|
||||||
cards.addAll(BoosterUtils.generateDefinetlyColouredCards(cardpool, pUncommon, biasAdjustedUncommons, colorFilters));
|
cards.addAll(BoosterUtils.generateCards(cardpool, pUncommon, biasAdjustedUncommons, colorFilters, userPrefs.allowDuplicates()));
|
||||||
|
|
||||||
int nRares = biasAdjustedRares, nMythics = 0;
|
int nRares = biasAdjustedRares, nMythics = 0;
|
||||||
final Predicate<PaperCard> filterMythics = IPaperCard.Predicates.Presets.IS_MYTHIC_RARE;
|
final Predicate<PaperCard> filterMythics = IPaperCard.Predicates.Presets.IS_MYTHIC_RARE;
|
||||||
final boolean haveMythics = Iterables.any(cardpool, filterMythics);
|
final boolean haveMythics = Iterables.any(cardpool, filterMythics);
|
||||||
for (int iSlot = 0; haveMythics && (iSlot < numRare); iSlot++) {
|
for (int iSlot = 0; haveMythics && (iSlot < numRare); iSlot++) {
|
||||||
@@ -136,16 +136,16 @@ public final class BoosterUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Predicate<PaperCard> pRare = IPaperCard.Predicates.Presets.IS_RARE;
|
final Predicate<PaperCard> pRare = IPaperCard.Predicates.Presets.IS_RARE;
|
||||||
cards.addAll(BoosterUtils.generateDefinetlyColouredCards(cardpool, pRare, nRares, colorFilters));
|
cards.addAll(BoosterUtils.generateCards(cardpool, pRare, nRares, colorFilters, false));
|
||||||
if (nMythics > 0) {
|
if (nMythics > 0) {
|
||||||
cards.addAll(BoosterUtils.generateDefinetlyColouredCards(cardpool, filterMythics, nMythics, colorFilters));
|
cards.addAll(BoosterUtils.generateCards(cardpool, filterMythics, nMythics, colorFilters, userPrefs.allowDuplicates()));
|
||||||
}
|
}
|
||||||
return cards;
|
return cards;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the list of card names at random from the given pool.
|
* Create the list of card names at random from the given pool.
|
||||||
*
|
*
|
||||||
* @param source
|
* @param source
|
||||||
* an Iterable<CardPrinted>
|
* an Iterable<CardPrinted>
|
||||||
* @param filter
|
* @param filter
|
||||||
@@ -154,12 +154,16 @@ public final class BoosterUtils {
|
|||||||
* an int
|
* an int
|
||||||
* @param allowedColors
|
* @param allowedColors
|
||||||
* a List<Predicate<CardRules>>
|
* a List<Predicate<CardRules>>
|
||||||
|
* @param allowDuplicates
|
||||||
|
* If true, multiple copies of the same card will be allowed to be generated.
|
||||||
* @return a list of card names
|
* @return a list of card names
|
||||||
*/
|
*/
|
||||||
private static ArrayList<PaperCard> generateDefinetlyColouredCards(final Iterable<PaperCard> source,
|
private static ArrayList<PaperCard> generateCards(
|
||||||
final Predicate<PaperCard> filter, final int cntNeeded, final List<Predicate<CardRules>> allowedColors) {
|
final Iterable<PaperCard> source, final Predicate<PaperCard> filter, final int cntNeeded,
|
||||||
|
final List<Predicate<CardRules>> allowedColors, final boolean allowDuplicates) {
|
||||||
|
|
||||||
// If color is null, use colorOrder progression to grab cards
|
// If color is null, use colorOrder progression to grab cards
|
||||||
final ArrayList<PaperCard> result = new ArrayList<PaperCard>();
|
final ArrayList<PaperCard> result = new ArrayList<>();
|
||||||
|
|
||||||
final int size = allowedColors == null ? 0 : allowedColors.size();
|
final int size = allowedColors == null ? 0 : allowedColors.size();
|
||||||
if (allowedColors != null) {
|
if (allowedColors != null) {
|
||||||
@@ -169,8 +173,7 @@ public final class BoosterUtils {
|
|||||||
int cntMade = 0, iAttempt = 0;
|
int cntMade = 0, iAttempt = 0;
|
||||||
|
|
||||||
// This will prevent endless loop @ wh
|
// This will prevent endless loop @ wh
|
||||||
int allowedMisses = (2 + size + 2) * cntNeeded; // lol, 2+2 is not magic
|
int allowedMisses = (size + 4) * cntNeeded; // lol, 2+2 is not magic constant!
|
||||||
// constant!
|
|
||||||
|
|
||||||
while ((cntMade < cntNeeded) && (allowedMisses > 0)) {
|
while ((cntMade < cntNeeded) && (allowedMisses > 0)) {
|
||||||
PaperCard card = null;
|
PaperCard card = null;
|
||||||
@@ -188,7 +191,7 @@ public final class BoosterUtils {
|
|||||||
card = Aggregates.random(Iterables.filter(source, filter));
|
card = Aggregates.random(Iterables.filter(source, filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((card != null) && !result.contains(card)) {
|
if ((card != null) && (allowDuplicates || !result.contains(card))) {
|
||||||
result.add(card);
|
result.add(card);
|
||||||
cntMade++;
|
cntMade++;
|
||||||
} else {
|
} else {
|
||||||
@@ -206,7 +209,7 @@ public final class BoosterUtils {
|
|||||||
* @param input
|
* @param input
|
||||||
* String, the limitation as text.
|
* String, the limitation as text.
|
||||||
* @return Predicate<CardRules> the text parsed into a CardRules predicate.
|
* @return Predicate<CardRules> the text parsed into a CardRules predicate.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static Predicate<CardRules> parseRulesLimitation(final String input) {
|
public static Predicate<CardRules> parseRulesLimitation(final String input) {
|
||||||
if (null == input || "random".equalsIgnoreCase(input)) {
|
if (null == input || "random".equalsIgnoreCase(input)) {
|
||||||
@@ -240,18 +243,19 @@ public final class BoosterUtils {
|
|||||||
private static List<InventoryItem> parseReward(final String s) {
|
private static List<InventoryItem> parseReward(final String s) {
|
||||||
|
|
||||||
String[] temp = s.split(" ");
|
String[] temp = s.split(" ");
|
||||||
List<InventoryItem> rewards = new ArrayList<InventoryItem>();
|
List<InventoryItem> rewards = new ArrayList<>();
|
||||||
|
|
||||||
// last word starts with 'rare' ignore case
|
// last word starts with 'rare' ignore case
|
||||||
if (temp.length > 1 && temp[temp.length - 1].regionMatches(true, 0, "rare", 0, 4)) {
|
if (temp.length > 1 && temp[temp.length - 1].regionMatches(true, 0, "rare", 0, 4)) {
|
||||||
// Type 1: 'n [color] rares'
|
// Type 1: 'n [color] rares'
|
||||||
final int qty = Integer.parseInt(temp[0]);
|
final int qty = Integer.parseInt(temp[0]);
|
||||||
|
|
||||||
List<Predicate<PaperCard>> preds = new ArrayList<Predicate<PaperCard>>();
|
List<Predicate<PaperCard>> preds = new ArrayList<>();
|
||||||
preds.add(IPaperCard.Predicates.Presets.IS_RARE_OR_MYTHIC); // Determine rarity
|
preds.add(IPaperCard.Predicates.Presets.IS_RARE_OR_MYTHIC); // Determine rarity
|
||||||
|
|
||||||
if (temp.length > 2) {
|
if (temp.length > 2) {
|
||||||
Predicate<CardRules> cr = parseRulesLimitation(temp[1]);
|
Predicate<CardRules> cr = parseRulesLimitation(temp[1]);
|
||||||
|
//noinspection RedundantCast
|
||||||
if (Predicates.alwaysTrue() != (Object) cr) { // guava has a single instance for always-const predicates
|
if (Predicates.alwaysTrue() != (Object) cr) { // guava has a single instance for always-const predicates
|
||||||
preds.add(Predicates.compose(cr, PaperCard.FN_GET_RULES));
|
preds.add(Predicates.compose(cr, PaperCard.FN_GET_RULES));
|
||||||
}
|
}
|
||||||
@@ -295,7 +299,7 @@ public final class BoosterUtils {
|
|||||||
* generateCardRewardList.
|
* generateCardRewardList.
|
||||||
* </p>
|
* </p>
|
||||||
* Takes a reward list string, parses, and returns list of cards rewarded.
|
* Takes a reward list string, parses, and returns list of cards rewarded.
|
||||||
*
|
*
|
||||||
* @param s
|
* @param s
|
||||||
* Properties string of reward (97 multicolor rares)
|
* Properties string of reward (97 multicolor rares)
|
||||||
* @return List<CardPrinted>
|
* @return List<CardPrinted>
|
||||||
@@ -307,7 +311,7 @@ public final class BoosterUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final String[] items = s.split(";");
|
final String[] items = s.split(";");
|
||||||
final List<InventoryItem> rewards = new ArrayList<InventoryItem>();
|
final List<InventoryItem> rewards = new ArrayList<>();
|
||||||
|
|
||||||
for (final String item : items) {
|
for (final String item : items) {
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,11 @@
|
|||||||
package forge.quest;
|
package forge.quest;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
import forge.GuiBase;
|
import forge.GuiBase;
|
||||||
import forge.deck.CardPool;
|
import forge.deck.CardPool;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.DeckSection;
|
import forge.deck.DeckSection;
|
||||||
import forge.item.BoosterBox;
|
import forge.item.*;
|
||||||
import forge.item.BoosterPack;
|
|
||||||
import forge.item.BoxedProduct;
|
|
||||||
import forge.item.FatPack;
|
|
||||||
import forge.item.IPaperCard;
|
|
||||||
import forge.item.InventoryItem;
|
|
||||||
import forge.item.PaperCard;
|
|
||||||
import forge.item.PreconDeck;
|
|
||||||
import forge.item.SealedProduct;
|
|
||||||
import forge.item.TournamentPack;
|
|
||||||
import forge.itemmanager.IItemManager;
|
import forge.itemmanager.IItemManager;
|
||||||
import forge.itemmanager.SItemManagerUtil;
|
import forge.itemmanager.SItemManagerUtil;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
@@ -31,6 +13,13 @@ import forge.properties.ForgePreferences.FPref;
|
|||||||
import forge.quest.io.ReadPriceList;
|
import forge.quest.io.ReadPriceList;
|
||||||
import forge.util.ItemPool;
|
import forge.util.ItemPool;
|
||||||
import forge.util.gui.SOptionPane;
|
import forge.util.gui.SOptionPane;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public class QuestSpellShop {
|
public class QuestSpellShop {
|
||||||
private static Map<String, Integer> mapPrices;
|
private static Map<String, Integer> mapPrices;
|
||||||
@@ -211,9 +200,9 @@ public class QuestSpellShop {
|
|||||||
final List<PaperCard> newCards = booster.getCards();
|
final List<PaperCard> newCards = booster.getCards();
|
||||||
|
|
||||||
itemsToAdd.addAllFlat(newCards);
|
itemsToAdd.addAllFlat(newCards);
|
||||||
|
|
||||||
if (booster instanceof BoxedProduct && FModel.getPreferences().getPrefBoolean(FPref.UI_OPEN_PACKS_INDIV)) {
|
if (booster instanceof BoxedProduct && FModel.getPreferences().getPrefBoolean(FPref.UI_OPEN_PACKS_INDIV)) {
|
||||||
|
|
||||||
int totalPacks = ((BoxedProduct) booster).boosterPacksRemaining();
|
int totalPacks = ((BoxedProduct) booster).boosterPacksRemaining();
|
||||||
boolean skipTheRest = false;
|
boolean skipTheRest = false;
|
||||||
final List<PaperCard> remainingCards = new ArrayList<>();
|
final List<PaperCard> remainingCards = new ArrayList<>();
|
||||||
@@ -233,7 +222,7 @@ public class QuestSpellShop {
|
|||||||
if (remainingCards.size() > 0) {
|
if (remainingCards.size() > 0) {
|
||||||
GuiBase.getInterface().showCardList(booster.getName(), "You have found the following cards inside:", remainingCards);
|
GuiBase.getInterface().showCardList(booster.getName(), "You have found the following cards inside:", remainingCards);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GuiBase.getInterface().showCardList(booster.getName(), "You have found the following cards inside:", newCards);
|
GuiBase.getInterface().showCardList(booster.getName(), "You have found the following cards inside:", newCards);
|
||||||
@@ -279,7 +268,7 @@ public class QuestSpellShop {
|
|||||||
String suffix = SItemManagerUtil.getItemDisplayString(itemFlatList, 1, true);
|
String suffix = SItemManagerUtil.getItemDisplayString(itemFlatList, 1, true);
|
||||||
String displayList = SItemManagerUtil.buildDisplayList(itemsToSell);
|
String displayList = SItemManagerUtil.buildDisplayList(itemsToSell);
|
||||||
String title = "Sell " + suffix;
|
String title = "Sell " + suffix;
|
||||||
|
|
||||||
if (!SOptionPane.showConfirmDialog("Sell the following " + suffix.toLowerCase() + " for " + totalReceived +
|
if (!SOptionPane.showConfirmDialog("Sell the following " + suffix.toLowerCase() + " for " + totalReceived +
|
||||||
" credit" + (totalReceived != 1 ? "s" : "") + "?\n" + displayList, title, "Sell", "Cancel")) {
|
" credit" + (totalReceived != 1 ? "s" : "") + "?\n" + displayList, title, "Sell", "Cancel")) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -6,18 +6,18 @@
|
|||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package forge.quest;
|
package forge.quest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used to store the Quest starting pool preferences.
|
* This class is used to store the Quest starting pool preferences.
|
||||||
* (It could be expanded to store other Quest starting preferences as well,
|
* (It could be expanded to store other Quest starting preferences as well,
|
||||||
* in order to reduce the number of parameters that need to be passed to
|
* in order to reduce the number of parameters that need to be passed to
|
||||||
@@ -28,20 +28,22 @@ public final class StartingPoolPreferences {
|
|||||||
|
|
||||||
private final boolean randomPool;
|
private final boolean randomPool;
|
||||||
private final byte preferredColor;
|
private final byte preferredColor;
|
||||||
private final boolean completeSet;
|
private final boolean completeSet;
|
||||||
|
private final boolean allowDuplicates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constructor.
|
* Creates a new StartingPoolPreferences instance.
|
||||||
* @param random
|
* @param random If true, a completely random pool will be generated without filter restrictions. This does not
|
||||||
* true = use completely random pool without filter restrictions
|
* bypass rarity restrictions.
|
||||||
* (Note that this does NOT bypass card rarity restrictions!)
|
* @param preference Preferred color or colorless. All colors == no preference. See {@link forge.card.MagicColor}.
|
||||||
* @param preference
|
* @param completeSet If true, four of each card in the starting pool will be generated.
|
||||||
* preferred color/COLORLESS (ALL_COLORS = no preference)
|
* @param allowDuplicates If true, multiples of each card will be allowed to be generated.
|
||||||
*/
|
*/
|
||||||
public StartingPoolPreferences(final boolean random, final byte preference, final boolean completeSet) {
|
public StartingPoolPreferences(final boolean random, final byte preference, final boolean completeSet, final boolean allowDuplicates) {
|
||||||
randomPool = random;
|
randomPool = random;
|
||||||
preferredColor = preference;
|
preferredColor = preference;
|
||||||
this.completeSet = completeSet;
|
this.completeSet = completeSet;
|
||||||
|
this.allowDuplicates = allowDuplicates;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,9 +62,13 @@ public final class StartingPoolPreferences {
|
|||||||
public byte getPreferredColor() {
|
public byte getPreferredColor() {
|
||||||
return preferredColor;
|
return preferredColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean grantCompleteSet() {
|
public boolean grantCompleteSet() {
|
||||||
return completeSet;
|
return completeSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean allowDuplicates() {
|
||||||
|
return allowDuplicates;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user