Enabled historic/casual formats as starting pools for quest mode on desktop

This commit is contained in:
austinio7116
2018-04-08 19:27:20 +01:00
committed by maustin
parent ba793ac44e
commit 00a2a1ef4d
4 changed files with 80 additions and 17 deletions

View File

@@ -90,6 +90,24 @@ public enum CSubmenuQuestData implements ICDoc {
}
});
view.getBtnSelectFormat().setCommand(new UiCommand() {
@Override
public void run() {
final DialogChooseFormats dialog = new DialogChooseFormats();
dialog.setOkCallback(new Runnable() {
@Override
public void run() {
customFormatCodes.clear();
Set<String> sets = new HashSet<String>();
for(GameFormat format:dialog.getSelectedFormats()){
sets.addAll(format.getAllowedSetCodes());
}
customFormatCodes.addAll(sets);
}
});
}
});
view.getBtnPrizeCustomFormat().setCommand(new UiCommand() {
@Override
public void run() {
@@ -104,6 +122,24 @@ public enum CSubmenuQuestData implements ICDoc {
}
});
view.getBtnPrizeSelectFormat().setCommand(new UiCommand() {
@Override
public void run() {
final DialogChooseFormats dialog = new DialogChooseFormats();
dialog.setOkCallback(new Runnable() {
@Override
public void run() {
customPrizeFormatCodes.clear();
Set<String> sets = new HashSet<String>();
for(GameFormat format:dialog.getSelectedFormats()){
sets.addAll(format.getAllowedSetCodes());
}
customPrizeFormatCodes.addAll(sets);
}
});
}
});
view.getBtnPreferredColors().setCommand(new UiCommand() {
@Override
public void run() {
@@ -197,10 +233,11 @@ public enum CSubmenuQuestData implements ICDoc {
if (worldFormat == null) {
switch(view.getStartingPoolType()) {
case Rotating:
case Sanctioned:
fmtStartPool = view.getRotatingFormat();
break;
case Casual:
case CustomFormat:
if (customFormatCodes.isEmpty()) {
if (!FOptionPane.showConfirmDialog("You have defined a custom format that doesn't contain any sets.\nThis will start a game without restriction.\n\nContinue?")) {
@@ -257,6 +294,7 @@ public enum CSubmenuQuestData implements ICDoc {
case Complete:
fmtPrizes = null;
break;
case Casual:
case CustomFormat:
if (customPrizeFormatCodes.isEmpty()) {
if (!FOptionPane.showConfirmDialog("You have defined custom format as containing no sets.\nThis will choose all editions without restriction as prizes.\n\nContinue?")) {
@@ -265,7 +303,7 @@ public enum CSubmenuQuestData implements ICDoc {
}
fmtPrizes = customPrizeFormatCodes.isEmpty() ? null : new GameFormat("Custom Prizes", customPrizeFormatCodes, null); // chosen sets and no banned cards
break;
case Rotating:
case Sanctioned:
fmtPrizes = view.getPrizedRotatingFormat();
break;
default:

View File

@@ -82,6 +82,8 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
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 btnSelectFormat = new FLabel.Builder().opaque(true).hoverable(true).text("Select format").build();
private final FCheckBox boxCompleteSet = new FCheckBox("Start with all cards in selected sets");
private final FCheckBox boxAllowDuplicates = new FCheckBox("Allow duplicate cards");
@@ -91,6 +93,8 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
private final FLabel btnPrizeDefineCustomFormat = new FLabel.Builder().opaque(true).hoverable(true).text("Define custom format").build();
private final FLabel btnPrizeSelectFormat = new FLabel.Builder().opaque(true).hoverable(true).text("Select format").build();
private final FLabel lblPrizedCards = new FLabel.Builder().text("Prized cards:").build();
private final FComboBoxWrapper<Object> cbxPrizedCards = new FComboBoxWrapper<>();
@@ -116,10 +120,11 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
lblPreconDeck.setVisible(newVal == StartingPoolType.Precon);
cbxPreconDeck.setVisible(newVal == StartingPoolType.Precon);
lblFormat.setVisible(newVal == StartingPoolType.Rotating);
cbxFormat.setVisible(newVal == StartingPoolType.Rotating);
lblFormat.setVisible(newVal == StartingPoolType.Sanctioned);
cbxFormat.setVisible(newVal == StartingPoolType.Sanctioned);
btnDefineCustomFormat.setVisible(newVal == StartingPoolType.CustomFormat);
btnSelectFormat.setVisible(newVal == StartingPoolType.Casual);
final boolean usesDeckList = newVal == StartingPoolType.SealedDeck || newVal == StartingPoolType.DraftDeck || newVal == StartingPoolType.Cube;
@@ -152,9 +157,10 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
lblPrizeUnrestricted.setVisible(newVal == StartingPoolType.Complete);
cboAllowUnlocks.setVisible(newVal != StartingPoolType.Complete);
lblPrizeFormat.setVisible(newVal == StartingPoolType.Rotating);
cbxPrizeFormat.setVisible(newVal == StartingPoolType.Rotating);
lblPrizeFormat.setVisible(newVal == StartingPoolType.Sanctioned);
cbxPrizeFormat.setVisible(newVal == StartingPoolType.Sanctioned);
btnPrizeDefineCustomFormat.setVisible(newVal == StartingPoolType.CustomFormat);
btnPrizeSelectFormat.setVisible(newVal == StartingPoolType.Casual);
lblPrizeSameAsStarting.setVisible(newVal == null);
}
};
@@ -200,7 +206,8 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
boxAllowDuplicates.setToolTipText("When your starting pool is generated, duplicates of cards may be included.");
cbxStartingPool.addItem(StartingPoolType.Complete);
cbxStartingPool.addItem(StartingPoolType.Rotating);
cbxStartingPool.addItem(StartingPoolType.Sanctioned);
cbxStartingPool.addItem(StartingPoolType.Casual);
cbxStartingPool.addItem(StartingPoolType.CustomFormat);
cbxStartingPool.addItem(StartingPoolType.Precon);
cbxStartingPool.addItem(StartingPoolType.DraftDeck);
@@ -214,7 +221,8 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
cbxPrizedCards.addItem("Same as starting pool");
cbxPrizedCards.addItem(StartingPoolType.Complete);
cbxPrizedCards.addItem(StartingPoolType.Rotating);
cbxPrizedCards.addItem(StartingPoolType.Sanctioned);
cbxPrizedCards.addItem(StartingPoolType.Casual);
cbxPrizedCards.addItem(StartingPoolType.CustomFormat);
cbxPrizedCards.addActionListener(alPrizesPool);
@@ -311,6 +319,7 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
cbxFormat.addTo(pnlRestrictions, constraints + cboWidthStart + " cell 1 1");
pnlRestrictions.add(btnDefineCustomFormat, btnStartingCustomFormatWidth + constraints + hidemode + " cell 1 1");
pnlRestrictions.add(btnSelectFormat, btnStartingCustomFormatWidth + constraints + hidemode + " cell 1 1");
pnlRestrictions.add(boxAllowDuplicates, "h 15px!, cell 1 2");
pnlRestrictions.add(boxCompleteSet, "h 15px!, cell 1 3");
@@ -325,6 +334,7 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
pnlRestrictions.add(lblPrizeFormat, constraints + hidemode + "cell 0 6");
cbxPrizeFormat.addTo(pnlRestrictions, constraints + cboWidthStart + "cell 1 6"); // , skip 1
pnlRestrictions.add(btnPrizeDefineCustomFormat, btnStartingCustomFormatWidth + constraints + hidemode + "cell 1 6");
pnlRestrictions.add(btnPrizeSelectFormat, btnStartingCustomFormatWidth + constraints + hidemode + "cell 1 6");
pnlRestrictions.add(lblPrizeSameAsStarting, constraints + hidemode + "cell 1 6");
pnlRestrictions.add(lblPrizeUnrestricted, constraints + hidemode + "cell 1 6");
@@ -498,9 +508,23 @@ public enum VSubmenuQuestData implements IVSubmenu<CSubmenuQuestData> {
return cbxPrizeFormat.getSelectedItem();
}
public GameFormat getCasualFormat() {
return cbxFormat.getSelectedItem();
}
public GameFormat getPrizedCasualFormat() {
return cbxPrizeFormat.getSelectedItem();
}
public FLabel getBtnCustomFormat() {
return btnDefineCustomFormat;
}
public FLabel getBtnSelectFormat() {
return btnSelectFormat;
}
public FLabel getBtnPrizeSelectFormat() {
return btnPrizeSelectFormat;
}
public FLabel getBtnPrizeCustomFormat() {
return btnPrizeDefineCustomFormat;
}

View File

@@ -183,7 +183,7 @@ public class NewQuestScreen extends FScreen {
super(null, NewGameMenu.getMenu());
cbxStartingPool.addItem(StartingPoolType.Complete);
cbxStartingPool.addItem(StartingPoolType.Rotating);
cbxStartingPool.addItem(StartingPoolType.Sanctioned);
cbxStartingPool.addItem(StartingPoolType.CustomFormat);
cbxStartingPool.addItem(StartingPoolType.Precon);
cbxStartingPool.addItem(StartingPoolType.DraftDeck);
@@ -199,7 +199,7 @@ public class NewQuestScreen extends FScreen {
cbxPrizedCards.addItem("Same as starting pool");
cbxPrizedCards.addItem(StartingPoolType.Complete);
cbxPrizedCards.addItem(StartingPoolType.Rotating);
cbxPrizedCards.addItem(StartingPoolType.Sanctioned);
cbxPrizedCards.addItem(StartingPoolType.CustomFormat);
cbxPrizedCards.setChangedHandler(new FEventHandler() {
@Override
@@ -331,8 +331,8 @@ public class NewQuestScreen extends FScreen {
lblPreconDeck.setVisible(newVal == StartingPoolType.Precon);
cbxPreconDeck.setVisible(newVal == StartingPoolType.Precon);
lblFormat.setVisible(newVal == StartingPoolType.Rotating);
cbxFormat.setVisible(newVal == StartingPoolType.Rotating);
lblFormat.setVisible(newVal == StartingPoolType.Sanctioned);
cbxFormat.setVisible(newVal == StartingPoolType.Sanctioned);
btnDefineCustomFormat.setVisible(newVal == StartingPoolType.CustomFormat);
@@ -370,8 +370,8 @@ public class NewQuestScreen extends FScreen {
lblPrizeUnrestricted.setVisible(newVal == StartingPoolType.Complete);
cbAllowUnlocks.setVisible(newVal != StartingPoolType.Complete);
lblPrizeFormat.setVisible(newVal == StartingPoolType.Rotating);
cbxPrizeFormat.setVisible(newVal == StartingPoolType.Rotating);
lblPrizeFormat.setVisible(newVal == StartingPoolType.Sanctioned);
cbxPrizeFormat.setVisible(newVal == StartingPoolType.Sanctioned);
btnPrizeDefineCustomFormat.setVisible(newVal == StartingPoolType.CustomFormat);
lblPrizeSameAsStarting.setVisible(newVal == null);
@@ -505,7 +505,7 @@ public class NewQuestScreen extends FScreen {
if (worldFormat == null) {
switch(getStartingPoolType()) {
case Rotating:
case Sanctioned:
fmtStartPool = getRotatingFormat();
break;
@@ -578,7 +578,7 @@ public class NewQuestScreen extends FScreen {
}
fmtPrizes = customPrizeFormatCodes.isEmpty() ? null : new GameFormat("Custom Prizes", customPrizeFormatCodes, null); // chosen sets and no banned cards
break;
case Rotating:
case Sanctioned:
fmtPrizes = getPrizedRotatingFormat();
break;
default:

View File

@@ -2,7 +2,8 @@ package forge.quest;
public enum StartingPoolType {
Complete("Unrestricted"),
Rotating("Defined format"),
Sanctioned("Sanctioned format"),
Casual("Casual/Historic format"),
CustomFormat("Custom format"),
Precon("Event or starter deck"),
SealedDeck("My sealed deck"),