From 6d11b7f3e8c6f9ae32f1b6d1e1e70dce8ba35c1e Mon Sep 17 00:00:00 2001 From: gleeb Date: Thu, 6 May 2021 00:03:29 -0700 Subject: [PATCH] Add Rich Man Swiss Draft --- .../RichManCubeDraftSwissTournament.java | 30 +++++++++++ .../RichManCubeDraftSwissTournamentType.java | 22 ++++++++ .../RichManDraftSwissTournament.java | 54 +++++++++++++++++++ .../RichManDraftSwissTournamentType.java | 24 +++++++++ Mage.Server/config/config.xml | 4 +- Mage.Server/release/config/config.xml | 2 + .../src/test/resources/config_error.xml | 2 + 7 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManCubeDraftSwissTournament.java create mode 100644 Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManCubeDraftSwissTournamentType.java create mode 100644 Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManDraftSwissTournament.java create mode 100644 Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManDraftSwissTournamentType.java diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManCubeDraftSwissTournament.java b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManCubeDraftSwissTournament.java new file mode 100644 index 0000000000..45c4e72bce --- /dev/null +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManCubeDraftSwissTournament.java @@ -0,0 +1,30 @@ +package mage.tournament; + +import mage.constants.TournamentPlayerState; +import mage.game.draft.DraftOptions; +import mage.game.draft.RichManCubeBoosterDraft; +import mage.game.events.TableEvent; +import mage.game.tournament.TournamentOptions; +import mage.game.tournament.TournamentPlayer; + +/** + * + * @author glee- + */ +public class RichManCubeDraftSwissTournament extends BoosterDraftSwissTournament { + + public RichManCubeDraftSwissTournament(TournamentOptions options) { + super(options); + } + + @Override + protected void draft() { + draft = new RichManCubeBoosterDraft((DraftOptions) options.getLimitedOptions(), getSets()); + for (TournamentPlayer player : players.values()) { + draft.addPlayer(player.getPlayer()); + player.setState(TournamentPlayerState.DRAFTING); + } + tableEventSource.fireTableEvent(TableEvent.EventType.START_DRAFT, null, draft); + } + +} diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManCubeDraftSwissTournamentType.java b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManCubeDraftSwissTournamentType.java new file mode 100644 index 0000000000..d167a56e8f --- /dev/null +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManCubeDraftSwissTournamentType.java @@ -0,0 +1,22 @@ +package mage.tournament; + +import mage.game.tournament.TournamentType; + +/** + * + * @author glee- + */ +public class RichManCubeDraftSwissTournamentType extends TournamentType { + + public RichManCubeDraftSwissTournamentType() { + this.name = "Booster Draft Swiss (Rich Man Cube)"; + this.maxPlayers = 16; + this.minPlayers = 2; + this.numBoosters = 1; + this.draft = true; + this.limited = true; + this.cubeBooster = true; + this.elimination = false; + } + +} diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManDraftSwissTournament.java b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManDraftSwissTournament.java new file mode 100644 index 0000000000..8c84e89905 --- /dev/null +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManDraftSwissTournament.java @@ -0,0 +1,54 @@ +package mage.tournament; + +import mage.constants.TournamentPlayerState; +import mage.game.draft.DraftOptions; +import mage.game.draft.RichManBoosterDraft; +import mage.game.events.TableEvent; +import mage.game.tournament.TournamentOptions; +import mage.game.tournament.TournamentPlayer; + +/** + * + * @author glee- + */ +public class RichManDraftSwissTournament extends BoosterDraftSwissTournament { + public RichManDraftSwissTournament(TournamentOptions options) { + super(options); + } + + @Override + protected void draft() { + draft = new RichManBoosterDraft((DraftOptions) options.getLimitedOptions(), getSets()); + for (TournamentPlayer player : players.values()) { + draft.addPlayer(player.getPlayer()); + player.setState(TournamentPlayerState.DRAFTING); + } + tableEventSource.fireTableEvent(TableEvent.EventType.START_DRAFT, null, draft); + } + + @Override + public void nextStep() { + if (isAbort()) { + currentStep = TournamentStep.COMPETE; + } + switch (currentStep) { + case START: + currentStep = TournamentStep.DRAFT; + draft(); + break; + case DRAFT: + currentStep = TournamentStep.CONSTRUCT; + construct(); + break; + case CONSTRUCT: + currentStep = TournamentStep.COMPETE; + runTournament(); + break; + case COMPETE: + currentStep = TournamentStep.WINNERS; + winners(); + end(); + break; + } + } +} diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManDraftSwissTournamentType.java b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManDraftSwissTournamentType.java new file mode 100644 index 0000000000..fee3a3d434 --- /dev/null +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RichManDraftSwissTournamentType.java @@ -0,0 +1,24 @@ +package mage.tournament; + +import mage.game.tournament.TournamentType; + +/** + * + * @author glee- + */ +public class RichManDraftSwissTournamentType extends TournamentType { + + public RichManDraftSwissTournamentType() { + this.name = "Booster Draft Swiss (Rich Man)"; + this.maxPlayers = 16; + this.minPlayers = 2; + this.numBoosters = 1; + this.draft = true; + this.limited = true; + this.cubeBooster = false; + this.elimination = false; + this.isRandom = false; + this.isRichMan = true; + } + +} diff --git a/Mage.Server/config/config.xml b/Mage.Server/config/config.xml index 0f329b9f2c..c338da393d 100644 --- a/Mage.Server/config/config.xml +++ b/Mage.Server/config/config.xml @@ -95,13 +95,13 @@ - - + + diff --git a/Mage.Server/release/config/config.xml b/Mage.Server/release/config/config.xml index c21407073c..6154429ea5 100644 --- a/Mage.Server/release/config/config.xml +++ b/Mage.Server/release/config/config.xml @@ -94,6 +94,8 @@ + + diff --git a/Mage.Server/src/test/resources/config_error.xml b/Mage.Server/src/test/resources/config_error.xml index 046070b441..a516c14c48 100644 --- a/Mage.Server/src/test/resources/config_error.xml +++ b/Mage.Server/src/test/resources/config_error.xml @@ -66,6 +66,8 @@ + +