mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
+ Custom deck format for quest mode: 40 cards + 0 or 15 of sideboard, no more than 4 cards of a kind
* All gui.home.sanctioned.CSubmenu* controllers use deck format as specified in GameType
This commit is contained in:
@@ -35,6 +35,7 @@ public enum DeckFormat {
|
|||||||
|
|
||||||
// Main board: allowed size SB: restriction Max distinct non basic cards
|
// Main board: allowed size SB: restriction Max distinct non basic cards
|
||||||
Constructed ( new IntRange(60, Integer.MAX_VALUE), new IntRange(15), 4),
|
Constructed ( new IntRange(60, Integer.MAX_VALUE), new IntRange(15), 4),
|
||||||
|
QuestDeck ( new IntRange(40, Integer.MAX_VALUE), new IntRange(15), 4),
|
||||||
Limited ( new IntRange(40, Integer.MAX_VALUE), null, Integer.MAX_VALUE),
|
Limited ( new IntRange(40, Integer.MAX_VALUE), null, Integer.MAX_VALUE),
|
||||||
Commander ( new IntRange(99), new IntRange(10), 1),
|
Commander ( new IntRange(99), new IntRange(10), 1),
|
||||||
Vanguard ( new IntRange(60, Integer.MAX_VALUE), new IntRange(0), 4),
|
Vanguard ( new IntRange(60, Integer.MAX_VALUE), new IntRange(0), 4),
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public enum GameType {
|
|||||||
Sealed ( DeckFormat.Limited, true, true ),
|
Sealed ( DeckFormat.Limited, true, true ),
|
||||||
Draft ( DeckFormat.Limited, true, true ),
|
Draft ( DeckFormat.Limited, true, true ),
|
||||||
Gauntlet ( DeckFormat.Limited, true, true ),
|
Gauntlet ( DeckFormat.Limited, true, true ),
|
||||||
Quest ( DeckFormat.Constructed, true, true ),
|
Quest ( DeckFormat.QuestDeck, true, true ),
|
||||||
Constructed ( DeckFormat.Constructed, false, true ),
|
Constructed ( DeckFormat.Constructed, false, true ),
|
||||||
Archenemy ( DeckFormat.Archenemy, false, false ),
|
Archenemy ( DeckFormat.Archenemy, false, false ),
|
||||||
Planechase ( DeckFormat.Planechase, false, false ),
|
Planechase ( DeckFormat.Planechase, false, false ),
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import forge.Command;
|
|||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.control.Lobby;
|
import forge.control.Lobby;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.DeckFormat;
|
|
||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
import forge.game.MatchController;
|
import forge.game.MatchController;
|
||||||
import forge.game.MatchStartHelper;
|
import forge.game.MatchStartHelper;
|
||||||
@@ -54,7 +53,7 @@ public enum CSubmenuConstructed implements ICDoc {
|
|||||||
view.getBtnStart().addActionListener(new ActionListener() {
|
view.getBtnStart().addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
startGame();
|
startGame(GameType.Constructed);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -94,12 +93,13 @@ public enum CSubmenuConstructed implements ICDoc {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** @param lists0   {@link java.util.List}<{@link javax.swing.JList}> */
|
/** @param gameType
|
||||||
private void startGame() {
|
* @param lists0   {@link java.util.List}<{@link javax.swing.JList}> */
|
||||||
|
private void startGame(final GameType gameType) {
|
||||||
Deck humanDeck = VSubmenuConstructed.SINGLETON_INSTANCE.getDcHuman().getDeck();
|
Deck humanDeck = VSubmenuConstructed.SINGLETON_INSTANCE.getDcHuman().getDeck();
|
||||||
|
|
||||||
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
|
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
|
||||||
String errorMessage = DeckFormat.Constructed.getDeckConformanceProblem(humanDeck);
|
String errorMessage = gameType.getDecksFormat().getDeckConformanceProblem(humanDeck);
|
||||||
if (null != errorMessage) {
|
if (null != errorMessage) {
|
||||||
JOptionPane.showMessageDialog(null, "Your deck " + errorMessage, "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
JOptionPane.showMessageDialog(null, "Your deck " + errorMessage, "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||||
return;
|
return;
|
||||||
@@ -126,7 +126,7 @@ public enum CSubmenuConstructed implements ICDoc {
|
|||||||
starter.addPlayer(lobby.findLocalPlayer(PlayerType.COMPUTER), aiDeck);
|
starter.addPlayer(lobby.findLocalPlayer(PlayerType.COMPUTER), aiDeck);
|
||||||
|
|
||||||
MatchController mc = Singletons.getModel().getMatch();
|
MatchController mc = Singletons.getModel().getMatch();
|
||||||
mc.initMatch(GameType.Constructed, starter.getPlayerMap());
|
mc.initMatch(gameType, starter.getPlayerMap());
|
||||||
mc.startRound();
|
mc.startRound();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import forge.Singletons;
|
|||||||
import forge.control.FControl;
|
import forge.control.FControl;
|
||||||
import forge.control.Lobby;
|
import forge.control.Lobby;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.DeckFormat;
|
|
||||||
import forge.deck.DeckGroup;
|
import forge.deck.DeckGroup;
|
||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
import forge.game.MatchController;
|
import forge.game.MatchController;
|
||||||
@@ -67,7 +66,7 @@ public enum CSubmenuDraft implements ICDoc {
|
|||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
startGame();
|
startGame(GameType.Draft);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -91,7 +90,7 @@ public enum CSubmenuDraft implements ICDoc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startGame() {
|
private void startGame(final GameType gameType) {
|
||||||
final boolean gauntlet = VSubmenuDraft.SINGLETON_INSTANCE.getRadSingle().isSelected() ? false : true;
|
final boolean gauntlet = VSubmenuDraft.SINGLETON_INSTANCE.getRadSingle().isSelected() ? false : true;
|
||||||
final Deck humanDeck = VSubmenuDraft.SINGLETON_INSTANCE.getLstDecks().getSelectedDeck();
|
final Deck humanDeck = VSubmenuDraft.SINGLETON_INSTANCE.getLstDecks().getSelectedDeck();
|
||||||
final int aiIndex = (int) Math.floor(Math.random() * 8);
|
final int aiIndex = (int) Math.floor(Math.random() * 8);
|
||||||
@@ -101,11 +100,10 @@ public enum CSubmenuDraft implements ICDoc {
|
|||||||
"No deck selected for human!\r\n(You may need to build a new deck.)",
|
"No deck selected for human!\r\n(You may need to build a new deck.)",
|
||||||
"No deck", JOptionPane.ERROR_MESSAGE);
|
"No deck", JOptionPane.ERROR_MESSAGE);
|
||||||
return;
|
return;
|
||||||
} else if (null != DeckFormat.Limited.getDeckConformanceProblem(humanDeck)) {
|
}
|
||||||
JOptionPane.showMessageDialog(null,
|
String errorMessage = gameType.getDecksFormat().getDeckConformanceProblem(humanDeck);
|
||||||
"The selected deck doesn't have enough cards to play (minimum 40)."
|
if (null != errorMessage) {
|
||||||
+ "\r\nUse the deck editor to choose the cards you want before starting.",
|
JOptionPane.showMessageDialog(null, "Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||||
"Invalid deck", JOptionPane.ERROR_MESSAGE);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +111,7 @@ public enum CSubmenuDraft implements ICDoc {
|
|||||||
|
|
||||||
if (gauntlet) {
|
if (gauntlet) {
|
||||||
int rounds = Singletons.getModel().getDecks().getDraft().get(humanDeck.getName()).getAiDecks().size();
|
int rounds = Singletons.getModel().getDecks().getDraft().get(humanDeck.getName()).getAiDecks().size();
|
||||||
Singletons.getModel().getGauntletMini().launch(rounds, humanDeck, GameType.Draft);
|
Singletons.getModel().getGauntletMini().launch(rounds, humanDeck, gameType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import forge.Singletons;
|
|||||||
import forge.control.FControl;
|
import forge.control.FControl;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.deck.DeckBase;
|
import forge.deck.DeckBase;
|
||||||
import forge.deck.DeckFormat;
|
|
||||||
import forge.deck.DeckGroup;
|
import forge.deck.DeckGroup;
|
||||||
import forge.game.limited.ReadDraftRankings;
|
import forge.game.limited.ReadDraftRankings;
|
||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
@@ -73,7 +72,7 @@ public enum CSubmenuSealed implements ICDoc {
|
|||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
startGame();
|
startGame(GameType.Sealed);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -105,7 +104,7 @@ public enum CSubmenuSealed implements ICDoc {
|
|||||||
VSubmenuSealed.SINGLETON_INSTANCE.getLstDecks().setDecks(humanDecks);
|
VSubmenuSealed.SINGLETON_INSTANCE.getLstDecks().setDecks(humanDecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startGame() {
|
private void startGame(final GameType gameType) {
|
||||||
final Deck human = VSubmenuSealed.SINGLETON_INSTANCE.getLstDecks().getSelectedDeck();
|
final Deck human = VSubmenuSealed.SINGLETON_INSTANCE.getLstDecks().getSelectedDeck();
|
||||||
|
|
||||||
if (human == null) {
|
if (human == null) {
|
||||||
@@ -113,17 +112,16 @@ public enum CSubmenuSealed implements ICDoc {
|
|||||||
"Please build and/or select a deck for yourself.",
|
"Please build and/or select a deck for yourself.",
|
||||||
"No deck", JOptionPane.ERROR_MESSAGE);
|
"No deck", JOptionPane.ERROR_MESSAGE);
|
||||||
return;
|
return;
|
||||||
} else if (null != DeckFormat.Limited.getDeckConformanceProblem(human)) {
|
}
|
||||||
JOptionPane.showMessageDialog(null,
|
|
||||||
"The selected deck doesn't have enough cards to play (minimum 40)."
|
String errorMessage = gameType.getDecksFormat().getDeckConformanceProblem(human);
|
||||||
+ "\r\nUse the deck editor to choose the cards you want before starting.",
|
if (null != errorMessage) {
|
||||||
"Invalid deck", JOptionPane.ERROR_MESSAGE);
|
JOptionPane.showMessageDialog(null, "Your deck " + errorMessage + " Please edit or choose a different deck.", "Invalid deck", JOptionPane.ERROR_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int matches = Singletons.getModel().getDecks().getSealed().get(human.getName()).getAiDecks().size();
|
int matches = Singletons.getModel().getDecks().getSealed().get(human.getName()).getAiDecks().size();
|
||||||
|
Singletons.getModel().getGauntletMini().launch(matches, human, gameType);
|
||||||
Singletons.getModel().getGauntletMini().launch(matches, human, GameType.Sealed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|||||||
Reference in New Issue
Block a user