Merge origin/master

This commit is contained in:
fireshoes 2015-06-24 00:16:12 -05:00
commit 72347ed59f
13 changed files with 106 additions and 84 deletions

View file

@ -118,7 +118,7 @@
</Group> </Group>
</Group> </Group>
<Component id="player1Panel" alignment="0" max="32767" attributes="0"/> <Component id="player1Panel" alignment="0" max="32767" attributes="0"/>
<Component id="pnlChaosPacks" alignment="1" max="32767" attributes="0"/> <Component id="pnlRandomPacks" alignment="1" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
@ -169,7 +169,7 @@
<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"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="pnlChaosPacks" min="-2" max="-2" attributes="0"/> <Component id="pnlRandomPacks" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0"> <Group type="103" groupAlignment="1" max="-2" attributes="0">
<Group type="103" alignment="1" groupAlignment="3" attributes="0"> <Group type="103" alignment="1" groupAlignment="3" attributes="0">
@ -511,13 +511,14 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCancelActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCancelActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Container class="javax.swing.JPanel" name="pnlChaosPacks"> <Container class="javax.swing.JPanel" name="pnlRandomPacks">
<Properties> <Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo"> <Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/> <EtchetBorder/>
</Border> </Border>
</Property> </Property>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties> </Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout"> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">

View file

