From 4113976b7e59c6376a573139d50fd84423ba75fe Mon Sep 17 00:00:00 2001 From: brodee <> Date: Tue, 23 Jun 2015 20:59:05 -0700 Subject: [PATCH] code review comments for chaos/random booster draft: 1. rename chaos booster draft to random booster draft 2. save packs selected in the user preferences 3. print "Random Boosters" in the player draft viewer during the draft --- .../client/dialog/NewTournamentDialog.form | 7 +- .../client/dialog/NewTournamentDialog.java | 95 +++++++++++-------- .../mage/client/dialog/PreferencesDialog.java | 1 + .../java/mage/client/draft/DraftPanel.java | 8 +- .../src/mage/view/TournamentTypeView.java | 8 +- ...domBoosterDraftEliminationTournament.java} | 8 +- ...oosterDraftEliminationTournamentType.java} | 8 +- ...=> RandomBoosterDraftSwissTournament.java} | 8 +- ...andomBoosterDraftSwissTournamentType.java} | 8 +- Mage.Server/config/config.xml | 4 +- ...sterDraft.java => RandomBoosterDraft.java} | 19 ++-- .../mage/game/tournament/LimitedOptions.java | 10 +- .../mage/game/tournament/TournamentType.java | 6 +- 13 files changed, 106 insertions(+), 84 deletions(-) rename Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/{ChaosBoosterDraftEliminationTournament.java => RandomBoosterDraftEliminationTournament.java} (88%) rename Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/{ChaosBoosterDraftEliminationTournamentType.java => RandomBoosterDraftEliminationTournamentType.java} (89%) rename Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/{ChaosBoosterDraftSwissTournament.java => RandomBoosterDraftSwissTournament.java} (88%) rename Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/{ChaosBoosterDraftSwissTournamentType.java => RandomBoosterDraftSwissTournamentType.java} (90%) rename Mage/src/mage/game/draft/{ChaosBoosterDraft.java => RandomBoosterDraft.java} (84%) diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form index cf2bffccce..beb4c5799d 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.form @@ -118,7 +118,7 @@ - + @@ -169,7 +169,7 @@ - + @@ -511,13 +511,14 @@ - + + diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java index a3b6bb5f77..6f11993a74 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java @@ -80,12 +80,12 @@ public class NewTournamentDialog extends MageDialog { private UUID roomId; private final Session session; private String lastSessionId; - private JList chaosList = new JList(); + private JList randomList = new JList(); private final List players = new ArrayList<>(); private final List packs = new ArrayList<>(); - private final List chaosPacks = new ArrayList<>(); private final int CONSTRUCTION_TIME_MIN = 6; private final int CONSTRUCTION_TIME_MAX = 30; + private final String randomDraftDescription = ("The selected packs will be randomly distributed to players. Each player may open different packs. Duplicates will be avoided."); private boolean automaticChange = false; @@ -178,7 +178,7 @@ public class NewTournamentDialog extends MageDialog { pnlOtherPlayers = new javax.swing.JPanel(); btnOk = new javax.swing.JButton(); btnCancel = new javax.swing.JButton(); - pnlChaosPacks = new javax.swing.JPanel(); + pnlRandomPacks = new javax.swing.JPanel(); setTitle("New Tournament"); @@ -341,8 +341,9 @@ public class NewTournamentDialog extends MageDialog { } }); - pnlChaosPacks.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - pnlChaosPacks.setLayout(new java.awt.GridLayout(0, 1, 2, 0)); + pnlRandomPacks.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + pnlRandomPacks.setToolTipText(""); + pnlRandomPacks.setLayout(new java.awt.GridLayout(0, 1, 2, 0)); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); @@ -426,7 +427,7 @@ public class NewTournamentDialog extends MageDialog { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pnlChaosPacks, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(pnlRandomPacks, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); layout.setVerticalGroup( @@ -469,7 +470,7 @@ public class NewTournamentDialog extends MageDialog { .addGroup(layout.createSequentialGroup() .addComponent(pnlPacks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pnlChaosPacks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(pnlRandomPacks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) @@ -529,18 +530,19 @@ public class NewTournamentDialog extends MageDialog { } if (tournamentType.isLimited()) { tOptions.getLimitedOptions().setConstructionTime((Integer)this.spnConstructTime.getValue() * 60); + tOptions.getLimitedOptions().setIsRandom(tournamentType.isRandom()); if (tournamentType.isCubeBooster()) { tOptions.getLimitedOptions().setDraftCubeName(this.cbDraftCube.getSelectedItem().toString()); - } else if (tournamentType.isChaos()){ - for (Integer pack: chaosList.getSelectedIndices()){ - String packStr = (String)chaosList.getModel().getElementAt(pack); + } else if (tournamentType.isRandom()) { + for (Object pack : randomList.getSelectedValuesList()) { + String packStr = (String) pack; String code = packStr.substring(0, 3); tOptions.getLimitedOptions().getSetCodes().add(code); } - if (tOptions.getLimitedOptions().getSetCodes().size() < 2){ - // At least two sets must be chosen. - return; - } + if (tOptions.getLimitedOptions().getSetCodes().size() < 2) { + // At least two sets must be chosen. + return; + } } else { for (JComboBox pack: packs) { tOptions.getLimitedOptions().getSetCodes().add(((ExpansionInfo) pack.getSelectedItem()).getCode()); @@ -653,8 +655,8 @@ public class NewTournamentDialog extends MageDialog { createPlayers((Integer) spnNumPlayers.getValue() - 1); if (tournamentType.isLimited()) { - if (tournamentType.isChaos()){ - createChaosPacks(); + if (tournamentType.isRandom()){ + createRandomPacks(); }else{ createPacks(tournamentType.getNumBoosters()); } @@ -696,19 +698,19 @@ public class NewTournamentDialog extends MageDialog { this.cbDraftCube.setVisible(true); this.lblPacks.setVisible(false); this.pnlPacks.setVisible(false); - this.pnlChaosPacks.setVisible(false); - } else if (tournamentType.isChaos()){ + this.pnlRandomPacks.setVisible(false); + } else if (tournamentType.isRandom()){ this.lblDraftCube.setVisible(false); this.cbDraftCube.setVisible(false); this.lblPacks.setVisible(true); - this.pnlChaosPacks.setVisible(true); + this.pnlRandomPacks.setVisible(true); this.pnlPacks.setVisible(false); } else { this.lblDraftCube.setVisible(false); this.cbDraftCube.setVisible(false); this.lblPacks.setVisible(true); this.pnlPacks.setVisible(true); - this.pnlChaosPacks.setVisible(false); + this.pnlRandomPacks.setVisible(false); } } else { // construced @@ -716,21 +718,24 @@ public class NewTournamentDialog extends MageDialog { this.cbDraftCube.setVisible(false); this.pnlPacks.setVisible(false); this.pnlPacks.setVisible(false); - this.pnlChaosPacks.setVisible(false); + this.pnlRandomPacks.setVisible(false); } } -private void createChaosPacks() { - if (pnlChaosPacks.getComponentCount() == 0 ){ - DefaultListModel chaosListModel = new DefaultListModel(); - chaosList = new JList(chaosListModel); + private void createRandomPacks() { + if (pnlRandomPacks.getComponentCount() == 0) { + + DefaultListModel randomListModel = new DefaultListModel(); + randomList = new JList(randomListModel); + randomList.setToolTipText(randomDraftDescription); ExpansionInfo[] allExpansions = ExpansionRepository.instance.getWithBoostersSortedByReleaseDate(); - for (ExpansionInfo expansion: allExpansions){ + for (ExpansionInfo expansion : allExpansions) { String exp = expansion.getCode() + " - " + expansion.getName(); - chaosListModel.addElement(exp); + randomListModel.addElement(exp); } - chaosList.setSelectionModel(new DefaultListSelectionModel() { + randomList.setSelectionModel(new DefaultListSelectionModel() { private boolean mGestureStarted; + @Override public void setSelectionInterval(int index0, int index1) { // Toggle only one element while the user is dragging the mouse @@ -760,16 +765,24 @@ private void createChaosPacks() { } } }); - chaosList.setSelectionInterval(0, chaosListModel.size()-1); - JScrollPane list1scr = new JScrollPane(chaosList); - chaosList.setVisibleRowCount(4); - pnlChaosPacks.add(list1scr); + + String randomPrefs = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT, ""); + if (randomPrefs.length() > 0) { + for (String exp : randomPrefs.split(";")) { + randomList.setSelectedValue(exp, false); + } + } else { + randomList.setSelectionInterval(0, randomListModel.size() - 1); + } + JScrollPane list1scr = new JScrollPane(randomList); + randomList.setVisibleRowCount(4); + pnlRandomPacks.add(list1scr); } this.pack(); this.revalidate(); this.repaint(); } - + private void createPacks(int numPacks) { while (packs.size() > numPacks) { pnlPacks.remove(packs.get(packs.size() - 1)); @@ -916,7 +929,7 @@ private void createChaosPacks() { if (tournamentType.isDraft()) { numPlayers = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLAYERS_DRAFT, "4")); setTournamentOptions(numPlayers); - if (!tournamentType.isChaos()){ + if (!tournamentType.isRandom()){ loadBoosterPacks(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_DRAFT, "")); } @@ -985,12 +998,20 @@ private void createChaosPacks() { PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLAYERS_DRAFT, Integer.toString(tOptions.getPlayerTypes().size())); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_DRAFT_TIMING, draftOptions.getTiming().name()); } - } - if (tOptions.getTournamentType().startsWith("Booster")) { String deckFile = this.player1Panel.getDeckFile(); if (deckFile != null && !deckFile.isEmpty()) { PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_DECK_FILE, deckFile); } + + if (tOptions.getLimitedOptions().getIsRandom()){ + // save random boosters to prefs + StringBuilder packlist = new StringBuilder(); + for (Object pack: randomList.getSelectedValuesList()){ + packlist.append((String)pack); + packlist.append(";"); + } + PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT, packlist.toString()); + } } PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_SPECTATORS, (tOptions.isWatchingAllowed()?"Yes":"No")); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS, (tOptions.getMatchOptions().isRollbackTurnsAllowed()?"Yes":"No")); @@ -1031,11 +1052,11 @@ private void createChaosPacks() { private javax.swing.JLabel lblPlayer1; private javax.swing.JLabel lblTournamentType; private mage.client.table.NewPlayerPanel player1Panel; - private javax.swing.JPanel pnlChaosPacks; private javax.swing.JPanel pnlDraftOptions; private javax.swing.JPanel pnlOtherPlayers; private javax.swing.JPanel pnlPacks; private javax.swing.JPanel pnlPlayers; + private javax.swing.JPanel pnlRandomPacks; private javax.swing.JSpinner spnConstructTime; private javax.swing.JSpinner spnFreeMulligans; private javax.swing.JSpinner spnNumPlayers; diff --git a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java index c9d2f27d8f..27390bedf1 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java @@ -190,6 +190,7 @@ public class PreferencesDialog extends javax.swing.JDialog { public static final String KEY_NEW_TOURNAMENT_NUMBER_OF_WINS = "newTournamentNumberOfWins"; public static final String KEY_NEW_TOURNAMENT_PACKS_SEALED = "newTournamentPacksSealed"; public static final String KEY_NEW_TOURNAMENT_PACKS_DRAFT = "newTournamentPacksDraft"; + public static final String KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT = "newTournamentPacksRandomDraft"; public static final String KEY_NEW_TOURNAMENT_PLAYERS_SEALED = "newTournamentPlayersSealed"; public static final String KEY_NEW_TOURNAMENT_PLAYERS_DRAFT = "newTournamentPlayersDraft"; public static final String KEY_NEW_TOURNAMENT_DRAFT_TIMING = "newTournamentDraftTiming"; diff --git a/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java b/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java index 2a89715224..da4ea2b425 100644 --- a/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java +++ b/Mage.Client/src/main/java/mage/client/draft/DraftPanel.java @@ -153,10 +153,10 @@ public class DraftPanel extends javax.swing.JPanel { public void updateDraft(DraftView draftView) { if (draftView.getSets().size() != 3){ - // Chaos draft - this.txtPack1.setText("???"); - this.txtPack2.setText("???"); - this.txtPack3.setText("???"); + // Random draft + this.txtPack1.setText("Random Boosters"); + this.txtPack2.setText("Random Boosters"); + this.txtPack3.setText("Random Boosters"); }else{ this.txtPack1.setText(draftView.getSets().get(0)); this.txtPack2.setText(draftView.getSets().get(1)); diff --git a/Mage.Common/src/mage/view/TournamentTypeView.java b/Mage.Common/src/mage/view/TournamentTypeView.java index 7a3519a1cf..8209b585d9 100644 --- a/Mage.Common/src/mage/view/TournamentTypeView.java +++ b/Mage.Common/src/mage/view/TournamentTypeView.java @@ -46,7 +46,7 @@ public class TournamentTypeView implements Serializable { private final boolean limited; private final boolean cubeBooster; private final boolean elimination; - private final boolean chaos; + private final boolean random; public TournamentTypeView(TournamentType tournamentType) { @@ -58,7 +58,7 @@ public class TournamentTypeView implements Serializable { this.limited = tournamentType.isLimited(); this.cubeBooster = tournamentType.isCubeBooster(); this.elimination = tournamentType.isElimination(); - this.chaos = tournamentType.isChaos(); + this.random = tournamentType.isRandom(); } @Override @@ -98,7 +98,7 @@ public class TournamentTypeView implements Serializable { return elimination; } - public boolean isChaos(){ - return chaos; + public boolean isRandom(){ + return random; } } diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftEliminationTournament.java b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RandomBoosterDraftEliminationTournament.java similarity index 88% rename from Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftEliminationTournament.java rename to Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RandomBoosterDraftEliminationTournament.java index 2a98c558ea..961861ca84 100644 --- a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftEliminationTournament.java +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RandomBoosterDraftEliminationTournament.java @@ -32,23 +32,23 @@ import mage.constants.TournamentPlayerState; import mage.game.draft.DraftOptions; import mage.game.events.TableEvent.EventType; import mage.game.tournament.TournamentPlayer; -import mage.game.draft.ChaosBoosterDraft; +import mage.game.draft.RandomBoosterDraft; import mage.game.tournament.TournamentOptions; /** * * @author BetaSteward_at_googlemail.com */ -public class ChaosBoosterDraftEliminationTournament extends BoosterDraftEliminationTournament { +public class RandomBoosterDraftEliminationTournament extends BoosterDraftEliminationTournament { - public ChaosBoosterDraftEliminationTournament(TournamentOptions options) { + public RandomBoosterDraftEliminationTournament(TournamentOptions options) { super(options); currentStep = TournamentStep.START; } @Override protected void draft() { - draft = new ChaosBoosterDraft((DraftOptions) options.getLimitedOptions(), getSets()); + draft = new RandomBoosterDraft((DraftOptions) options.getLimitedOptions(), getSets()); for (TournamentPlayer player: players.values()) { draft.addPlayer(player.getPlayer()); player.setState(TournamentPlayerState.DRAFTING); diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftEliminationTournamentType.java b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RandomBoosterDraftEliminationTournamentType.java similarity index 89% rename from Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftEliminationTournamentType.java rename to Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RandomBoosterDraftEliminationTournamentType.java index 6ac57a9ae6..979d7940f8 100644 --- a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftEliminationTournamentType.java +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RandomBoosterDraftEliminationTournamentType.java @@ -34,10 +34,10 @@ import mage.game.tournament.TournamentType; * * @author BetaSteward_at_googlemail.com */ -public class ChaosBoosterDraftEliminationTournamentType extends TournamentType { +public class RandomBoosterDraftEliminationTournamentType extends TournamentType { - public ChaosBoosterDraftEliminationTournamentType() { - this.name = "Booster Draft Elimination (Chaos)"; + public RandomBoosterDraftEliminationTournamentType() { + this.name = "Booster Draft Elimination (Random)"; this.maxPlayers = 16; this.minPlayers = 4; this.numBoosters = 3; @@ -45,7 +45,7 @@ public class ChaosBoosterDraftEliminationTournamentType extends TournamentType { this.limited = true; this.cubeBooster = false; this.elimination = false; - this.isChaos = true; + this.isRandom = true; } } diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftSwissTournament.java b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RandomBoosterDraftSwissTournament.java similarity index 88% rename from Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftSwissTournament.java rename to Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RandomBoosterDraftSwissTournament.java index 75f0761f65..dcb181c5d8 100644 --- a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftSwissTournament.java +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RandomBoosterDraftSwissTournament.java @@ -32,23 +32,23 @@ import mage.constants.TournamentPlayerState; import mage.game.draft.DraftOptions; import mage.game.events.TableEvent.EventType; import mage.game.tournament.TournamentPlayer; -import mage.game.draft.ChaosBoosterDraft; +import mage.game.draft.RandomBoosterDraft; import mage.game.tournament.TournamentOptions; /** * * @author BetaSteward_at_googlemail.com */ -public class ChaosBoosterDraftSwissTournament extends BoosterDraftSwissTournament { +public class RandomBoosterDraftSwissTournament extends BoosterDraftSwissTournament { - public ChaosBoosterDraftSwissTournament(TournamentOptions options) { + public RandomBoosterDraftSwissTournament(TournamentOptions options) { super(options); currentStep = TournamentStep.START; } @Override protected void draft() { - draft = new ChaosBoosterDraft((DraftOptions) options.getLimitedOptions(), getSets()); + draft = new RandomBoosterDraft((DraftOptions) options.getLimitedOptions(), getSets()); for (TournamentPlayer player: players.values()) { draft.addPlayer(player.getPlayer()); player.setState(TournamentPlayerState.DRAFTING); diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftSwissTournamentType.java b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RandomBoosterDraftSwissTournamentType.java similarity index 90% rename from Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftSwissTournamentType.java rename to Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RandomBoosterDraftSwissTournamentType.java index 8f638e2ea3..b669a0ea02 100644 --- a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/ChaosBoosterDraftSwissTournamentType.java +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/RandomBoosterDraftSwissTournamentType.java @@ -34,10 +34,10 @@ import mage.game.tournament.TournamentType; * * @author BetaSteward_at_googlemail.com */ -public class ChaosBoosterDraftSwissTournamentType extends TournamentType { +public class RandomBoosterDraftSwissTournamentType extends TournamentType { - public ChaosBoosterDraftSwissTournamentType() { - this.name = "Booster Draft Swiss (Chaos)"; + public RandomBoosterDraftSwissTournamentType() { + this.name = "Booster Draft Swiss (Random)"; this.maxPlayers = 16; this.minPlayers = 4; this.numBoosters = 3; @@ -45,7 +45,7 @@ public class ChaosBoosterDraftSwissTournamentType extends TournamentType { this.limited = true; this.cubeBooster = false; this.elimination = false; - this.isChaos = true; + this.isRandom = true; } } diff --git a/Mage.Server/config/config.xml b/Mage.Server/config/config.xml index 31d0368995..a3f3167c17 100644 --- a/Mage.Server/config/config.xml +++ b/Mage.Server/config/config.xml @@ -55,10 +55,10 @@ - + - + diff --git a/Mage/src/mage/game/draft/ChaosBoosterDraft.java b/Mage/src/mage/game/draft/RandomBoosterDraft.java similarity index 84% rename from Mage/src/mage/game/draft/ChaosBoosterDraft.java rename to Mage/src/mage/game/draft/RandomBoosterDraft.java index 3c25bfea68..ebd0a8a9ef 100644 --- a/Mage/src/mage/game/draft/ChaosBoosterDraft.java +++ b/Mage/src/mage/game/draft/RandomBoosterDraft.java @@ -32,20 +32,19 @@ import java.util.ArrayList; import java.util.List; import mage.cards.ExpansionSet; import java.util.Collections; -import java.lang.RuntimeException; /** * * @author BrodyLodmell_at_googlemail.com */ -public class ChaosBoosterDraft extends BoosterDraft { +public class RandomBoosterDraft extends BoosterDraft { List allSets; - List usedBoosters; - public ChaosBoosterDraft(DraftOptions options, List sets) { + List useBoosters; + public RandomBoosterDraft(DraftOptions options, List sets) { super(options, sets); if (sets.isEmpty()){ - throw new RuntimeException("At least one set must be selected for chaos booster draft"); + throw new RuntimeException("At least one set must be selected for random booster draft"); } allSets = new ArrayList<>(sets); resetBoosters(); @@ -81,16 +80,16 @@ public class ChaosBoosterDraft extends BoosterDraft { } private ExpansionSet getNextBooster() { - if (0 == usedBoosters.size()){ + if (0 == useBoosters.size()){ resetBoosters(); } - ExpansionSet theBooster = usedBoosters.get(0); - usedBoosters.remove(theBooster); + ExpansionSet theBooster = useBoosters.get(0); + useBoosters.remove(theBooster); return theBooster; } private void resetBoosters(){ - usedBoosters = new ArrayList<>(allSets); - Collections.shuffle(usedBoosters); + useBoosters = new ArrayList<>(allSets); + Collections.shuffle(useBoosters); } } diff --git a/Mage/src/mage/game/tournament/LimitedOptions.java b/Mage/src/mage/game/tournament/LimitedOptions.java index 4c5e3b0080..1d65ef1217 100644 --- a/Mage/src/mage/game/tournament/LimitedOptions.java +++ b/Mage/src/mage/game/tournament/LimitedOptions.java @@ -44,7 +44,7 @@ public class LimitedOptions implements Serializable { protected String draftCubeName; protected DraftCube draftCube; protected int numberBoosters; - protected boolean isChaos; + protected boolean isRandom; public List getSetCodes() { return sets; @@ -82,10 +82,10 @@ public class LimitedOptions implements Serializable { this.numberBoosters = numberBoosters; } - public boolean getIsChaos(){ - return isChaos; + public boolean getIsRandom(){ + return isRandom; } - public void setIsChaos(boolean isChaos){ - this.isChaos = isChaos; + public void setIsRandom(boolean isRandom){ + this.isRandom = isRandom; } } diff --git a/Mage/src/mage/game/tournament/TournamentType.java b/Mage/src/mage/game/tournament/TournamentType.java index 88505f678d..d572743520 100644 --- a/Mage/src/mage/game/tournament/TournamentType.java +++ b/Mage/src/mage/game/tournament/TournamentType.java @@ -44,7 +44,7 @@ public class TournamentType implements Serializable { protected boolean draft; // or sealed protected boolean limited; // or construced protected boolean elimination; // or Swiss - protected boolean isChaos; + protected boolean isRandom; protected TournamentType() {} @@ -85,8 +85,8 @@ public class TournamentType implements Serializable { return cubeBooster; } - public boolean isChaos(){ - return this.isChaos; + public boolean isRandom(){ + return this.isRandom; } }