mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
Add custom options for starting life total and starting hand size (#11259)
* add startHandSize / startLife to the custom option panel * use the custom startLife/startHandsize in all Game Modes
This commit is contained in:
parent
3e6097b70e
commit
f14479c53c
76 changed files with 1230 additions and 929 deletions
|
|
@ -52,6 +52,8 @@
|
|||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnFreeMulligans" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="planechaseDescriptionLabel" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="emblemCardsDescriptionLabel" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblVariantOptions" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
|
|
@ -63,8 +65,15 @@
|
|||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="planechaseDescriptionLabel" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="emblemCardsDescriptionLabel" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="checkStartingLife" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnCustomLifeTotal" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="checkStartingHandSize" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnCustomStartingHand" min="-2" pref="46" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
|
|
@ -86,6 +95,17 @@
|
|||
<Component id="lblFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0">
|
||||
<Component id="spnCustomStartingHand" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="checkStartingHandSize" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="spnCustomLifeTotal" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="checkStartingLife" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jSeparator2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblVariantOptions" min="-2" max="-2" attributes="0"/>
|
||||
|
|
@ -321,5 +341,47 @@
|
|||
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value="Give players emblems with the abilities of cards.
Note that some abilities may not function correctly from the command zone.
If anything breaks, please report it on GitHub."/>
|
||||
</AccessibilityProperties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spnCustomLifeTotal">
|
||||
<Properties>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Custom starting life total"/>
|
||||
</Properties>
|
||||
<AccessibilityProperties>
|
||||
<Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Custom starting life total"/>
|
||||
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value="Set a custom starting life total"/>
|
||||
</AccessibilityProperties>
|
||||
<Events>
|
||||
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spnCustomLifeTotalStateChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="checkStartingLife">
|
||||
<Properties>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Check to use a specific starting life total"/>
|
||||
<Property name="actionCommand" type="java.lang.String" value="checkCustomLife"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="10"/>
|
||||
<Property name="label" type="java.lang.String" value="Custom Starting Life"/>
|
||||
</Properties>
|
||||
<AccessibilityProperties>
|
||||
<Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Custom starting life"/>
|
||||
</AccessibilityProperties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="checkStartingLifeActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="checkStartingHandSize">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Custom Starting Hand"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Check to use a specific starting hand size"/>
|
||||
<Property name="actionCommand" type="java.lang.String" value="checkCustomHandSize"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="10"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="checkStartingHandSizeActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spnCustomStartingHand">
|
||||
<Events>
|
||||
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spnCustomStartingHandStateChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import mage.cards.decks.Deck;
|
|||
import mage.cards.decks.DeckFileFilter;
|
||||
import mage.cards.decks.importer.DeckImporter;
|
||||
import mage.client.MageFrame;
|
||||
import mage.constants.MultiplayerAttackOption;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.game.GameException;
|
||||
import mage.game.match.MatchOptions;
|
||||
import mage.game.mulligan.MulliganType;
|
||||
|
|
@ -15,7 +13,6 @@ import javax.swing.*;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* App GUI: custom options for match/tournament
|
||||
|
|
@ -28,6 +25,10 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
TABLE(
|
||||
PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_FREE_MULLIGANS,
|
||||
PreferencesDialog.KEY_NEW_TABLE_MULLIGAN_TYPE,
|
||||
PreferencesDialog.KEY_NEW_TABLE_CUSTOM_STARTING_LIFE,
|
||||
PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_LIFE_AT_START,
|
||||
PreferencesDialog.KEY_NEW_TABLE_CUSTOM_STARTING_HAND_SIZE,
|
||||
PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_HAND_SIZE_AT_START,
|
||||
PreferencesDialog.KEY_NEW_TABLE_PLANECHASE,
|
||||
PreferencesDialog.KEY_NEW_TABLE_EMBLEM_CARDS_ENABLED,
|
||||
PreferencesDialog.KEY_NEW_TABLE_EMBLEM_CARDS_PER_PLAYER_FILE,
|
||||
|
|
@ -37,6 +38,10 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
TOURNEY(
|
||||
PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_FREE_MULLIGANS,
|
||||
PreferencesDialog.KEY_NEW_TOURNAMENT_MULLIGUN_TYPE,
|
||||
PreferencesDialog.KEY_NEW_TOURNAMENT_CUSTOM_STARTING_LIFE,
|
||||
PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_LIFE_AT_START,
|
||||
PreferencesDialog.KEY_NEW_TOURNAMENT_CUSTOM_STARTING_HAND_SIZE,
|
||||
PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_HAND_SIZE_AT_START,
|
||||
PreferencesDialog.KEY_NEW_TOURNAMENT_PLANE_CHASE,
|
||||
PreferencesDialog.KEY_NEW_TOURNAMENT_EMBLEM_CARDS_ENABLED,
|
||||
PreferencesDialog.KEY_NEW_TOURNAMENT_EMBLEM_CARDS_PER_PLAYER_FILE,
|
||||
|
|
@ -44,6 +49,10 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
);
|
||||
public final String NUMBER_OF_FREE_MULLIGANS;
|
||||
public final String MULLIGAN_TYPE;
|
||||
public final String BOOL_CUSTOM_STARTING_LIFE;
|
||||
public final String NUMBER_OF_LIFE_AT_START;
|
||||
public final String BOOL_CUSTOM_STARTING_HAND_SIZE;
|
||||
public final String NUMBER_OF_HAND_SIZE_AT_START;
|
||||
public final String PLANECHASE;
|
||||
public final String EMBLEM_CARDS_ENABLED;
|
||||
public final String EMBLEM_CARDS_PER_PLAYER_FILE;
|
||||
|
|
@ -52,6 +61,10 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
SaveLoadKeys(
|
||||
String numberOfFreeMulligans,
|
||||
String mulliganType,
|
||||
String customStartLife,
|
||||
String valueStartLife,
|
||||
String customStartHandSize,
|
||||
String valueStartHandSize,
|
||||
String planechase,
|
||||
String emblemCardsEnabled,
|
||||
String emblemCardsPerPlayerFile,
|
||||
|
|
@ -59,6 +72,10 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
) {
|
||||
NUMBER_OF_FREE_MULLIGANS = numberOfFreeMulligans;
|
||||
MULLIGAN_TYPE = mulliganType;
|
||||
BOOL_CUSTOM_STARTING_LIFE = customStartLife;
|
||||
NUMBER_OF_LIFE_AT_START = valueStartLife;
|
||||
BOOL_CUSTOM_STARTING_HAND_SIZE = customStartHandSize;
|
||||
NUMBER_OF_HAND_SIZE_AT_START = valueStartHandSize;
|
||||
PLANECHASE = planechase;
|
||||
EMBLEM_CARDS_ENABLED = emblemCardsEnabled;
|
||||
EMBLEM_CARDS_PER_PLAYER_FILE = emblemCardsPerPlayerFile;
|
||||
|
|
@ -81,6 +98,10 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
initComponents();
|
||||
this.spnFreeMulligans.setModel(new SpinnerNumberModel(0, 0, 5, 1));
|
||||
cbMulliganType.setModel(new DefaultComboBoxModel(MulliganType.values()));
|
||||
this.spnCustomLifeTotal.setModel(new SpinnerNumberModel(20, 1, 100, 1));
|
||||
this.spnCustomLifeTotal.setEnabled(false);
|
||||
this.spnCustomStartingHand.setModel(new SpinnerNumberModel(7, 0, 20, 1));
|
||||
this.spnCustomStartingHand.setEnabled(false);
|
||||
this.setModal(true);
|
||||
fcSelectEmblemCardsPerPlayer = new JFileChooser();
|
||||
fcSelectEmblemCardsPerPlayer.setAcceptAllFileFilterUsed(false);
|
||||
|
|
@ -119,6 +140,10 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
txtEmblemCardsStartingPlayer = new javax.swing.JTextField();
|
||||
lblEmblemCardsStartingPlayer = new javax.swing.JLabel();
|
||||
emblemCardsDescriptionLabel = new javax.swing.JLabel();
|
||||
spnCustomLifeTotal = new javax.swing.JSpinner();
|
||||
checkStartingLife = new javax.swing.JCheckBox();
|
||||
checkStartingHandSize = new javax.swing.JCheckBox();
|
||||
spnCustomStartingHand = new javax.swing.JSpinner();
|
||||
|
||||
setTitle("Custom Options");
|
||||
|
||||
|
|
@ -211,6 +236,39 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
emblemCardsDescriptionLabel.setText("<html>Give players emblems with the abilities of cards.<br>Note that some abilities may not function correctly from the command zone.<br>If anything breaks, please report it on GitHub.");
|
||||
emblemCardsDescriptionLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
|
||||
|
||||
spnCustomLifeTotal.setToolTipText("Custom starting life total");
|
||||
spnCustomLifeTotal.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
spnCustomLifeTotalStateChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
checkStartingLife.setToolTipText("Check to use a specific starting life total");
|
||||
checkStartingLife.setActionCommand("checkCustomLife");
|
||||
checkStartingLife.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
|
||||
checkStartingLife.setLabel("Custom Starting Life");
|
||||
checkStartingLife.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
checkStartingLifeActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
checkStartingHandSize.setText("Custom Starting Hand");
|
||||
checkStartingHandSize.setToolTipText("Check to use a specific starting hand size");
|
||||
checkStartingHandSize.setActionCommand("checkCustomHandSize");
|
||||
checkStartingHandSize.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
|
||||
checkStartingHandSize.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
checkStartingHandSizeActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
spnCustomStartingHand.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
spnCustomStartingHandStateChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
|
|
@ -240,6 +298,8 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
.addComponent(lblFreeMulligans)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnFreeMulligans))
|
||||
.addComponent(planechaseDescriptionLabel)
|
||||
.addComponent(emblemCardsDescriptionLabel)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblVariantOptions)
|
||||
|
|
@ -249,8 +309,14 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
.addComponent(lblEmblemCardsStartingPlayer)
|
||||
.addComponent(lblGeneralOptions))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addComponent(planechaseDescriptionLabel)
|
||||
.addComponent(emblemCardsDescriptionLabel))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(checkStartingLife)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnCustomLifeTotal)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(checkStartingHandSize)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnCustomStartingHand, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
|
|
@ -267,6 +333,14 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblFreeMulligans))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(spnCustomStartingHand, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(checkStartingHandSize))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(spnCustomLifeTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(checkStartingLife)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblVariantOptions)
|
||||
|
|
@ -317,6 +391,9 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
lblEmblemCardsStartingPlayer.getAccessibleContext().setAccessibleParent(chkEmblemCards);
|
||||
emblemCardsDescriptionLabel.getAccessibleContext().setAccessibleName("Emblem Cards description");
|
||||
emblemCardsDescriptionLabel.getAccessibleContext().setAccessibleDescription("Give players emblems with the abilities of cards.\nNote that some abilities may not function correctly from the command zone.\nIf anything breaks, please report it on GitHub.");
|
||||
spnCustomLifeTotal.getAccessibleContext().setAccessibleName("Custom starting life total");
|
||||
spnCustomLifeTotal.getAccessibleContext().setAccessibleDescription("Set a custom starting life total");
|
||||
checkStartingLife.getAccessibleContext().setAccessibleName("Custom starting life");
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
|
@ -360,10 +437,27 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
|
||||
}//GEN-LAST:event_txtEmblemCardsStartingPlayerActionPerformed
|
||||
|
||||
private void spnCustomLifeTotalStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnCustomLifeTotalStateChanged
|
||||
updateActiveCount();
|
||||
}//GEN-LAST:event_spnCustomLifeTotalStateChanged
|
||||
|
||||
private void spnCustomStartingHandStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnCustomStartingHandStateChanged
|
||||
updateActiveCount();
|
||||
}//GEN-LAST:event_spnCustomStartingHandStateChanged
|
||||
|
||||
private void checkStartingLifeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkStartingLifeActionPerformed
|
||||
updateActiveCount();
|
||||
}//GEN-LAST:event_checkStartingLifeActionPerformed
|
||||
|
||||
private void checkStartingHandSizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkStartingHandSizeActionPerformed
|
||||
updateActiveCount();
|
||||
}//GEN-LAST:event_checkStartingHandSizeActionPerformed
|
||||
|
||||
public void showDialog() {
|
||||
this.setLocation(150, 100);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
private void loadEmblemCardFile(boolean isStartingPlayer) {
|
||||
JFileChooser fileChooser = isStartingPlayer ? fcSelectEmblemCardsStartingPlayer : fcSelectEmblemCardsPerPlayer;
|
||||
JTextField textField = isStartingPlayer ? txtEmblemCardsStartingPlayer : txtEmblemCardsPerPlayer;
|
||||
|
|
@ -406,6 +500,10 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
this.chkPlaneChase.setSelected(PreferencesDialog.getCachedValue(saveLoadKeys.PLANECHASE + versionStr, "No").equals("Yes"));
|
||||
this.spnFreeMulligans.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(saveLoadKeys.NUMBER_OF_FREE_MULLIGANS + versionStr, "0")));
|
||||
this.cbMulliganType.setSelectedItem(MulliganType.valueByName(PreferencesDialog.getCachedValue(saveLoadKeys.MULLIGAN_TYPE + versionStr, MulliganType.GAME_DEFAULT.toString())));
|
||||
this.checkStartingLife.setSelected(PreferencesDialog.getCachedValue(saveLoadKeys.BOOL_CUSTOM_STARTING_LIFE + versionStr, "No").equals("Yes"));
|
||||
this.spnCustomLifeTotal.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(saveLoadKeys.NUMBER_OF_LIFE_AT_START + versionStr, "20")));
|
||||
this.checkStartingHandSize.setSelected(PreferencesDialog.getCachedValue(saveLoadKeys.BOOL_CUSTOM_STARTING_HAND_SIZE + versionStr, "No").equals("Yes"));
|
||||
this.spnCustomStartingHand.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(saveLoadKeys.NUMBER_OF_HAND_SIZE_AT_START + versionStr, "7")));
|
||||
this.chkEmblemCards.setSelected(PreferencesDialog.getCachedValue(saveLoadKeys.EMBLEM_CARDS_ENABLED + versionStr, "No").equals("Yes"));
|
||||
this.txtEmblemCardsPerPlayer.setText(PreferencesDialog.getCachedValue(saveLoadKeys.EMBLEM_CARDS_PER_PLAYER_FILE, ""));
|
||||
this.txtEmblemCardsStartingPlayer.setText(PreferencesDialog.getCachedValue(saveLoadKeys.EMBLEM_CARDS_STARTING_PLAYER_FILE, ""));
|
||||
|
|
@ -427,6 +525,10 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
}
|
||||
PreferencesDialog.saveValue(saveLoadKeys.NUMBER_OF_FREE_MULLIGANS + versionStr, Integer.toString(options.getFreeMulligans()));
|
||||
PreferencesDialog.saveValue(saveLoadKeys.MULLIGAN_TYPE + versionStr, options.getMulliganType().toString());
|
||||
PreferencesDialog.saveValue(saveLoadKeys.BOOL_CUSTOM_STARTING_LIFE + versionStr, options.isCustomStartLifeEnabled() ? "Yes" : "No");
|
||||
PreferencesDialog.saveValue(saveLoadKeys.NUMBER_OF_LIFE_AT_START + versionStr, Integer.toString(options.getCustomStartLife()));
|
||||
PreferencesDialog.saveValue(saveLoadKeys.BOOL_CUSTOM_STARTING_HAND_SIZE + versionStr, options.isCustomStartHandSizeEnabled() ? "Yes" : "No");
|
||||
PreferencesDialog.saveValue(saveLoadKeys.NUMBER_OF_HAND_SIZE_AT_START + versionStr, Integer.toString(options.getCustomStartHandSize()));
|
||||
PreferencesDialog.saveValue(saveLoadKeys.PLANECHASE + versionStr, options.isPlaneChase() ? "Yes" : "No");
|
||||
PreferencesDialog.saveValue(saveLoadKeys.EMBLEM_CARDS_ENABLED + versionStr,
|
||||
!(options.getGlobalEmblemCards().isEmpty() && options.getPerPlayerEmblemCards().isEmpty()) ? "Yes" : "No");
|
||||
|
|
@ -440,6 +542,10 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
public void writeMatchOptionsTo(MatchOptions options) {
|
||||
options.setFreeMulligans((Integer) spnFreeMulligans.getValue());
|
||||
options.setMullgianType((MulliganType) cbMulliganType.getSelectedItem());
|
||||
options.setCustomStartLifeEnabled(checkStartingLife.isSelected());
|
||||
options.setCustomStartLife((Integer) spnCustomLifeTotal.getValue());
|
||||
options.setCustomStartHandSizeEnabled(checkStartingHandSize.isSelected());
|
||||
options.setCustomStartHandSize((Integer) spnCustomStartingHand.getValue());
|
||||
options.setPlaneChase(chkPlaneChase.isSelected());
|
||||
if (chkEmblemCards.isSelected()) {
|
||||
if (!txtEmblemCardsPerPlayer.getText().isEmpty()) {
|
||||
|
|
@ -452,8 +558,7 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
if (perPlayerEmblemDeck != null) {
|
||||
perPlayerEmblemDeck.clearLayouts();
|
||||
options.setPerPlayerEmblemCards(perPlayerEmblemDeck.getDeckCardLists().getCards());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
options.setPerPlayerEmblemCards(Collections.emptySet());
|
||||
}
|
||||
}
|
||||
|
|
@ -467,13 +572,11 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
if (startingPlayerEmblemDeck != null) {
|
||||
startingPlayerEmblemDeck.clearLayouts();
|
||||
options.setGlobalEmblemCards(startingPlayerEmblemDeck.getDeckCardLists().getCards());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
options.setGlobalEmblemCards(Collections.emptySet());
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
options.setPerPlayerEmblemCards(Collections.emptySet());
|
||||
options.setGlobalEmblemCards(Collections.emptySet());
|
||||
}
|
||||
|
|
@ -481,14 +584,17 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
|
||||
public void updateActiveCount() {
|
||||
int activeCount = 0;
|
||||
if ((Integer)spnFreeMulligans.getValue() > 0) activeCount++;
|
||||
if ((Integer) spnFreeMulligans.getValue() > 0) activeCount++;
|
||||
if (checkStartingLife.isSelected()) activeCount++;
|
||||
spnCustomLifeTotal.setEnabled(checkStartingLife.isSelected());
|
||||
if (checkStartingHandSize.isSelected()) activeCount++;
|
||||
spnCustomStartingHand.setEnabled(checkStartingHandSize.isSelected());
|
||||
if (!cbMulliganType.getSelectedItem().toString().equals(MulliganType.GAME_DEFAULT.toString())) activeCount++;
|
||||
if (chkPlaneChase.isSelected()) activeCount++;
|
||||
if (chkEmblemCards.isSelected()) activeCount++;
|
||||
if (activeCount == 0) {
|
||||
openButton.setText("Custom Options...");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
openButton.setText("Custom Options (" + activeCount + ")");
|
||||
}
|
||||
}
|
||||
|
|
@ -498,6 +604,8 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
private javax.swing.JButton btnEmblemCardsStartingPlayer;
|
||||
private javax.swing.JButton btnOK;
|
||||
private javax.swing.JComboBox<String> cbMulliganType;
|
||||
private javax.swing.JCheckBox checkStartingHandSize;
|
||||
private javax.swing.JCheckBox checkStartingLife;
|
||||
private javax.swing.JCheckBox chkEmblemCards;
|
||||
private javax.swing.JCheckBox chkPlaneChase;
|
||||
private javax.swing.JLabel emblemCardsDescriptionLabel;
|
||||
|
|
@ -511,6 +619,8 @@ public class CustomOptionsDialog extends MageDialog {
|
|||
private javax.swing.JLabel lblMulliganType;
|
||||
private javax.swing.JLabel lblVariantOptions;
|
||||
private javax.swing.JLabel planechaseDescriptionLabel;
|
||||
private javax.swing.JSpinner spnCustomLifeTotal;
|
||||
private javax.swing.JSpinner spnCustomStartingHand;
|
||||
private javax.swing.JSpinner spnFreeMulligans;
|
||||
private javax.swing.JTextField txtEmblemCardsPerPlayer;
|
||||
private javax.swing.JTextField txtEmblemCardsStartingPlayer;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -288,7 +288,7 @@ public class TestCardRenderDialog extends MageDialog {
|
|||
cardsPanel.addCardEventListener(this.cardListener);
|
||||
}
|
||||
|
||||
game = new TestGame(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20);
|
||||
game = new TestGame(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, MulliganType.GAME_DEFAULT.getMulligan(0), 20, 7);
|
||||
Deck deck = new Deck();
|
||||
Player playerYou = new StubPlayer("player1", RangeOfInfluence.ALL);
|
||||
game.addPlayer(playerYou, deck);
|
||||
|
|
@ -750,8 +750,8 @@ class TestGame extends GameImpl {
|
|||
|
||||
private int numPlayers;
|
||||
|
||||
public TestGame(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
||||
super(attackOption, range, mulligan, startLife, 60, 7);
|
||||
public TestGame(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife, int startHandSize) {
|
||||
super(attackOption, range, mulligan, 60, startLife, startHandSize);
|
||||
}
|
||||
|
||||
public TestGame(final TestGame game) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue