*Added the ability to specify multiple human (hotseat, of course) players or all AI for all variants

This commit is contained in:
Hellfish
2013-11-21 20:25:14 +00:00
parent b51663c130
commit 2f85d50778
8 changed files with 81 additions and 6 deletions

View File

@@ -226,11 +226,11 @@ public enum CSubmenuArchenemy implements ICDoc {
RegisteredPlayer psc = RegisteredPlayer.forArchenemy(playerDecks.get(i), schemes);
psc.setStartingLife(40); // 904.5: The Archenemy has 40 life.
players.add(psc.setPlayer(lobby.getGuiPlayer()));
players.add(psc.setPlayer(view.isPlayerAI(i) ? lobby.getAiPlayer() : lobby.getGuiPlayer()));
} else {
RegisteredPlayer psc = RegisteredPlayer.fromDeck(playerDecks.get(i));
psc.setTeamNumber(0);
players.add(psc.setPlayer(lobby.getAiPlayer()));
players.add(psc.setPlayer(view.isPlayerAI(i) ? lobby.getAiPlayer() : lobby.getGuiPlayer()));
}
}

View File

@@ -152,7 +152,7 @@ public enum CSubmenuCommander implements ICDoc {
Lobby lobby = FServer.instance.getLobby();
List<RegisteredPlayer> helper = new ArrayList<RegisteredPlayer>();
for (int i = 0; i < view.getNumPlayers(); i++) {
LobbyPlayer player = i == 0 ? lobby.getGuiPlayer() : lobby.getAiPlayer();
LobbyPlayer player = view.isPlayerAI(i) ? lobby.getAiPlayer() : lobby.getGuiPlayer();
helper.add(RegisteredPlayer.forCommander(playerDecks.get(i)).setPlayer(player));
}
final Match mc = new Match(GameType.Commander, helper);

View File

@@ -215,7 +215,7 @@ public enum CSubmenuPlanechase implements ICDoc {
GuiDialog.message("Player " + (i+1) + " will use a default planar deck.");
}
LobbyPlayer player = i == 0 ? lobby.getGuiPlayer() : lobby.getAiPlayer();
LobbyPlayer player = view.isPlayerAI(i) ? lobby.getAiPlayer() : lobby.getGuiPlayer();
helper.add(RegisteredPlayer.forPlanechase(playerDecks.get(i), planes).setPlayer(player));
}

View File

