mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
spjspj - Add option of 'Number of Seats'. This is for Tournaments so that you can draft say a 4 way draft and then have a 4 way game at the end of it.
This commit is contained in:
parent
101a1db649
commit
16bb17e5bb
14 changed files with 366 additions and 60 deletions
|
|
@ -378,7 +378,7 @@ public class NewTableDialog extends MageDialog {
|
||||||
|
|
||||||
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
|
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
|
||||||
GameTypeView gameType = (GameTypeView) cbGameType.getSelectedItem();
|
GameTypeView gameType = (GameTypeView) cbGameType.getSelectedItem();
|
||||||
MatchOptions options = new MatchOptions(this.txtName.getText(), gameType.getName());
|
MatchOptions options = new MatchOptions(this.txtName.getText(), gameType.getName(), false, 2);
|
||||||
options.getPlayerTypes().add("Human");
|
options.getPlayerTypes().add("Human");
|
||||||
for (TablePlayerPanel player : players) {
|
for (TablePlayerPanel player : players) {
|
||||||
options.getPlayerTypes().add(player.getPlayerType());
|
options.getPlayerTypes().add(player.getPlayerType());
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,8 @@
|
||||||
<Component id="pnlPacks" alignment="1" max="32767" attributes="0"/>
|
<Component id="pnlPacks" alignment="1" max="32767" attributes="0"/>
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<Group type="102" alignment="1" attributes="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0"> <Component id="lblNbrPlayers" min="-2" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/> <Component id="spnNumPlayers" min="-2" pref="46" max="-2" attributes="0"/> </Group>
|
||||||
<Component id="lblNbrPlayers" min="-2" max="-2" attributes="0"/>
|
<Group type="102" alignment="0" attributes="0"> <Component id="lblNbrSeats" min="-2" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/> <Component id="spnNumSeats" min="-2" pref="46" max="-2" attributes="0"/> </Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="spnNumPlayers" min="-2" pref="46" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="lblPacks" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="lblPacks" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="lblPlayer1" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="lblPlayer1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
@ -175,6 +172,7 @@
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="lblPacks" min="-2" max="-2" attributes="0"/>
|
<Component id="lblPacks" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
|
||||||
<Group type="103" groupAlignment="1" attributes="0">
|
<Group type="103" groupAlignment="1" attributes="0">
|
||||||
<Group type="102" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<Component id="pnlPacks" min="-2" max="-2" attributes="0"/>
|
<Component id="pnlPacks" min="-2" max="-2" attributes="0"/>
|
||||||
|
|
@ -192,6 +190,11 @@
|
||||||
<Component id="pnlDraftOptions" alignment="1" pref="0" max="32767" attributes="1"/>
|
<Component id="pnlDraftOptions" alignment="1" pref="0" max="32767" attributes="1"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||||
|
<Component id="lblNbrSeats" alignment="1" max="32767" attributes="0"/>
|
||||||
|
<Component id="spnNumSeats" alignment="1" max="32767" attributes="1"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="lblPlayer1" min="-2" pref="25" max="-2" attributes="0"/>
|
<Component id="lblPlayer1" min="-2" pref="25" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
|
@ -200,6 +203,7 @@
|
||||||
<Component id="chkRollbackTurnsAllowed" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="chkRollbackTurnsAllowed" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="player1Panel" min="-2" pref="62" max="-2" attributes="0"/>
|
<Component id="player1Panel" min="-2" pref="62" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
|
@ -377,15 +381,17 @@
|
||||||
<Property name="rows" type="int" value="0"/>
|
<Property name="rows" type="int" value="0"/>
|
||||||
</Layout>
|
</Layout>
|
||||||
</Container>
|
</Container>
|
||||||
<Component class="javax.swing.JLabel" name="lblNbrPlayers">
|
<Component class="javax.swing.JLabel" name="lblNbrPlayers"> <Properties> <Property name="text" type="java.lang.String" value="Players:"/> </Properties> </Component>
|
||||||
<Properties>
|
<Component class="javax.swing.JLabel" name="lblNbrSeats"> <Properties> <Property name="text" type="java.lang.String" value="Seats:"/> </Properties> </Component>
|
||||||
<Property name="text" type="java.lang.String" value="Players:"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JSpinner" name="spnNumPlayers">
|
<Component class="javax.swing.JSpinner" name="spnNumPlayers">
|
||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spnNumPlayersStateChanged"/>
|
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spnNumPlayersStateChanged"/>
|
||||||
</Events>
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JSpinner" name="spnNumSeats">
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spnNumSeatsStateChanged"/>
|
||||||
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Container class="javax.swing.JPanel" name="pnlDraftOptions">
|
<Container class="javax.swing.JPanel" name="pnlDraftOptions">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,8 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
pnlPacks = new javax.swing.JPanel();
|
pnlPacks = new javax.swing.JPanel();
|
||||||
lblNbrPlayers = new javax.swing.JLabel();
|
lblNbrPlayers = new javax.swing.JLabel();
|
||||||
spnNumPlayers = new javax.swing.JSpinner();
|
spnNumPlayers = new javax.swing.JSpinner();
|
||||||
|
lblNbrSeats = new javax.swing.JLabel();
|
||||||
|
spnNumSeats = new javax.swing.JSpinner();
|
||||||
pnlDraftOptions = new javax.swing.JPanel();
|
pnlDraftOptions = new javax.swing.JPanel();
|
||||||
jLabel6 = new javax.swing.JLabel();
|
jLabel6 = new javax.swing.JLabel();
|
||||||
cbDraftTiming = new javax.swing.JComboBox();
|
cbDraftTiming = new javax.swing.JComboBox();
|
||||||
|
|
@ -277,6 +279,14 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
lblNbrSeats.setText("Seats:");
|
||||||
|
|
||||||
|
spnNumSeats.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||||
|
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||||
|
spnNumSeatsStateChanged(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
jLabel6.setText("Timing:");
|
jLabel6.setText("Timing:");
|
||||||
|
|
||||||
cbDraftTiming.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
cbDraftTiming.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||||
|
|
@ -358,6 +368,8 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
lblQuitRatio.setText("Allowed quit %:");
|
lblQuitRatio.setText("Allowed quit %:");
|
||||||
|
|
||||||
spnQuitRatio.setToolTipText("Players with quit % more than this value can't join this table");
|
spnQuitRatio.setToolTipText("Players with quit % more than this value can't join this table");
|
||||||
|
spnNumSeats.setToolTipText("The number of seats for each duel. If more than 2, will set number of wins to 1");
|
||||||
|
spnNumPlayers.setToolTipText("The total number of players who will draft");
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
|
|
@ -373,7 +385,11 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addComponent(lblNbrPlayers)
|
.addComponent(lblNbrPlayers)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(lblNbrSeats)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(spnNumSeats, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addComponent(lblPacks)
|
.addComponent(lblPacks)
|
||||||
.addComponent(lblPlayer1))
|
.addComponent(lblPlayer1))
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
|
@ -504,6 +520,8 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
.addComponent(lblNumRounds))
|
.addComponent(lblNumRounds))
|
||||||
.addComponent(lblNbrPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(lblNbrPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addComponent(spnNumPlayers)
|
.addComponent(spnNumPlayers)
|
||||||
|
.addComponent(lblNbrSeats, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addComponent(spnNumSeats)
|
||||||
.addComponent(pnlDraftOptions, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
|
.addComponent(pnlDraftOptions, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(lblPlayer1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(lblPlayer1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
|
@ -533,7 +551,8 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
|
|
||||||
private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed
|
private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed
|
||||||
TournamentTypeView tournamentType = (TournamentTypeView) cbTournamentType.getSelectedItem();
|
TournamentTypeView tournamentType = (TournamentTypeView) cbTournamentType.getSelectedItem();
|
||||||
TournamentOptions tOptions = new TournamentOptions(this.txtName.getText());
|
int numSeats = (Integer)this.spnNumSeats.getValue();
|
||||||
|
TournamentOptions tOptions = new TournamentOptions(this.txtName.getText(), "", numSeats);
|
||||||
tOptions.setTournamentType(tournamentType.getName());
|
tOptions.setTournamentType(tournamentType.getName());
|
||||||
tOptions.setPassword(txtPassword.getText());
|
tOptions.setPassword(txtPassword.getText());
|
||||||
tOptions.getPlayerTypes().add("Human");
|
tOptions.getPlayerTypes().add("Human");
|
||||||
|
|
@ -653,13 +672,51 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
this.hideDialog();
|
this.hideDialog();
|
||||||
}//GEN-LAST:event_btnCancelActionPerformed
|
}//GEN-LAST:event_btnCancelActionPerformed
|
||||||
|
|
||||||
|
private void updateNumSeats() {
|
||||||
|
int numPlayers = (Integer)this.spnNumPlayers.getValue();
|
||||||
|
int numSeats = (Integer)this.spnNumSeats.getValue();
|
||||||
|
|
||||||
|
if (numSeats > 2) {
|
||||||
|
TournamentTypeView tournamentType = (TournamentTypeView) cbTournamentType.getSelectedItem();
|
||||||
|
if (numSeats >= tournamentType.getMinPlayers()) {
|
||||||
|
createPlayers(numSeats - 1);
|
||||||
|
spnNumPlayers.setValue(numSeats);
|
||||||
|
} else {
|
||||||
|
numSeats = tournamentType.getMinPlayers();
|
||||||
|
createPlayers(numSeats - 1);
|
||||||
|
spnNumPlayers.setValue(numSeats);
|
||||||
|
spnNumSeats.setValue(numSeats);
|
||||||
|
}
|
||||||
|
spnNumWins.setValue(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void spnNumPlayersStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnNumPlayersStateChanged
|
private void spnNumPlayersStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnNumPlayersStateChanged
|
||||||
int numPlayers = (Integer)this.spnNumPlayers.getValue() - 1;
|
int numPlayers = (Integer)this.spnNumPlayers.getValue();
|
||||||
createPlayers(numPlayers);
|
createPlayers(numPlayers - 1);
|
||||||
|
int numSeats = (Integer)this.spnNumSeats.getValue();
|
||||||
|
if (numSeats > 2 && numPlayers != numSeats) {
|
||||||
|
updateNumSeats();
|
||||||
|
}
|
||||||
}//GEN-LAST:event_spnNumPlayersStateChanged
|
}//GEN-LAST:event_spnNumPlayersStateChanged
|
||||||
|
|
||||||
|
private void spnNumSeatsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnNumSeatsStateChanged
|
||||||
|
int numSeats = (Integer)this.spnNumSeats.getValue();
|
||||||
|
if (numSeats > 2) {
|
||||||
|
this.spnNumPlayers.setEnabled(false);
|
||||||
|
} else {
|
||||||
|
this.spnNumPlayers.setEnabled(true);
|
||||||
|
}
|
||||||
|
updateNumSeats();
|
||||||
|
}//GEN-LAST:event_spnNumSeatsStateChanged
|
||||||
|
|
||||||
|
|
||||||
private void spnNumWinsnumPlayersChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnNumWinsnumPlayersChanged
|
private void spnNumWinsnumPlayersChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnNumWinsnumPlayersChanged
|
||||||
// TODO add your handling code here:
|
int numSeats = (Integer)this.spnNumSeats.getValue();
|
||||||
|
int numWins = (Integer)this.spnNumSeats.getValue();
|
||||||
|
if (numSeats > 2) {
|
||||||
|
spnNumWins.setValue(1);
|
||||||
|
}
|
||||||
}//GEN-LAST:event_spnNumWinsnumPlayersChanged
|
}//GEN-LAST:event_spnNumWinsnumPlayersChanged
|
||||||
|
|
||||||
private JFileChooser fcSelectDeck = null;
|
private JFileChooser fcSelectDeck = null;
|
||||||
|
|
@ -726,6 +783,8 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
this.spnNumPlayers.setEnabled(tournamentType.getMinPlayers() != tournamentType.getMaxPlayers());
|
this.spnNumPlayers.setEnabled(tournamentType.getMinPlayers() != tournamentType.getMaxPlayers());
|
||||||
createPlayers((Integer) spnNumPlayers.getValue() - 1);
|
createPlayers((Integer) spnNumPlayers.getValue() - 1);
|
||||||
|
|
||||||
|
this.spnNumSeats.setModel(new SpinnerNumberModel(2, 2, tournamentType.getMaxPlayers(), 1));
|
||||||
|
|
||||||
if (tournamentType.isLimited()) {
|
if (tournamentType.isLimited()) {
|
||||||
this.isRandom = tournamentType.isRandom();
|
this.isRandom = tournamentType.isRandom();
|
||||||
this.isRichMan = tournamentType.isRichMan();
|
this.isRichMan = tournamentType.isRichMan();
|
||||||
|
|
@ -914,6 +973,8 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void drawPlayers() {
|
private void drawPlayers() {
|
||||||
this.pnlOtherPlayers.removeAll();
|
this.pnlOtherPlayers.removeAll();
|
||||||
for (TournamentPlayerPanel panel: players) {
|
for (TournamentPlayerPanel panel: players) {
|
||||||
|
|
@ -1119,6 +1180,7 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
private javax.swing.JLabel lblGameType;
|
private javax.swing.JLabel lblGameType;
|
||||||
private javax.swing.JLabel lblName;
|
private javax.swing.JLabel lblName;
|
||||||
private javax.swing.JLabel lblNbrPlayers;
|
private javax.swing.JLabel lblNbrPlayers;
|
||||||
|
private javax.swing.JLabel lblNbrSeats;
|
||||||
private javax.swing.JLabel lblNumRounds;
|
private javax.swing.JLabel lblNumRounds;
|
||||||
private javax.swing.JLabel lblNumWins;
|
private javax.swing.JLabel lblNumWins;
|
||||||
private javax.swing.JLabel lblPacks;
|
private javax.swing.JLabel lblPacks;
|
||||||
|
|
@ -1135,6 +1197,7 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
private javax.swing.JSpinner spnConstructTime;
|
private javax.swing.JSpinner spnConstructTime;
|
||||||
private javax.swing.JSpinner spnFreeMulligans;
|
private javax.swing.JSpinner spnFreeMulligans;
|
||||||
private javax.swing.JSpinner spnNumPlayers;
|
private javax.swing.JSpinner spnNumPlayers;
|
||||||
|
private javax.swing.JSpinner spnNumSeats;
|
||||||
private javax.swing.JSpinner spnNumRounds;
|
private javax.swing.JSpinner spnNumRounds;
|
||||||
private javax.swing.JSpinner spnNumWins;
|
private javax.swing.JSpinner spnNumWins;
|
||||||
private javax.swing.JSpinner spnQuitRatio;
|
private javax.swing.JSpinner spnQuitRatio;
|
||||||
|
|
|
||||||
|
|
@ -1272,7 +1272,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MatchOptions options = new MatchOptions("1", "Two Player Duel");
|
MatchOptions options = new MatchOptions("1", "Two Player Duel", false, 2);
|
||||||
options.getPlayerTypes().add("Human");
|
options.getPlayerTypes().add("Human");
|
||||||
options.getPlayerTypes().add("Computer - mad");
|
options.getPlayerTypes().add("Computer - mad");
|
||||||
options.setDeckType("Limited");
|
options.setDeckType("Limited");
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ import mage.game.events.TableEvent;
|
||||||
import mage.game.match.Match;
|
import mage.game.match.Match;
|
||||||
import mage.game.match.MatchOptions;
|
import mage.game.match.MatchOptions;
|
||||||
import mage.game.result.ResultProtos.TourneyQuitStatus;
|
import mage.game.result.ResultProtos.TourneyQuitStatus;
|
||||||
|
import mage.game.tournament.MultiplayerRound;
|
||||||
import mage.game.tournament.Tournament;
|
import mage.game.tournament.Tournament;
|
||||||
import mage.game.tournament.TournamentPairing;
|
import mage.game.tournament.TournamentPairing;
|
||||||
import mage.game.tournament.TournamentPlayer;
|
import mage.game.tournament.TournamentPlayer;
|
||||||
|
|
@ -114,6 +115,19 @@ public class TournamentController {
|
||||||
startMatch(event.getPair(), event.getMatchOptions());
|
startMatch(event.getPair(), event.getMatchOptions());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case START_MULTIPLAYER_MATCH:
|
||||||
|
if (!isAbort()) {
|
||||||
|
initTournament(); // set state
|
||||||
|
MatchOptions matchOptions = event.getMatchOptions();
|
||||||
|
if (matchOptions != null && event.getMultiplayerRound() != null) {
|
||||||
|
for (TournamentPlayer player : event.getMultiplayerRound().getAllPlayers()) {
|
||||||
|
matchOptions.getPlayerTypes().add(player.getPlayerType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
startMultiplayerMatch(event.getMultiplayerRound(), event.getMatchOptions());
|
||||||
|
}
|
||||||
|
break;
|
||||||
case END:
|
case END:
|
||||||
endTournament();
|
endTournament();
|
||||||
break;
|
break;
|
||||||
|
|
@ -265,6 +279,31 @@ public class TournamentController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void startMultiplayerMatch(MultiplayerRound round, MatchOptions matchOptions) {
|
||||||
|
try {
|
||||||
|
TableManager tableManager = TableManager.getInstance();
|
||||||
|
Table table = tableManager.createTable(GamesRoomManager.getInstance().getMainRoomId(), matchOptions);
|
||||||
|
table.setTournamentSubTable(true);
|
||||||
|
table.setTournament(tournament);
|
||||||
|
table.setState(TableState.WAITING);
|
||||||
|
|
||||||
|
for (TournamentPlayer player : round.getAllPlayers()) {
|
||||||
|
tableManager.addPlayer(getPlayerUserId(player.getPlayer().getId()), table.getId(), player.getPlayer(), player.getPlayerType(), player.getDeck());
|
||||||
|
}
|
||||||
|
table.setState(TableState.STARTING);
|
||||||
|
tableManager.startTournamentSubMatch(null, table.getId());
|
||||||
|
Match match = tableManager.getMatch(table.getId());
|
||||||
|
match.setTableId(tableId);
|
||||||
|
round.setMatch(match);
|
||||||
|
round.setTableId(table.getId());
|
||||||
|
for (TournamentPlayer player : round.getAllPlayers()) {
|
||||||
|
player.setState(TournamentPlayerState.DUELING);
|
||||||
|
}
|
||||||
|
} catch (GameException ex) {
|
||||||
|
logger.fatal("TournamentController startMatch error", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void startDraft(Draft draft) {
|
private void startDraft(Draft draft) {
|
||||||
TableManager.getInstance().startDraft(tableId, draft);
|
TableManager.getInstance().startDraft(tableId, draft);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import mage.cards.decks.Deck;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.draft.Draft;
|
import mage.game.draft.Draft;
|
||||||
import mage.game.match.MatchOptions;
|
import mage.game.match.MatchOptions;
|
||||||
|
import mage.game.tournament.MultiplayerRound;
|
||||||
import mage.game.tournament.TournamentPairing;
|
import mage.game.tournament.TournamentPairing;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -46,7 +47,7 @@ public class TableEvent extends EventObject implements ExternalEvent, Serializab
|
||||||
|
|
||||||
public enum EventType {
|
public enum EventType {
|
||||||
UPDATE, INFO, STATUS, START_DRAFT, START_MATCH, SIDEBOARD, CONSTRUCT, SUBMIT_DECK, END, END_GAME_INFO, ERROR,
|
UPDATE, INFO, STATUS, START_DRAFT, START_MATCH, SIDEBOARD, CONSTRUCT, SUBMIT_DECK, END, END_GAME_INFO, ERROR,
|
||||||
INIT_TIMER, RESUME_TIMER, PAUSE_TIMER, CHECK_STATE_PLAYERS
|
INIT_TIMER, RESUME_TIMER, PAUSE_TIMER, CHECK_STATE_PLAYERS, START_MULTIPLAYER_MATCH
|
||||||
}
|
}
|
||||||
|
|
||||||
private Game game;
|
private Game game;
|
||||||
|
|
@ -58,6 +59,7 @@ public class TableEvent extends EventObject implements ExternalEvent, Serializab
|
||||||
private UUID playerId;
|
private UUID playerId;
|
||||||
private Deck deck;
|
private Deck deck;
|
||||||
private TournamentPairing pair;
|
private TournamentPairing pair;
|
||||||
|
private MultiplayerRound round;
|
||||||
private MatchOptions options;
|
private MatchOptions options;
|
||||||
private int timeout;
|
private int timeout;
|
||||||
private boolean withTime;
|
private boolean withTime;
|
||||||
|
|
@ -116,6 +118,13 @@ public class TableEvent extends EventObject implements ExternalEvent, Serializab
|
||||||
this.eventType = eventType;
|
this.eventType = eventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TableEvent(EventType eventType, MultiplayerRound round, MatchOptions options) {
|
||||||
|
super(options);
|
||||||
|
this.round = round;
|
||||||
|
this.options = options;
|
||||||
|
this.eventType = eventType;
|
||||||
|
}
|
||||||
|
|
||||||
public Game getGame() {
|
public Game getGame() {
|
||||||
return game;
|
return game;
|
||||||
}
|
}
|
||||||
|
|
@ -152,6 +161,10 @@ public class TableEvent extends EventObject implements ExternalEvent, Serializab
|
||||||
return pair;
|
return pair;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MultiplayerRound getMultiplayerRound() {
|
||||||
|
return round;
|
||||||
|
}
|
||||||
|
|
||||||
public MatchOptions getMatchOptions() {
|
public MatchOptions getMatchOptions() {
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ import mage.game.tournament.TournamentPairing;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.game.tournament.MultiplayerRound;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -93,4 +94,8 @@ public class TableEventSource implements EventSource<TableEvent>, Serializable {
|
||||||
public void fireTableEvent(EventType eventType, TournamentPairing pair, MatchOptions options) {
|
public void fireTableEvent(EventType eventType, TournamentPairing pair, MatchOptions options) {
|
||||||
dispatcher.fireEvent(new TableEvent(eventType, pair, options));
|
dispatcher.fireEvent(new TableEvent(eventType, pair, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void fireTableEvent(EventType eventType, MultiplayerRound round, MatchOptions options) {
|
||||||
|
dispatcher.fireEvent(new TableEvent(eventType, round, options));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,21 +52,50 @@ public class MatchOptions implements Serializable {
|
||||||
protected String deckType;
|
protected String deckType;
|
||||||
protected boolean limited;
|
protected boolean limited;
|
||||||
protected List<String> playerTypes = new ArrayList<>();
|
protected List<String> playerTypes = new ArrayList<>();
|
||||||
|
protected boolean multiPlayer;
|
||||||
|
protected int numSeats;
|
||||||
protected String password;
|
protected String password;
|
||||||
protected SkillLevel skillLevel;
|
protected SkillLevel skillLevel;
|
||||||
protected boolean rollbackTurnsAllowed;
|
protected boolean rollbackTurnsAllowed;
|
||||||
protected int quitRatio;
|
protected int quitRatio;
|
||||||
protected boolean rated;
|
protected boolean rated;
|
||||||
|
protected int numSeatsForMatch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time each player has during the game to play using his\her priority.
|
* Time each player has during the game to play using his\her priority.
|
||||||
*/
|
*/
|
||||||
protected MatchTimeLimit matchTimeLimit; // 0 = no priorityTime handling
|
protected MatchTimeLimit matchTimeLimit; // 0 = no priorityTime handling
|
||||||
|
|
||||||
public MatchOptions(String name, String gameType) {
|
/*public MatchOptions(String name, String gameType) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.gameType = gameType;
|
this.gameType = gameType;
|
||||||
this.password = "";
|
this.password = "";
|
||||||
|
this.multiPlayer = false;
|
||||||
|
this.numSeats = 2;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public MatchOptions(String name, String gameType, boolean multiPlayer, int numSeats ) {
|
||||||
|
this.name = name;
|
||||||
|
this.gameType = gameType;
|
||||||
|
this.password = "";
|
||||||
|
this.multiPlayer = multiPlayer;
|
||||||
|
this.numSeats = numSeats;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumSeats (int numSeats) {
|
||||||
|
this.numSeats = numSeats;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumSeats () {
|
||||||
|
return numSeats;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiPlayer(boolean multiPlayer) {
|
||||||
|
this.multiPlayer = multiPlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getMultiPlayer() {
|
||||||
|
return multiPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package mage.game.tournament;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.game.match.Match;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author spjspj
|
||||||
|
*/
|
||||||
|
public class MultiplayerRound {
|
||||||
|
|
||||||
|
private final int roundNum;
|
||||||
|
private final Tournament tournament;
|
||||||
|
private final int numSeats;
|
||||||
|
private final List<TournamentPlayer> allPlayers = new ArrayList<>();
|
||||||
|
private Match match;
|
||||||
|
private UUID tableId;
|
||||||
|
|
||||||
|
|
||||||
|
public MultiplayerRound(int roundNum, Tournament tournament, int numSeats) {
|
||||||
|
this.roundNum = roundNum;
|
||||||
|
this.tournament = tournament;
|
||||||
|
this.numSeats = numSeats;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TournamentPlayer> getAllPlayers () {
|
||||||
|
return allPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TournamentPlayer getPlayer (int i) {
|
||||||
|
if (i >= 0 && i < numSeats && i < allPlayers.size()) {
|
||||||
|
return allPlayers.get(i);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addPairing(TournamentPairing match) {
|
||||||
|
this.allPlayers.add(match.getPlayer1());
|
||||||
|
this.allPlayers.add(match.getPlayer2());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addPlayer(TournamentPlayer player) {
|
||||||
|
this.allPlayers.add(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRoundNumber() {
|
||||||
|
return this.roundNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMatch (Match match) {
|
||||||
|
this.match = match;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTableId (UUID tableId) {
|
||||||
|
this.tableId = tableId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRoundOver() {
|
||||||
|
boolean roundIsOver = true;
|
||||||
|
if (this.match != null) {
|
||||||
|
if (!this.match.hasEnded()) {
|
||||||
|
roundIsOver = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return roundIsOver;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -262,6 +262,12 @@ public abstract class TournamentImpl implements Tournament {
|
||||||
updateResults();
|
updateResults();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void playMultiplayerRound(MultiplayerRound round) {
|
||||||
|
playMultiPlayerMatch(round);
|
||||||
|
|
||||||
|
updateResults(); // show points from byes
|
||||||
|
}
|
||||||
|
|
||||||
protected List<TournamentPlayer> getActivePlayers() {
|
protected List<TournamentPlayer> getActivePlayers() {
|
||||||
List<TournamentPlayer> activePlayers = new ArrayList<>();
|
List<TournamentPlayer> activePlayers = new ArrayList<>();
|
||||||
for (TournamentPlayer player : players.values()) {
|
for (TournamentPlayer player : players.values()) {
|
||||||
|
|
@ -457,6 +463,10 @@ public abstract class TournamentImpl implements Tournament {
|
||||||
tableEventSource.fireTableEvent(EventType.START_MATCH, pair, options.getMatchOptions());
|
tableEventSource.fireTableEvent(EventType.START_MATCH, pair, options.getMatchOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void playMultiPlayerMatch(MultiplayerRound round) {
|
||||||
|
tableEventSource.fireTableEvent(EventType.START_MULTIPLAYER_MATCH, round, options.getMatchOptions());
|
||||||
|
}
|
||||||
|
|
||||||
public void end() {
|
public void end() {
|
||||||
endTime = new Date();
|
endTime = new Date();
|
||||||
tableEventSource.fireTableEvent(EventType.END);
|
tableEventSource.fireTableEvent(EventType.END);
|
||||||
|
|
|
||||||
|
|
@ -41,15 +41,16 @@ public class TournamentOptions implements Serializable {
|
||||||
protected String name;
|
protected String name;
|
||||||
protected String tournamentType;
|
protected String tournamentType;
|
||||||
protected List<String> playerTypes = new ArrayList<>();
|
protected List<String> playerTypes = new ArrayList<>();
|
||||||
protected MatchOptions matchOptions = new MatchOptions("", "Two Player Duel");
|
protected MatchOptions matchOptions;
|
||||||
protected LimitedOptions limitedOptions;
|
protected LimitedOptions limitedOptions;
|
||||||
protected boolean watchingAllowed = true;
|
protected boolean watchingAllowed = true;
|
||||||
protected int numberRounds;
|
protected int numberRounds;
|
||||||
protected String password;
|
protected String password;
|
||||||
protected int quitRatio;
|
protected int quitRatio;
|
||||||
|
|
||||||
public TournamentOptions(String name) {
|
public TournamentOptions(String name, String matchType, int numSeats) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.matchOptions = new MatchOptions("", matchType, numSeats > 2, numSeats);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ package mage.game.tournament;
|
||||||
*/
|
*/
|
||||||
public class TournamentSealedOptions extends TournamentOptions {
|
public class TournamentSealedOptions extends TournamentOptions {
|
||||||
|
|
||||||
public TournamentSealedOptions(String name) {
|
public TournamentSealedOptions(String name, String matchType, int numSeats) {
|
||||||
super(name);
|
super(name, matchType, numSeats);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
package mage.game.tournament;
|
package mage.game.tournament;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.game.events.TableEvent;
|
import mage.game.events.TableEvent;
|
||||||
|
|
@ -50,6 +51,7 @@ public abstract class TournamentSingleElimination extends TournamentImpl {
|
||||||
entry.getValue().setResults("Auto Eliminated");
|
entry.getValue().setResults("Auto Eliminated");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (options.matchOptions.getNumSeats() == 2) {
|
||||||
while (this.getActivePlayers().size() > 1) {
|
while (this.getActivePlayers().size() > 1) {
|
||||||
// check if some player got killed / disconnected meanwhile and update their state
|
// check if some player got killed / disconnected meanwhile and update their state
|
||||||
tableEventSource.fireTableEvent(TableEvent.EventType.CHECK_STATE_PLAYERS);
|
tableEventSource.fireTableEvent(TableEvent.EventType.CHECK_STATE_PLAYERS);
|
||||||
|
|
@ -57,6 +59,14 @@ public abstract class TournamentSingleElimination extends TournamentImpl {
|
||||||
playRound(round);
|
playRound(round);
|
||||||
eliminatePlayers(round);
|
eliminatePlayers(round);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
MultiplayerRound round = new MultiplayerRound(0, this, options.matchOptions.getNumSeats());
|
||||||
|
for (TournamentPlayer player : getActivePlayers()) {
|
||||||
|
round.addPlayer(player);
|
||||||
|
}
|
||||||
|
playMultiplayerRound(round);
|
||||||
|
}
|
||||||
|
|
||||||
nextStep();
|
nextStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ public abstract class TournamentSwiss extends TournamentImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.matchOptions.getNumSeats() == 2) {
|
||||||
while (this.getActivePlayers().size() > 1 && this.getNumberRounds() > this.getRounds().size()) {
|
while (this.getActivePlayers().size() > 1 && this.getNumberRounds() > this.getRounds().size()) {
|
||||||
// check if some player got killed / disconnected meanwhile and update their state
|
// check if some player got killed / disconnected meanwhile and update their state
|
||||||
tableEventSource.fireTableEvent(TableEvent.EventType.CHECK_STATE_PLAYERS);
|
tableEventSource.fireTableEvent(TableEvent.EventType.CHECK_STATE_PLAYERS);
|
||||||
|
|
@ -63,6 +64,11 @@ public abstract class TournamentSwiss extends TournamentImpl {
|
||||||
Round round = createRoundSwiss();
|
Round round = createRoundSwiss();
|
||||||
playRound(round);
|
playRound(round);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
MultiplayerRound round = createMultiplayerRound();
|
||||||
|
playMultiplayerRound(round);
|
||||||
|
}
|
||||||
|
|
||||||
nextStep();
|
nextStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,6 +76,8 @@ public abstract class TournamentSwiss extends TournamentImpl {
|
||||||
List<TournamentPlayer> roundPlayers = getActivePlayers();
|
List<TournamentPlayer> roundPlayers = getActivePlayers();
|
||||||
boolean isLastRound = (rounds.size() + 1 == getNumberRounds());
|
boolean isLastRound = (rounds.size() + 1 == getNumberRounds());
|
||||||
|
|
||||||
|
Round round = null;
|
||||||
|
if (options.matchOptions.getNumSeats() == 2) {
|
||||||
RoundPairings roundPairings;
|
RoundPairings roundPairings;
|
||||||
if (roundPlayers.size() <= 16) {
|
if (roundPlayers.size() <= 16) {
|
||||||
SwissPairingMinimalWeightMatching swissPairing = new SwissPairingMinimalWeightMatching(roundPlayers, rounds, isLastRound);
|
SwissPairingMinimalWeightMatching swissPairing = new SwissPairingMinimalWeightMatching(roundPlayers, rounds, isLastRound);
|
||||||
|
|
@ -79,7 +87,7 @@ public abstract class TournamentSwiss extends TournamentImpl {
|
||||||
roundPairings = swissPairing.getRoundPairings();
|
roundPairings = swissPairing.getRoundPairings();
|
||||||
}
|
}
|
||||||
|
|
||||||
Round round = new Round(rounds.size() + 1, this);
|
round = new Round(rounds.size() + 1, this);
|
||||||
rounds.add(round);
|
rounds.add(round);
|
||||||
for (TournamentPairing pairing : roundPairings.getPairings()) {
|
for (TournamentPairing pairing : roundPairings.getPairings()) {
|
||||||
round.addPairing(pairing);
|
round.addPairing(pairing);
|
||||||
|
|
@ -95,8 +103,33 @@ public abstract class TournamentSwiss extends TournamentImpl {
|
||||||
playerBye.setStateInfo("Round Bye");
|
playerBye.setStateInfo("Round Bye");
|
||||||
updateResults();
|
updateResults();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return round;
|
return round;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MultiplayerRound createMultiplayerRound() {
|
||||||
|
List<TournamentPlayer> roundPlayers = getActivePlayers();
|
||||||
|
boolean isLastRound = (rounds.size() + 1 == getNumberRounds());
|
||||||
|
|
||||||
|
MultiplayerRound round = null;
|
||||||
|
if (options.matchOptions.getNumSeats() > 2) {
|
||||||
|
RoundPairings roundPairings;
|
||||||
|
if (roundPlayers.size() <= 16) {
|
||||||
|
SwissPairingMinimalWeightMatching swissPairing = new SwissPairingMinimalWeightMatching(roundPlayers, rounds, isLastRound);
|
||||||
|
roundPairings = swissPairing.getRoundPairings();
|
||||||
|
} else {
|
||||||
|
SwissPairingSimple swissPairing = new SwissPairingSimple(roundPlayers, rounds);
|
||||||
|
roundPairings = swissPairing.getRoundPairings();
|
||||||
|
}
|
||||||
|
|
||||||
|
round = new MultiplayerRound(rounds.size() + 1, this, options.matchOptions.getNumSeats());
|
||||||
|
for (TournamentPairing pairing : roundPairings.getPairings()) {
|
||||||
|
round.addPairing(pairing);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return round;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue