forked from External/mage
Add colorless mana filter to deck generator.
This commit is contained in:
parent
6cfe43e9b7
commit
89bce030d0
4 changed files with 24 additions and 5 deletions
|
|
@ -155,7 +155,7 @@ public class DeckGenerator {
|
|||
* @return the final deck to use.
|
||||
*/
|
||||
private static Deck generateDeck(int deckSize, List<ColoredManaSymbol> allowedColors, List<String> setsToUse) {
|
||||
genPool = new DeckGeneratorPool(deckSize, allowedColors, genDialog.isSingleton());
|
||||
genPool = new DeckGeneratorPool(deckSize, allowedColors, genDialog.isSingleton(), genDialog.isColorless());
|
||||
|
||||
final String[] sets = setsToUse.toArray(new String[setsToUse.size()]);
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class DeckGeneratorDialog {
|
|||
private JComboBox<String> cbSets;
|
||||
private JComboBox<String> cbDeckSize;
|
||||
private JButton btnGenerate, btnCancel;
|
||||
private JCheckBox cArtifacts, cSingleton, cNonBasicLands;
|
||||
private JCheckBox cArtifacts, cSingleton, cNonBasicLands, cColorless;
|
||||
private SimpleDateFormat dateFormat;
|
||||
|
||||
public DeckGeneratorDialog()
|
||||
|
|
@ -138,8 +138,15 @@ public class DeckGeneratorDialog {
|
|||
cNonBasicLands.setSelected(Boolean.valueOf(nonBasicEnabled));
|
||||
jCheckBoxes.add(cNonBasicLands);
|
||||
|
||||
jCheckBoxes.setPreferredSize(new Dimension(300, 25));
|
||||
jCheckBoxes.setMaximumSize(new Dimension(300, 25));
|
||||
// Non-basic lands
|
||||
cColorless = new JCheckBox("Colorless mana", false);
|
||||
cColorless.setToolTipText("Allow cards with colorless mana cost.");
|
||||
String colorlessEnabled = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_DECK_GENERATOR_COLORLESS, "false");
|
||||
cColorless.setSelected(Boolean.valueOf(colorlessEnabled));
|
||||
jCheckBoxes.add(cColorless);
|
||||
|
||||
jCheckBoxes.setPreferredSize(new Dimension(450, 25));
|
||||
jCheckBoxes.setMaximumSize(new Dimension(450, 25));
|
||||
p0.add(jCheckBoxes);
|
||||
|
||||
btnGenerate = new JButton("Ok");
|
||||
|
|
@ -205,6 +212,12 @@ public class DeckGeneratorDialog {
|
|||
return selected;
|
||||
}
|
||||
|
||||
public boolean isColorless() {
|
||||
boolean selected = cColorless.isSelected();
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_DECK_GENERATOR_COLORLESS, Boolean.toString(selected));
|
||||
return selected;
|
||||
}
|
||||
|
||||
public boolean useArtifacts() {
|
||||
boolean selected = cArtifacts.isSelected();
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_DECK_GENERATOR_ARTIFACTS, Boolean.toString(selected));
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public class DeckGeneratorPool
|
|||
private static final int NONCREATURE_COUNT_60 = 13;
|
||||
|
||||
private final List<ColoredManaSymbol> allowedColors;
|
||||
private boolean colorlessAllowed;
|
||||
private final List<DeckGeneratorCMC> poolCMCs;
|
||||
private final int creatureCount;
|
||||
private final int nonCreatureCount;
|
||||
|
|
@ -68,11 +69,12 @@ public class DeckGeneratorPool
|
|||
private List<Card> reserveSpells = new ArrayList<>();
|
||||
private Deck deck;
|
||||
|
||||
public DeckGeneratorPool(final int deckSize, final List<ColoredManaSymbol> allowedColors, boolean isSingleton)
|
||||
public DeckGeneratorPool(final int deckSize, final List<ColoredManaSymbol> allowedColors, boolean isSingleton, boolean colorlessAllowed)
|
||||
{
|
||||
this.deckSize = deckSize;
|
||||
this.allowedColors = allowedColors;
|
||||
this.isSingleton = isSingleton;
|
||||
this.colorlessAllowed = colorlessAllowed;
|
||||
|
||||
this.deck = new Deck();
|
||||
|
||||
|
|
@ -207,6 +209,9 @@ public class DeckGeneratorPool
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (symbol.equals("C") && !colorlessAllowed) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_NEW_DECK_GENERATOR_SINGLETON = "newDeckGeneratorSingleton";
|
||||
public static final String KEY_NEW_DECK_GENERATOR_ARTIFACTS = "newDeckGeneratorArtifacts";
|
||||
public static final String KEY_NEW_DECK_GENERATOR_NON_BASIC_LANDS = "newDeckGeneratorNonBasicLands";
|
||||
public static final String KEY_NEW_DECK_GENERATOR_COLORLESS = "newDeckGeneratorColorless";
|
||||
|
||||
// used to save and restore the settings for the cardArea (draft, sideboarding, deck builder)
|
||||
public static final String KEY_DRAFT_VIEW = "draftView";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue