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:
spjspj 2016-09-25 00:46:16 +10:00
parent 101a1db649
commit 16bb17e5bb
14 changed files with 366 additions and 60 deletions

View file

@ -28,6 +28,7 @@
package mage.game.tournament;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import mage.game.events.TableEvent;
@ -50,16 +51,25 @@ public abstract class TournamentSingleElimination extends TournamentImpl {
entry.getValue().setResults("Auto Eliminated");
}
}
while (this.getActivePlayers().size() > 1) {
// check if some player got killed / disconnected meanwhile and update their state
tableEventSource.fireTableEvent(TableEvent.EventType.CHECK_STATE_PLAYERS);
Round round = createRoundRandom();
playRound(round);
eliminatePlayers(round);
if (options.matchOptions.getNumSeats() == 2) {
while (this.getActivePlayers().size() > 1) {
// check if some player got killed / disconnected meanwhile and update their state
tableEventSource.fireTableEvent(TableEvent.EventType.CHECK_STATE_PLAYERS);
Round round = createRoundRandom();
playRound(round);
eliminatePlayers(round);
}
} else {
MultiplayerRound round = new MultiplayerRound(0, this, options.matchOptions.getNumSeats());
for (TournamentPlayer player : getActivePlayers()) {
round.addPlayer(player);
}
playMultiplayerRound(round);
}
nextStep();
}
private void eliminatePlayers(Round round) {
for (TournamentPairing pair: round.getPairs()) {
pair.eliminatePlayers();