@ -80,12 +80,12 @@ public class NewTournamentDialog extends MageDialog {
private UUID roomId; private UUID roomId;
private final Session session; private final Session session;
private String lastSessionId; private String lastSessionId;
private JList chaosList = new JList(); private JList randomList = new JList();
private final List<TournamentPlayerPanel> players = new ArrayList<>(); private final List<TournamentPlayerPanel> players = new ArrayList<>();
private final List<JComboBox> packs = new ArrayList<>(); private final List<JComboBox> packs = new ArrayList<>();
private final List<String> chaosPacks = new ArrayList<>();
private final int CONSTRUCTION_TIME_MIN = 6; private final int CONSTRUCTION_TIME_MIN = 6;
private final int CONSTRUCTION_TIME_MAX = 30; 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; private boolean automaticChange = false;
@ -178,7 +178,7 @@ public class NewTournamentDialog extends MageDialog {
pnlOtherPlayers = new javax.swing.JPanel(); pnlOtherPlayers = new javax.swing.JPanel();
btnOk = new javax.swing.JButton(); btnOk = new javax.swing.JButton();
btnCancel = new javax.swing.JButton(); btnCancel = new javax.swing.JButton();
pnlChaosPacks = new javax.swing.JPanel(); pnlRandomPacks = new javax.swing.JPanel();
setTitle("New Tournament"); setTitle("New Tournament");
@ -341,8 +341,9 @@ public class NewTournamentDialog extends MageDialog {
} }
}); });
pnlChaosPacks.setBorder(javax.swing.BorderFactory.createEtchedBorder()); pnlRandomPacks.setBorder(javax.swing.BorderFactory.createEtchedBorder());
pnlChaosPacks.setLayout(new java.awt.GridLayout(0, 1, 2, 0)); pnlRandomPacks.setToolTipText("");
pnlRandomPacks.setLayout(new java.awt.GridLayout(0, 1, 2, 0));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout); getContentPane().setLayout(layout);
@ -426,7 +427,7 @@ public class NewTournamentDialog extends MageDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))))) .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(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()) .addContainerGap())
); );
layout.setVerticalGroup( layout.setVerticalGroup(
@ -469,7 +470,7 @@ public class NewTournamentDialog extends MageDialog {
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(pnlPacks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pnlPacks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .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) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
@ -529,18 +530,19 @@ public class NewTournamentDialog extends MageDialog {
} }
if (tournamentType.isLimited()) { if (tournamentType.isLimited()) {
tOptions.getLimitedOptions().setConstructionTime((Integer)this.spnConstructTime.getValue() * 60); tOptions.getLimitedOptions().setConstructionTime((Integer)this.spnConstructTime.getValue() * 60);
tOptions.getLimitedOptions().setIsRandom(tournamentType.isRandom());
if (tournamentType.isCubeBooster()) { if (tournamentType.isCubeBooster()) {
tOptions.getLimitedOptions().setDraftCubeName(this.cbDraftCube.getSelectedItem().toString()); tOptions.getLimitedOptions().setDraftCubeName(this.cbDraftCube.getSelectedItem().toString());
} else if (tournamentType.isChaos()){ } else if (tournamentType.isRandom()) {
for (Integer pack: chaosList.getSelectedIndices()){ for (Object pack : randomList.getSelectedValuesList()) {
String packStr = (String)chaosList.getModel().getElementAt(pack); String packStr = (String) pack;
String code = packStr.substring(0, 3); String code = packStr.substring(0, 3);
tOptions.getLimitedOptions().getSetCodes().add(code); tOptions.getLimitedOptions().getSetCodes().add(code);
} }
if (tOptions.getLimitedOptions().getSetCodes().size() < 2){ if (tOptions.getLimitedOptions().getSetCodes().size() < 2) {
// At least two sets must be chosen. // At least two sets must be chosen.
return; return;
} }
} else { } else {
for (JComboBox pack: packs) { for (JComboBox pack: packs) {
tOptions.getLimitedOptions().getSetCodes().add(((ExpansionInfo) pack.getSelectedItem()).getCode()); tOptions.getLimitedOptions().getSetCodes().add(((ExpansionInfo) pack.getSelectedItem()).getCode());
@ -653,8 +655,8 @@ public class NewTournamentDialog extends MageDialog {
createPlayers((Integer) spnNumPlayers.getValue() - 1); createPlayers((Integer) spnNumPlayers.getValue() - 1);
if (tournamentType.isLimited()) { if (tournamentType.isLimited()) {
if (tournamentType.isChaos()){ if (tournamentType.isRandom()){
createChaosPacks(); createRandomPacks();
}else{ }else{
createPacks(tournamentType.getNumBoosters()); createPacks(tournamentType.getNumBoosters());
} }
@ -696,19 +698,19 @@ public class NewTournamentDialog extends MageDialog {
this.cbDraftCube.setVisible(true); this.cbDraftCube.setVisible(true);
this.lblPacks.setVisible(false); this.lblPacks.setVisible(false);
this.pnlPacks.setVisible(false); this.pnlPacks.setVisible(false);
this.pnlChaosPacks.setVisible(false); this.pnlRandomPacks.setVisible(false);
} else if (tournamentType.isChaos()){ } else if (tournamentType.isRandom()){
this.lblDraftCube.setVisible(false); this.lblDraftCube.setVisible(false);
this.cbDraftCube.setVisible(false); this.cbDraftCube.setVisible(false);
this.lblPacks.setVisible(true); this.lblPacks.setVisible(true);
this.pnlChaosPacks.setVisible(true); this.pnlRandomPacks.setVisible(true);
this.pnlPacks.setVisible(false); this.pnlPacks.setVisible(false);
} else { } else {
this.lblDraftCube.setVisible(false); this.lblDraftCube.setVisible(false);
this.cbDraftCube.setVisible(false); this.cbDraftCube.setVisible(false);
this.lblPacks.setVisible(true); this.lblPacks.setVisible(true);
this.pnlPacks.setVisible(true); this.pnlPacks.setVisible(true);
this.pnlChaosPacks.setVisible(false); this.pnlRandomPacks.setVisible(false);
} }
} else { } else {
// construced // construced
@ -716,21 +718,24 @@ public class NewTournamentDialog extends MageDialog {
this.cbDraftCube.setVisible(false); this.cbDraftCube.setVisible(false);
this.pnlPacks.setVisible(false); this.pnlPacks.setVisible(false);
this.pnlPacks.setVisible(false); this.pnlPacks.setVisible(false);
this.pnlChaosPacks.setVisible(false); this.pnlRandomPacks.setVisible(false);
} }
} }
private void createChaosPacks() { private void createRandomPacks() {
if (pnlChaosPacks.getComponentCount() == 0 ){ if (pnlRandomPacks.getComponentCount() == 0) {
DefaultListModel chaosListModel = new DefaultListModel();
chaosList = new JList(chaosListModel); DefaultListModel randomListModel = new DefaultListModel();
randomList = new JList(randomListModel);
randomList.setToolTipText(randomDraftDescription);
ExpansionInfo[] allExpansions = ExpansionRepository.instance.getWithBoostersSortedByReleaseDate(); ExpansionInfo[] allExpansions = ExpansionRepository.instance.getWithBoostersSortedByReleaseDate();
for (ExpansionInfo expansion: allExpansions){ for (ExpansionInfo expansion : allExpansions) {
String exp = expansion.getCode() + " - " + expansion.getName(); String exp = expansion.getCode() + " - " + expansion.getName();
chaosListModel.addElement(exp); randomListModel.addElement(exp);
} }
chaosList.setSelectionModel(new DefaultListSelectionModel() { randomList.setSelectionModel(new DefaultListSelectionModel() {
private boolean mGestureStarted; private boolean mGestureStarted;
@Override @Override
public void setSelectionInterval(int index0, int index1) { public void setSelectionInterval(int index0, int index1) {
// Toggle only one element while the user is dragging the mouse // Toggle only one element while the user is dragging the mouse
@ -760,10 +765,18 @@ private void createChaosPacks() {
} }
} }
}); });
chaosList.setSelectionInterval(0, chaosListModel.size()-1);
JScrollPane list1scr = new JScrollPane(chaosList); String randomPrefs = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_RANDOM_DRAFT, "");
chaosList.setVisibleRowCount(4); if (randomPrefs.length() > 0) {
pnlChaosPacks.add(list1scr); 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.pack();
this.revalidate(); this.revalidate();
@ -916,7 +929,7 @@ private void createChaosPacks() {
if (tournamentType.isDraft()) { if (tournamentType.isDraft()) {
numPlayers = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLAYERS_DRAFT, "4")); numPlayers = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLAYERS_DRAFT, "4"));
setTournamentOptions(numPlayers); setTournamentOptions(numPlayers);
if (!tournamentType.isChaos()){ if (!tournamentType.isRandom()){
loadBoosterPacks(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_DRAFT, "")); 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_PLAYERS_DRAFT, Integer.toString(tOptions.getPlayerTypes().size()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_DRAFT_TIMING, draftOptions.getTiming().name()); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_DRAFT_TIMING, draftOptions.getTiming().name());
} }
}
if (tOptions.getTournamentType().startsWith("Booster")) {
String deckFile = this.player1Panel.getDeckFile(); String deckFile = this.player1Panel.getDeckFile();
if (deckFile != null && !deckFile.isEmpty()) { if (deckFile != null && !deckFile.isEmpty()) {
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_DECK_FILE, deckFile); 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_SPECTATORS, (tOptions.isWatchingAllowed()?"Yes":"No"));
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS, (tOptions.getMatchOptions().isRollbackTurnsAllowed()?"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 lblPlayer1;
private javax.swing.JLabel lblTournamentType; private javax.swing.JLabel lblTournamentType;
private mage.client.table.NewPlayerPanel player1Panel; private mage.client.table.NewPlayerPanel player1Panel;
private javax.swing.JPanel pnlChaosPacks;
private javax.swing.JPanel pnlDraftOptions; private javax.swing.JPanel pnlDraftOptions;
private javax.swing.JPanel pnlOtherPlayers; private javax.swing.JPanel pnlOtherPlayers;
private javax.swing.JPanel pnlPacks; private javax.swing.JPanel pnlPacks;
private javax.swing.JPanel pnlPlayers; private javax.swing.JPanel pnlPlayers;
private javax.swing.JPanel pnlRandomPacks;
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;

View file

@ -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_NUMBER_OF_WINS = "newTournamentNumberOfWins";
public static final String KEY_NEW_TOURNAMENT_PACKS_SEALED = "newTournamentPacksSealed"; 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_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_SEALED = "newTournamentPlayersSealed";
public static final String KEY_NEW_TOURNAMENT_PLAYERS_DRAFT = "newTournamentPlayersDraft"; public static final String KEY_NEW_TOURNAMENT_PLAYERS_DRAFT = "newTournamentPlayersDraft";
public static final String KEY_NEW_TOURNAMENT_DRAFT_TIMING = "newTournamentDraftTiming"; public static final String KEY_NEW_TOURNAMENT_DRAFT_TIMING = "newTournamentDraftTiming";

View file

@ -153,10 +153,10 @@ public class DraftPanel extends javax.swing.JPanel {
public void updateDraft(DraftView draftView) { public void updateDraft(DraftView draftView) {
if (draftView.getSets().size() != 3){ if (draftView.getSets().size() != 3){
// Chaos draft // Random draft
this.txtPack1.setText("???"); this.txtPack1.setText("Random Boosters");
this.txtPack2.setText("???"); this.txtPack2.setText("Random Boosters");
this.txtPack3.setText("???"); this.txtPack3.setText("Random Boosters");
}else{ }else{
this.txtPack1.setText(draftView.getSets().get(0)); this.txtPack1.setText(draftView.getSets().get(0));
this.txtPack2.setText(draftView.getSets().get(1)); this.txtPack2.setText(draftView.getSets().get(1));

View file

@ -46,7 +46,7 @@ public class TournamentTypeView implements Serializable {
private final boolean limited; private final boolean limited;
private final boolean cubeBooster; private final boolean cubeBooster;
private final boolean elimination; private final boolean elimination;
private final boolean chaos; private final boolean random;
public TournamentTypeView(TournamentType tournamentType) { public TournamentTypeView(TournamentType tournamentType) {
@ -58,7 +58,7 @@ public class TournamentTypeView implements Serializable {
this.limited = tournamentType.isLimited(); this.limited = tournamentType.isLimited();
this.cubeBooster = tournamentType.isCubeBooster(); this.cubeBooster = tournamentType.isCubeBooster();
this.elimination = tournamentType.isElimination(); this.elimination = tournamentType.isElimination();
this.chaos = tournamentType.isChaos(); this.random = tournamentType.isRandom();
} }
@Override @Override
@ -98,7 +98,7 @@ public class TournamentTypeView implements Serializable {
return elimination; return elimination;
} }
public boolean isChaos(){ public boolean isRandom(){
return chaos; return random;
} }
} }

View file

@ -32,23 +32,23 @@ import mage.constants.TournamentPlayerState;
import mage.game.draft.DraftOptions; import mage.game.draft.DraftOptions;
import mage.game.events.TableEvent.EventType; import mage.game.events.TableEvent.EventType;
import mage.game.tournament.TournamentPlayer; import mage.game.tournament.TournamentPlayer;
import mage.game.draft.ChaosBoosterDraft; import mage.game.draft.RandomBoosterDraft;
import mage.game.tournament.TournamentOptions; import mage.game.tournament.TournamentOptions;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @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); super(options);
currentStep = TournamentStep.START; currentStep = TournamentStep.START;
} }
@Override @Override
protected void draft() { protected void draft() {
draft = new ChaosBoosterDraft((DraftOptions) options.getLimitedOptions(), getSets()); draft = new RandomBoosterDraft((DraftOptions) options.getLimitedOptions(), getSets());
for (TournamentPlayer player: players.values()) { for (TournamentPlayer player: players.values()) {
draft.addPlayer(player.getPlayer()); draft.addPlayer(player.getPlayer());
player.setState(TournamentPlayerState.DRAFTING); player.setState(TournamentPlayerState.DRAFTING);

View file

@ -34,10 +34,10 @@ import mage.game.tournament.TournamentType;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class ChaosBoosterDraftEliminationTournamentType extends TournamentType { public class RandomBoosterDraftEliminationTournamentType extends TournamentType {
public ChaosBoosterDraftEliminationTournamentType() { public RandomBoosterDraftEliminationTournamentType() {
this.name = "Booster Draft Elimination (Chaos)"; this.name = "Booster Draft Elimination (Random)";
this.maxPlayers = 16; this.maxPlayers = 16;
this.minPlayers = 4; this.minPlayers = 4;
this.numBoosters = 3; this.numBoosters = 3;
@ -45,7 +45,7 @@ public class ChaosBoosterDraftEliminationTournamentType extends TournamentType {
this.limited = true; this.limited = true;
this.cubeBooster = false; this.cubeBooster = false;
this.elimination = false; this.elimination = false;
this.isChaos = true; this.isRandom = true;
} }
} }

View file

@ -32,23 +32,23 @@ import mage.constants.TournamentPlayerState;
import mage.game.draft.DraftOptions; import mage.game.draft.DraftOptions;
import mage.game.events.TableEvent.EventType; import mage.game.events.TableEvent.EventType;
import mage.game.tournament.TournamentPlayer; import mage.game.tournament.TournamentPlayer;
import mage.game.draft.ChaosBoosterDraft; import mage.game.draft.RandomBoosterDraft;
import mage.game.tournament.TournamentOptions; import mage.game.tournament.TournamentOptions;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @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); super(options);
currentStep = TournamentStep.START; currentStep = TournamentStep.START;
} }
@Override @Override
protected void draft() { protected void draft() {
draft = new ChaosBoosterDraft((DraftOptions) options.getLimitedOptions(), getSets()); draft = new RandomBoosterDraft((DraftOptions) options.getLimitedOptions(), getSets());
for (TournamentPlayer player: players.values()) { for (TournamentPlayer player: players.values()) {
draft.addPlayer(player.getPlayer()); draft.addPlayer(player.getPlayer());
player.setState(TournamentPlayerState.DRAFTING); player.setState(TournamentPlayerState.DRAFTING);

View file

@ -34,10 +34,10 @@ import mage.game.tournament.TournamentType;
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public class ChaosBoosterDraftSwissTournamentType extends TournamentType { public class RandomBoosterDraftSwissTournamentType extends TournamentType {
public ChaosBoosterDraftSwissTournamentType() { public RandomBoosterDraftSwissTournamentType() {
this.name = "Booster Draft Swiss (Chaos)"; this.name = "Booster Draft Swiss (Random)";
this.maxPlayers = 16; this.maxPlayers = 16;
this.minPlayers = 4; this.minPlayers = 4;
this.numBoosters = 3; this.numBoosters = 3;
@ -45,7 +45,7 @@ public class ChaosBoosterDraftSwissTournamentType extends TournamentType {
this.limited = true; this.limited = true;
this.cubeBooster = false; this.cubeBooster = false;
this.elimination = false; this.elimination = false;
this.isChaos = true; this.isRandom = true;
} }
} }

View file

@ -55,10 +55,10 @@
<tournamentType name="Constructed Swiss" jar="mage-tournament-constructed.jar" className="mage.tournament.ConstructedSwissTournament" typeName="mage.tournament.ConstructedSwissTournamentType"/> <tournamentType name="Constructed Swiss" jar="mage-tournament-constructed.jar" className="mage.tournament.ConstructedSwissTournament" typeName="mage.tournament.ConstructedSwissTournamentType"/>
<tournamentType name="Booster Draft Elimination" jar="mage-tournament-booster-draft.jar" className="mage.tournament.BoosterDraftEliminationTournament" typeName="mage.tournament.BoosterDraftEliminationTournamentType"/> <tournamentType name="Booster Draft Elimination" jar="mage-tournament-booster-draft.jar" className="mage.tournament.BoosterDraftEliminationTournament" typeName="mage.tournament.BoosterDraftEliminationTournamentType"/>
<tournamentType name="Booster Draft Elimination (Cube)" jar="mage-tournament-booster-draft.jar" className="mage.tournament.BoosterDraftEliminationTournament" typeName="mage.tournament.BoosterDraftEliminationCubeTournamentType"/> <tournamentType name="Booster Draft Elimination (Cube)" jar="mage-tournament-booster-draft.jar" className="mage.tournament.BoosterDraftEliminationTournament" typeName="mage.tournament.BoosterDraftEliminationCubeTournamentType"/>
<tournamentType name="Booster Draft Elimination (Chaos)" jar="mage-tournament-booster-draft.jar" className="mage.tournament.ChaosBoosterDraftEliminationTournament" typeName="mage.tournament.ChaosBoosterDraftEliminationTournamentType"/> <tournamentType name="Booster Draft Elimination (Random)" jar="mage-tournament-booster-draft.jar" className="mage.tournament.RandomBoosterDraftEliminationTournament" typeName="mage.tournament.RandomBoosterDraftEliminationTournamentType"/>
<tournamentType name="Booster Draft Swiss" jar="mage-tournament-booster-draft.jar" className="mage.tournament.BoosterDraftSwissTournament" typeName="mage.tournament.BoosterDraftSwissTournamentType"/> <tournamentType name="Booster Draft Swiss" jar="mage-tournament-booster-draft.jar" className="mage.tournament.BoosterDraftSwissTournament" typeName="mage.tournament.BoosterDraftSwissTournamentType"/>
<tournamentType name="Booster Draft Swiss (Cube)" jar="mage-tournament-booster-draft.jar" className="mage.tournament.BoosterDraftSwissTournament" typeName="mage.tournament.BoosterDraftSwissCubeTournamentType"/> <tournamentType name="Booster Draft Swiss (Cube)" jar="mage-tournament-booster-draft.jar" className="mage.tournament.BoosterDraftSwissTournament" typeName="mage.tournament.BoosterDraftSwissCubeTournamentType"/>
<tournamentType name="Booster Draft Swiss (Chaos)" jar="mage-tournament-booster-draft.jar" className="mage.tournament.ChaosBoosterDraftSwissTournament" typeName="mage.tournament.ChaosBoosterDraftSwissTournamentType"/> <tournamentType name="Booster Draft Swiss (Random)" jar="mage-tournament-booster-draft.jar" className="mage.tournament.RandomBoosterDraftSwissTournament" typeName="mage.tournament.RandomBoosterDraftSwissTournamentType"/>
<tournamentType name="Sealed Elimination" jar="mage-tournament-sealed.jar" className="mage.tournament.SealedEliminationTournament" typeName="mage.tournament.SealedEliminationTournamentType"/> <tournamentType name="Sealed Elimination" jar="mage-tournament-sealed.jar" className="mage.tournament.SealedEliminationTournament" typeName="mage.tournament.SealedEliminationTournamentType"/>
<tournamentType name="Sealed Elimination (Cube)" jar="mage-tournament-sealed.jar" className="mage.tournament.SealedEliminationTournament" typeName="mage.tournament.SealedEliminationCubeTournamentType"/> <tournamentType name="Sealed Elimination (Cube)" jar="mage-tournament-sealed.jar" className="mage.tournament.SealedEliminationTournament" typeName="mage.tournament.SealedEliminationCubeTournamentType"/>
<tournamentType name="Sealed Swiss" jar="mage-tournament-sealed.jar" className="mage.tournament.SealedSwissTournament" typeName="mage.tournament.SealedSwissTournamentType"/> <tournamentType name="Sealed Swiss" jar="mage-tournament-sealed.jar" className="mage.tournament.SealedSwissTournament" typeName="mage.tournament.SealedSwissTournamentType"/>

View file

@ -32,20 +32,19 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import mage.cards.ExpansionSet; import mage.cards.ExpansionSet;
import java.util.Collections; import java.util.Collections;
import java.lang.RuntimeException;
/** /**
* *
* @author BrodyLodmell_at_googlemail.com * @author BrodyLodmell_at_googlemail.com
*/ */
public class ChaosBoosterDraft extends BoosterDraft { public class RandomBoosterDraft extends BoosterDraft {
List<ExpansionSet> allSets; List<ExpansionSet> allSets;
List<ExpansionSet> usedBoosters; List<ExpansionSet> useBoosters;
public ChaosBoosterDraft(DraftOptions options, List<ExpansionSet> sets) { public RandomBoosterDraft(DraftOptions options, List<ExpansionSet> sets) {
super(options, sets); super(options, sets);
if (sets.isEmpty()){ 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); allSets = new ArrayList<>(sets);
resetBoosters(); resetBoosters();
@ -81,16 +80,16 @@ public class ChaosBoosterDraft extends BoosterDraft {
} }
private ExpansionSet getNextBooster() { private ExpansionSet getNextBooster() {
if (0 == usedBoosters.size()){ if (0 == useBoosters.size()){
resetBoosters(); resetBoosters();
} }
ExpansionSet theBooster = usedBoosters.get(0); ExpansionSet theBooster = useBoosters.get(0);
usedBoosters.remove(theBooster); useBoosters.remove(theBooster);
return theBooster; return theBooster;
} }
private void resetBoosters(){ private void resetBoosters(){
usedBoosters = new ArrayList<>(allSets); useBoosters = new ArrayList<>(allSets);
Collections.shuffle(usedBoosters); Collections.shuffle(useBoosters);
} }
} }

View file

@ -44,7 +44,7 @@ public class LimitedOptions implements Serializable {
protected String draftCubeName; protected String draftCubeName;
protected DraftCube draftCube; protected DraftCube draftCube;
protected int numberBoosters; protected int numberBoosters;
protected boolean isChaos; protected boolean isRandom;
public List<String> getSetCodes() { public List<String> getSetCodes() {
return sets; return sets;
@ -82,10 +82,10 @@ public class LimitedOptions implements Serializable {
this.numberBoosters = numberBoosters; this.numberBoosters = numberBoosters;
} }
public boolean getIsChaos(){ public boolean getIsRandom(){
return isChaos; return isRandom;
} }
public void setIsChaos(boolean isChaos){ public void setIsRandom(boolean isRandom){
this.isChaos = isChaos; this.isRandom = isRandom;
} }
} }

View file

@ -44,7 +44,7 @@ public class TournamentType implements Serializable {
protected boolean draft; // or sealed protected boolean draft; // or sealed
protected boolean limited; // or construced protected boolean limited; // or construced
protected boolean elimination; // or Swiss protected boolean elimination; // or Swiss
protected boolean isChaos; protected boolean isRandom;
protected TournamentType() {} protected TournamentType() {}
@ -85,8 +85,8 @@ public class TournamentType implements Serializable {
return cubeBooster; return cubeBooster;
} }
public boolean isChaos(){ public boolean isRandom(){
return this.isChaos; return this.isRandom;
} }
} }