Allow player to start quest with cards defined in a cube. (uniqueness ignored)

This commit is contained in:
Maxmtg
2013-05-18 22:57:49 +00:00
parent ccf9fd4600
commit c4c2865647
3 changed files with 20 additions and 16 deletions

View File

@@ -177,16 +177,9 @@ public enum CSubmenuQuestData implements ICDoc {
fmtStartPool = customFormatCodes.isEmpty() ? null : new GameFormatQuest("Custom", customFormatCodes, null); // chosen sets and no banend cards
break;
case SealedDeck:
dckStartPool = view.getSelectedDeck();
if (null == dckStartPool) {
JOptionPane.showMessageDialog(null, "You have not selected a deck to start", "Cannot start a quest", JOptionPane.ERROR_MESSAGE);
return;
}
break;
case DraftDeck:
case SealedDeck:
case Cube:
dckStartPool = view.getSelectedDeck();
if (null == dckStartPool) {

View File

@@ -131,15 +131,24 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
btnDefineCustomFormat.setVisible(newVal == StartingPoolType.CustomFormat);
lblCustomDeck.setVisible(newVal == StartingPoolType.SealedDeck || newVal == StartingPoolType.DraftDeck);
cbxCustomDeck.setVisible(newVal == StartingPoolType.SealedDeck || newVal == StartingPoolType.DraftDeck);
if (newVal == StartingPoolType.SealedDeck || newVal == StartingPoolType.DraftDeck) {
boolean usesDeckList = newVal == StartingPoolType.SealedDeck || newVal == StartingPoolType.DraftDeck || newVal == StartingPoolType.Cube;
lblCustomDeck.setVisible(usesDeckList);
cbxCustomDeck.setVisible(usesDeckList);
if (usesDeckList) {
cbxCustomDeck.removeAllItems();
CardCollections decks = Singletons.getModel().getDecks();
IStorage<DeckGroup> storage = newVal == StartingPoolType.SealedDeck ? decks.getSealed() : decks.getDraft();
for (DeckGroup d : storage) {
cbxCustomDeck.addItem(d.getHumanDeck());
switch(newVal) {
case SealedDeck:
for (DeckGroup d : decks.getSealed()) { cbxCustomDeck.addItem(d.getHumanDeck()); }
break;
case DraftDeck:
for (DeckGroup d : decks.getDraft()) { cbxCustomDeck.addItem(d.getHumanDeck()); }
break;
case Cube:
for (Deck d : decks.getCubes()) { cbxCustomDeck.addItem(d); }
break;
}
}
}
@@ -208,6 +217,7 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
cbxStartingPool.addItem(StartingPoolType.Precon);
cbxStartingPool.addItem(StartingPoolType.DraftDeck);
cbxStartingPool.addItem(StartingPoolType.SealedDeck);
cbxStartingPool.addItem(StartingPoolType.Cube);
cbxStartingPool.addActionListener(alStartingPool);
// initial adjustment

View File

@@ -6,7 +6,8 @@ public enum StartingPoolType {
CustomFormat("Custom format"),
Precon("Event or starter deck"),
SealedDeck("My sealed deck"),
DraftDeck("My draft deck");
DraftDeck("My draft deck"),
Cube("Predefined cube");
private final String caption;