@@ -175,7 +175,7 @@ public enum CSubmenuVanguard implements ICDoc {
Lobby lobby = FServer.instance.getLobby();
List<RegisteredPlayer> helper = new ArrayList<RegisteredPlayer>();
for (int i = 0; i < view.getNumPlayers(); i++) {
LobbyPlayer player = i == 0 ? lobby.getGuiPlayer() : lobby.getAiPlayer();
LobbyPlayer player = view.isPlayerAI(i) ? lobby.getAiPlayer() : lobby.getGuiPlayer();
helper.add(RegisteredPlayer.forVanguard(playerDecks.get(i), playerAvatars.get(i)).setPlayer(player));
}
final Match mc = new Match(GameType.Vanguard, helper);

View File

@@ -5,6 +5,7 @@ import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
@@ -68,6 +69,7 @@ public enum VSubmenuArchenemy implements IVSubmenu<CSubmenuArchenemy> {
private final FList<Object> archenemySchemes = new FList<Object>();
private final List<Deck> allSchemeDecks = new ArrayList<Deck>();
private final JCheckBox cbUseDefaultSchemes = new FCheckBox("Use default scheme decks if possible.");
private final List<JRadioButton> playerIsAIRadios = new ArrayList<JRadioButton>();
private final List<JRadioButton> fieldRadios = new ArrayList<JRadioButton>();
private int currentNumTabsShown = 8;
@@ -125,6 +127,19 @@ public enum VSubmenuArchenemy implements IVSubmenu<CSubmenuArchenemy> {
tempChooser.initialize();
deckChoosers.add(tempChooser);
ButtonGroup tempBtnGroup = new ButtonGroup();
FRadioButton tmpAI = new FRadioButton();
tmpAI.setText("AI");
tmpAI.setSelected(i != 0);
FRadioButton tmpHuman = new FRadioButton();
tmpHuman.setText("Human");
tmpHuman.setSelected(i == 0);
tempPanel.add(tmpAI);
tempPanel.add(tmpHuman,"wrap");
tempBtnGroup.add(tmpAI);
tempBtnGroup.add(tmpHuman);
playerIsAIRadios.add(tmpAI);
tempPanel.add(tempChooser, "span 1 2, w 55%!, gap 10px 10px 0px 10px, growy, pushy, wrap");
if (i == 0) {
@@ -155,6 +170,10 @@ public enum VSubmenuArchenemy implements IVSubmenu<CSubmenuArchenemy> {
// ensure we don't fire the selected event before the tabPane is populated
fieldRadios.get(fieldRadios.size() - 1).setSelected(true);
}
public boolean isPlayerAI(int playernum) {
return playerIsAIRadios.get(playernum).isSelected();
}
private void changeTabs(int toShow) {
if (toShow < currentNumTabsShown) {

View File

@@ -61,6 +61,7 @@ public enum VSubmenuCommander implements IVSubmenu<CSubmenuCommander> {
private final FTabbedPane tabPane = new FTabbedPane();
private final List<FPanel> playerPanels = new ArrayList<FPanel>();
private final List<JRadioButton> playerIsAIRadios = new ArrayList<JRadioButton>();
private final List<JRadioButton> fieldRadios = new ArrayList<JRadioButton>();
private final ButtonGroup grpFields = new ButtonGroup();
private int currentNumTabsShown = 8;
@@ -135,10 +136,23 @@ public enum VSubmenuCommander implements IVSubmenu<CSubmenuCommander> {
deckLists.add(tempList);
ButtonGroup tempBtnGroup = new ButtonGroup();
FRadioButton tmpAI = new FRadioButton();
tmpAI.setText("AI");
tmpAI.setSelected(i != 0);
FRadioButton tmpHuman = new FRadioButton();
tmpHuman.setText("Human");
tmpHuman.setSelected(i == 0);
tempPanel.add(tmpAI);
tempPanel.add(tmpHuman,"wrap");
tempBtnGroup.add(tmpAI);
tempBtnGroup.add(tmpHuman);
playerIsAIRadios.add(tmpAI);
tempPanel.add(new FLabel.Builder().text("Select Deck:").build(), "gap 0px 0px 10px 10px, flowy");
JScrollPane scrDecks = new FScrollPane(tempList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
tempPanel.add(scrDecks, "h 90%, gap 0px 10px 0px 10px, growy, pushy, wrap");
tempPanel.add(scrDecks, "w 55%!, h 90%, gap 0px 10px 0px 10px, growy, pushy, wrap");
playerPanels.add(tempPanel);
if (i == 0) {
@@ -151,6 +165,10 @@ public enum VSubmenuCommander implements IVSubmenu<CSubmenuCommander> {
pnlStart.setOpaque(false);
pnlStart.add(btnStart, "span 1 3, growx, pushx, align center");
}
public boolean isPlayerAI(int playernum) {
return playerIsAIRadios.get(playernum).isSelected();
}
private void changeTabs(int toShow) {
if (toShow < currentNumTabsShown) {

View File

@@ -67,6 +67,7 @@ public enum VSubmenuPlanechase implements IVSubmenu<CSubmenuPlanechase> {
private final List<FList<Object>> planarDeckLists = new ArrayList<FList<Object>>();
private final List<Deck> allPlanarDecks = new ArrayList<Deck>();
private final JCheckBox cbUseDefaultPlanes = new FCheckBox("Use default planar decks if possible.");
private final List<JRadioButton> playerIsAIRadios = new ArrayList<JRadioButton>();
private final List<JRadioButton> fieldRadios = new ArrayList<JRadioButton>();
private final ButtonGroup grpFields = new ButtonGroup();
private int currentNumTabsShown = 8;
@@ -97,6 +98,7 @@ public enum VSubmenuPlanechase implements IVSubmenu<CSubmenuPlanechase> {
FPanel tempPanel;
FDeckChooser tempChooser;
FList<Object> tempPlanarDeckList;
ButtonGroup tempBtnGroup;
//Settings panel
FPanel settingsPanel = new FPanel();
@@ -128,6 +130,19 @@ public enum VSubmenuPlanechase implements IVSubmenu<CSubmenuPlanechase> {
tempChooser.initialize();
deckChoosers.add(tempChooser);
tempBtnGroup = new ButtonGroup();
FRadioButton tmpAI = new FRadioButton();
tmpAI.setText("AI");
tmpAI.setSelected(i != 0);
FRadioButton tmpHuman = new FRadioButton();
tmpHuman.setText("Human");
tmpHuman.setSelected(i == 0);
tempPanel.add(tmpAI);
tempPanel.add(tmpHuman,"wrap");
tempBtnGroup.add(tmpAI);
tempBtnGroup.add(tmpHuman);
playerIsAIRadios.add(tmpAI);
tempPanel.add(tempChooser, "span 1 2, w 55%!, gap 10px 10px 0px 10px, growy, pushy, wrap");
@@ -156,6 +171,10 @@ public enum VSubmenuPlanechase implements IVSubmenu<CSubmenuPlanechase> {
pnlStart.add(cbArtifacts, strCheckboxConstraints);
pnlStart.add(cbRemoveSmall, strCheckboxConstraints);
}
public boolean isPlayerAI(int playernum) {
return playerIsAIRadios.get(playernum).isSelected();
}
private void changeTabs(int toShow) {
if (toShow < currentNumTabsShown) {

View File

@@ -79,6 +79,7 @@ public enum VSubmenuVanguard implements IVSubmenu<CSubmenuVanguard> {
private final List<FList<Object>> avatarLists = new ArrayList<FList<Object>>();
private final List<JRadioButton> fieldRadios = new ArrayList<JRadioButton>();
private final List<JRadioButton> playerIsAIRadios = new ArrayList<JRadioButton>();
private final ButtonGroup grpFields = new ButtonGroup();
private final FCheckBox cbDefaultAvatars = new FCheckBox("Use deck-default avatars if possible.");
private final List<CardDetailPanel> cdpAvatarDetails = new ArrayList<CardDetailPanel>();
@@ -145,6 +146,7 @@ public enum VSubmenuVanguard implements IVSubmenu<CSubmenuVanguard> {
FDeckChooser tempChooser;
FList<Object> tempList;
CardDetailPanel tempDetail;
ButtonGroup tempBtnGroup;
//Settings panel
FPanel settingsPanel = new FPanel();
@@ -183,6 +185,19 @@ public enum VSubmenuVanguard implements IVSubmenu<CSubmenuVanguard> {
deckChoosers.add(tempChooser);
avatarLists.add(tempList);
tempBtnGroup = new ButtonGroup();
FRadioButton tmpAI = new FRadioButton();
tmpAI.setText("AI");
tmpAI.setSelected(i != 0);
FRadioButton tmpHuman = new FRadioButton();
tmpHuman.setText("Human");
tmpHuman.setSelected(i == 0);
tempPanel.add(tmpAI);
tempPanel.add(tmpHuman,"wrap");
tempBtnGroup.add(tmpAI);
tempBtnGroup.add(tmpHuman);
playerIsAIRadios.add(tmpAI);
tempPanel.add(tempChooser, "span 1 2, w 55%!, gap 10px 10px 0px 10px, growy, pushy, wrap");
@@ -211,6 +226,10 @@ public enum VSubmenuVanguard implements IVSubmenu<CSubmenuVanguard> {
pnlStart.add(cbArtifacts, strCheckboxConstraints);
pnlStart.add(cbRemoveSmall, strCheckboxConstraints);
}
public boolean isPlayerAI(int playernum) {
return playerIsAIRadios.get(playernum).isSelected();
}
private void changeTabs(int toShow) {
if (toShow < currentNumTabsShown) {