mirror of
https://github.com/correl/mage.git
synced 2025-04-02 03:18:09 -09:00
Merge pull request #4879 from spjspj/master
Add planechase to new tournament window as well.
This commit is contained in:
commit
4b4d7989cd
5 changed files with 31 additions and 7 deletions
Mage.Client/src/main/java/mage/client/dialog
Mage/src/main/java/mage
|
@ -57,6 +57,8 @@
|
|||
<Component id="spnNumRounds" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="cbAllowSpectators" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="cbPlaneChase" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
|
@ -186,6 +188,7 @@
|
|||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||
<Group type="103" alignment="1" groupAlignment="3" attributes="0">
|
||||
<Component id="cbAllowSpectators" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="cbPlaneChase" alignment="3" max="32767" attributes="0"/>
|
||||
<Component id="spnNumRounds" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblNumRounds" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
|
@ -454,6 +457,13 @@
|
|||
<Property name="toolTipText" type="java.lang.String" value="Allow other players to watch the games of this table."/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="cbPlaneChase">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Plane Chase"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Use Plane Chase for the tournament."/>
|
||||
</Properties>
|
||||
</Component>
|
||||
|
||||
<Component class="javax.swing.JLabel" name="lblPlayer1">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
|
|
|
@ -123,6 +123,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
tournamentPlayerPanel.init(i++);
|
||||
}
|
||||
cbAllowSpectators.setSelected(true);
|
||||
cbPlaneChase.setSelected(false);
|
||||
this.setModal(true);
|
||||
this.setLocation(150, 100);
|
||||
}
|
||||
|
@ -173,6 +174,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
jLabel6 = new javax.swing.JLabel();
|
||||
cbDraftTiming = new javax.swing.JComboBox();
|
||||
cbAllowSpectators = new javax.swing.JCheckBox();
|
||||
cbPlaneChase = new javax.swing.JCheckBox();
|
||||
lblPlayer1 = new javax.swing.JLabel();
|
||||
lblConstructionTime = new javax.swing.JLabel();
|
||||
chkRollbackTurnsAllowed = new javax.swing.JCheckBox();
|
||||
|
@ -286,6 +288,9 @@ public class NewTournamentDialog extends MageDialog {
|
|||
cbAllowSpectators.setText("Allow spectators");
|
||||
cbAllowSpectators.setToolTipText("Allow other players to watch the games of this table.");
|
||||
|
||||
cbPlaneChase.setText("Use Plane Chase");
|
||||
cbPlaneChase.setToolTipText("Use Plane Chase variant for the tournament.");
|
||||
|
||||
lblPlayer1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||
lblPlayer1.setText("Player 1 (You)");
|
||||
|
||||
|
@ -379,7 +384,9 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spnNumRounds, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbAllowSpectators))))
|
||||
.addComponent(cbAllowSpectators)
|
||||
.addComponent(cbPlaneChase)
|
||||
)))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
@ -491,6 +498,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbAllowSpectators, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(cbPlaneChase, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spnNumRounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblNumRounds))
|
||||
.addComponent(lblNbrPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
|
@ -537,6 +545,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
tOptions.setPassword(txtPassword.getText());
|
||||
tOptions.getPlayerTypes().add(PlayerType.HUMAN);
|
||||
tOptions.setWatchingAllowed(cbAllowSpectators.isSelected());
|
||||
tOptions.setPlaneChase(cbPlaneChase.isSelected());
|
||||
tOptions.setQuitRatio((Integer) spnQuitRatio.getValue());
|
||||
for (TournamentPlayerPanel player : players) {
|
||||
tOptions.getPlayerTypes().add((PlayerType) player.getPlayerType().getSelectedItem());
|
||||
|
@ -1106,6 +1115,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
}
|
||||
}
|
||||
this.cbAllowSpectators.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_SPECTATORS + versionStr, "Yes").equals("Yes"));
|
||||
this.cbPlaneChase.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLANE_CHASE + versionStr, "No").equals("Yes"));
|
||||
this.chkRollbackTurnsAllowed.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS + versionStr, "Yes").equals("Yes"));
|
||||
this.chkRated.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_RATED + versionStr, "No").equals("Yes"));
|
||||
}
|
||||
|
@ -1191,6 +1201,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
}
|
||||
}
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_SPECTATORS + versionStr, (tOptions.isWatchingAllowed() ? "Yes" : "No"));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLANE_CHASE + versionStr, (tOptions.isPlaneChase() ? "Yes" : "No"));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS + versionStr, (tOptions.getMatchOptions().isRollbackTurnsAllowed() ? "Yes" : "No"));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_RATED + versionStr, (tOptions.getMatchOptions().isRated() ? "Yes" : "No"));
|
||||
}
|
||||
|
@ -1205,6 +1216,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
private javax.swing.JButton btnSavedConfiguration1;
|
||||
private javax.swing.JButton btnSavedConfiguration2;
|
||||
private javax.swing.JCheckBox cbAllowSpectators;
|
||||
private javax.swing.JCheckBox cbPlaneChase;
|
||||
private javax.swing.JComboBox cbDeckType;
|
||||
private javax.swing.JComboBox cbDraftCube;
|
||||
private javax.swing.JComboBox cbDraftTiming;
|
||||
|
|
|
@ -264,6 +264,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
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_ALLOW_SPECTATORS = "newTournamentAllowSpectators";
|
||||
public static final String KEY_NEW_TOURNAMENT_PLANE_CHASE = "newTournamentPlaneChase";
|
||||
public static final String KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS = "newTournamentAllowRollbacks";
|
||||
public static final String KEY_NEW_TOURNAMENT_DECK_FILE = "newTournamentDeckFile";
|
||||
public static final String KEY_NEW_TOURNAMENT_QUIT_RATIO = "newTournamentQuitRatio";
|
||||
|
|
|
@ -98,6 +98,7 @@ public class TournamentOptions implements Serializable {
|
|||
|
||||
public void setPlaneChase(boolean planeChase) {
|
||||
this.planeChase = planeChase;
|
||||
this.matchOptions.setPlaneChase(planeChase);
|
||||
}
|
||||
|
||||
public int getNumberRounds() {
|
||||
|
|
|
@ -2499,7 +2499,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
@Override
|
||||
public PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects) {
|
||||
return rollPlanarDie(game, appliedEffects, 1, 1);
|
||||
return rollPlanarDie(game, appliedEffects, 2, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2514,15 +2514,15 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
*/
|
||||
@Override
|
||||
public PlanarDieRoll rollPlanarDie(Game game, ArrayList<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
|
||||
int result = RandomUtil.nextInt(6) + 1;
|
||||
int result = RandomUtil.nextInt(9) + 1;
|
||||
PlanarDieRoll roll = PlanarDieRoll.NIL_ROLL;
|
||||
if (numberChaosSides + numberPlanarSides > 6) {
|
||||
numberChaosSides = 1;
|
||||
numberPlanarSides = 1;
|
||||
if (numberChaosSides + numberPlanarSides > 9) {
|
||||
numberChaosSides = 2;
|
||||
numberPlanarSides = 2;
|
||||
}
|
||||
if (result <= numberChaosSides) {
|
||||
roll = PlanarDieRoll.CHAOS_ROLL;
|
||||
} else if (result > 6 - numberPlanarSides) {
|
||||
} else if (result > 9 - numberPlanarSides) {
|
||||
roll = PlanarDieRoll.PLANAR_ROLL;
|
||||
}
|
||||
if (!game.isSimulation()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue