Added an option that player has to confirm if he passes priority with empty stack and has mana in his pool. Implements #707.

This commit is contained in:
LevelX2 2015-06-07 22:37:12 +02:00
parent 907ec7abb0
commit 9da44a547d
16 changed files with 187 additions and 61 deletions

View file

@ -335,6 +335,7 @@ public class ConnectDialog extends MageDialog {
connection.setAllowRequestShowHandCards(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true").equals("true")); connection.setAllowRequestShowHandCards(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true").equals("true"));
connection.setShowAbilityPickerForced(showAbilityPickerForced); connection.setShowAbilityPickerForced(showAbilityPickerForced);
connection.setUserSkipPrioritySteps(PreferencesDialog.getUserSkipPrioritySteps()); connection.setUserSkipPrioritySteps(PreferencesDialog.getUserSkipPrioritySteps());
connection.setConfirmEmptyManaPool(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_CONFIRM_EMPTY_MANA_POOL, "true").equals("true"));
logger.debug("connecting: " + connection.getProxyType() + " " + connection.getProxyHost() + " " + connection.getProxyPort()); logger.debug("connecting: " + connection.getProxyType() + " " + connection.getProxyHost() + " " + connection.getProxyPort());
task = new ConnectTask(); task = new ConnectTask();
task.execute(); task.execute();

View file

@ -31,7 +31,7 @@
<Component id="exitButton" min="-2" pref="55" max="-2" attributes="0"/> <Component id="exitButton" min="-2" pref="55" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
<Component id="tabsPanel" alignment="0" max="32767" attributes="0"/> <Component id="tabsPanel" alignment="0" pref="595" max="32767" attributes="0"/>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
@ -85,7 +85,7 @@
<Component id="main_game" min="-2" max="-2" attributes="0"/> <Component id="main_game" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="main_gamelog" min="-2" max="-2" attributes="0"/> <Component id="main_gamelog" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="63" max="32767" attributes="0"/> <EmptySpace pref="40" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -203,16 +203,17 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Component id="cbAllowRequestToShowHandCards" min="-2" pref="546" max="-2" attributes="0"/> <Component id="cbAllowRequestToShowHandCards" min="-2" pref="546" max="-2" attributes="0"/>
<EmptySpace pref="14" max="32767" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
</Group> </Group>
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0"> <Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="showPlayerNamesPermanently" alignment="0" max="32767" attributes="0"/> <Component id="showPlayerNamesPermanently" alignment="0" max="32767" attributes="0"/>
<Component id="nonLandPermanentsInOnePile" alignment="0" max="32767" attributes="0"/> <Component id="nonLandPermanentsInOnePile" alignment="0" max="32767" attributes="0"/>
<Component id="showAbilityPickerForced" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="showAbilityPickerForced" alignment="0" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<Component id="cbShowStormCounter" alignment="0" min="-2" pref="546" max="-2" attributes="0"/> <Component id="cbShowStormCounter" alignment="0" min="-2" pref="546" max="-2" attributes="0"/>
<Component id="cbConfirmEmptyManaPool" alignment="0" min="-2" pref="546" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/> <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group> </Group>
@ -232,6 +233,8 @@
<Component id="cbAllowRequestToShowHandCards" min="-2" max="-2" attributes="0"/> <Component id="cbAllowRequestToShowHandCards" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="cbShowStormCounter" min="-2" max="-2" attributes="0"/> <Component id="cbShowStormCounter" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cbConfirmEmptyManaPool" min="-2" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -293,6 +296,17 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbShowStormCounterActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbShowStormCounterActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JCheckBox" name="cbConfirmEmptyManaPool">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Confirm if you want to pass a phase/step but there is still mana in your mana pool"/>
<Property name="toolTipText" type="java.lang.String" value="&lt;html&gt;If activated you get a confirm message if you pass priority while stack is empty&lt;br&gt;&#xa; and you still have mana in your mana pool."/>
<Property name="horizontalAlignment" type="int" value="2"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbConfirmEmptyManaPoolActionPerformed"/>
</Events>
</Component>
</SubComponents> </SubComponents>
</Container> </Container>
<Container class="javax.swing.JPanel" name="main_gamelog"> <Container class="javax.swing.JPanel" name="main_gamelog">
@ -1128,7 +1142,7 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="598" max="32767" attributes="0"/> <Component id="jScrollPane1" alignment="0" pref="590" max="32767" attributes="0"/>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">

View file

@ -85,6 +85,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String KEY_SHOW_ABILITY_PICKER_FORCED = "showAbilityPicker"; public static final String KEY_SHOW_ABILITY_PICKER_FORCED = "showAbilityPicker";
public static final String KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS = "gameAllowRequestShowHandCards"; public static final String KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS = "gameAllowRequestShowHandCards";
public static final String KEY_GAME_SHOW_STORM_COUNTER = "gameShowStormCounter"; public static final String KEY_GAME_SHOW_STORM_COUNTER = "gameShowStormCounter";
public static final String KEY_GAME_CONFIRM_EMPTY_MANA_POOL = "gameConfirmEmptyManaPool";
public static final String KEY_GAME_LOG_AUTO_SAVE = "gameLogAutoSave"; public static final String KEY_GAME_LOG_AUTO_SAVE = "gameLogAutoSave";
@ -335,6 +336,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
showAbilityPickerForced = new javax.swing.JCheckBox(); showAbilityPickerForced = new javax.swing.JCheckBox();
cbAllowRequestToShowHandCards = new javax.swing.JCheckBox(); cbAllowRequestToShowHandCards = new javax.swing.JCheckBox();
cbShowStormCounter = new javax.swing.JCheckBox(); cbShowStormCounter = new javax.swing.JCheckBox();
cbConfirmEmptyManaPool = new javax.swing.JCheckBox();
main_gamelog = new javax.swing.JPanel(); main_gamelog = new javax.swing.JPanel();
cbGameLogAutoSave = new javax.swing.JCheckBox(); cbGameLogAutoSave = new javax.swing.JCheckBox();
tabPhases = new javax.swing.JPanel(); tabPhases = new javax.swing.JPanel();
@ -549,6 +551,16 @@ public class PreferencesDialog extends javax.swing.JDialog {
} }
}); });
cbConfirmEmptyManaPool.setSelected(true);
cbConfirmEmptyManaPool.setText("Confirm if you want to pass a phase/step but there is still mana in your mana pool");
cbConfirmEmptyManaPool.setToolTipText("<html>If activated you get a confirm message if you pass priority while stack is empty<br>\n and you still have mana in your mana pool.");
cbConfirmEmptyManaPool.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
cbConfirmEmptyManaPool.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbConfirmEmptyManaPoolActionPerformed(evt);
}
});
javax.swing.GroupLayout main_gameLayout = new javax.swing.GroupLayout(main_game); javax.swing.GroupLayout main_gameLayout = new javax.swing.GroupLayout(main_game);
main_game.setLayout(main_gameLayout); main_game.setLayout(main_gameLayout);
main_gameLayout.setHorizontalGroup( main_gameLayout.setHorizontalGroup(
@ -558,14 +570,15 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addGroup(main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(main_gameLayout.createSequentialGroup() .addGroup(main_gameLayout.createSequentialGroup()
.addComponent(cbAllowRequestToShowHandCards, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cbAllowRequestToShowHandCards, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(14, Short.MAX_VALUE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(main_gameLayout.createSequentialGroup() .addGroup(main_gameLayout.createSequentialGroup()
.addGroup(main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(main_gameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(showPlayerNamesPermanently, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(showPlayerNamesPermanently, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(nonLandPermanentsInOnePile, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(nonLandPermanentsInOnePile, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(showAbilityPickerForced, javax.swing.GroupLayout.Alignment.LEADING)) .addComponent(showAbilityPickerForced, javax.swing.GroupLayout.Alignment.LEADING))
.addComponent(cbShowStormCounter, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(cbShowStormCounter, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cbConfirmEmptyManaPool, javax.swing.GroupLayout.PREFERRED_SIZE, 546, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE)))) .addGap(0, 0, Short.MAX_VALUE))))
); );
main_gameLayout.setVerticalGroup( main_gameLayout.setVerticalGroup(
@ -579,7 +592,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbAllowRequestToShowHandCards) .addComponent(cbAllowRequestToShowHandCards)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbShowStormCounter)) .addComponent(cbShowStormCounter)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbConfirmEmptyManaPool))
); );
nonLandPermanentsInOnePile.getAccessibleContext().setAccessibleName("nonLandPermanentsInOnePile"); nonLandPermanentsInOnePile.getAccessibleContext().setAccessibleName("nonLandPermanentsInOnePile");
@ -630,7 +645,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addComponent(main_game, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(main_game, 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(main_gamelog, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(main_gamelog, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(63, Short.MAX_VALUE)) .addContainerGap(40, Short.MAX_VALUE))
); );
main_card.getAccessibleContext().setAccessibleName("Game panel"); main_card.getAccessibleContext().setAccessibleName("Game panel");
@ -1383,7 +1398,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
tabAvatars.setLayout(tabAvatarsLayout); tabAvatars.setLayout(tabAvatarsLayout);
tabAvatarsLayout.setHorizontalGroup( tabAvatarsLayout.setHorizontalGroup(
tabAvatarsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) tabAvatarsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 598, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 590, Short.MAX_VALUE)
); );
tabAvatarsLayout.setVerticalGroup( tabAvatarsLayout.setVerticalGroup(
tabAvatarsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) tabAvatarsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -1602,7 +1617,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap()) .addContainerGap())
.addComponent(tabsPanel) .addComponent(tabsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 595, Short.MAX_VALUE)
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -1630,6 +1645,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
save(prefs, dialog.showAbilityPickerForced, KEY_SHOW_ABILITY_PICKER_FORCED, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.showAbilityPickerForced, KEY_SHOW_ABILITY_PICKER_FORCED, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbAllowRequestToShowHandCards, KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbAllowRequestToShowHandCards, KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbShowStormCounter, KEY_GAME_SHOW_STORM_COUNTER, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbShowStormCounter, KEY_GAME_SHOW_STORM_COUNTER, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbConfirmEmptyManaPool, KEY_GAME_CONFIRM_EMPTY_MANA_POOL, "true", "false", UPDATE_CACHE_POLICY);
save(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true", "false", UPDATE_CACHE_POLICY); save(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true", "false", UPDATE_CACHE_POLICY);
// Phases // Phases
@ -1696,6 +1712,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
getSelectedAvatar(), getSelectedAvatar(),
dialog.showAbilityPickerForced.isSelected(), dialog.showAbilityPickerForced.isSelected(),
dialog.cbAllowRequestToShowHandCards.isSelected(), dialog.cbAllowRequestToShowHandCards.isSelected(),
dialog.cbConfirmEmptyManaPool.isSelected(),
getUserSkipPrioritySteps()); getUserSkipPrioritySteps());
prefs.flush(); prefs.flush();
@ -1947,6 +1964,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
// TODO add your handling code here: // TODO add your handling code here:
}//GEN-LAST:event_cbShowStormCounterActionPerformed }//GEN-LAST:event_cbShowStormCounterActionPerformed
private void cbConfirmEmptyManaPoolActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbConfirmEmptyManaPoolActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cbConfirmEmptyManaPoolActionPerformed
private void showProxySettings() { private void showProxySettings() {
if (cbProxyType.getSelectedItem() == Connection.ProxyType.SOCKS) { if (cbProxyType.getSelectedItem() == Connection.ProxyType.SOCKS) {
this.pnlProxy.setVisible(true); this.pnlProxy.setVisible(true);
@ -2023,6 +2044,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
load(prefs, dialog.showAbilityPickerForced, KEY_SHOW_ABILITY_PICKER_FORCED, "true"); load(prefs, dialog.showAbilityPickerForced, KEY_SHOW_ABILITY_PICKER_FORCED, "true");
load(prefs, dialog.cbAllowRequestToShowHandCards, KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true"); load(prefs, dialog.cbAllowRequestToShowHandCards, KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true");
load(prefs, dialog.cbShowStormCounter, KEY_GAME_SHOW_STORM_COUNTER, "true"); load(prefs, dialog.cbShowStormCounter, KEY_GAME_SHOW_STORM_COUNTER, "true");
load(prefs, dialog.cbConfirmEmptyManaPool, KEY_GAME_CONFIRM_EMPTY_MANA_POOL, "true");
load(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true"); load(prefs, dialog.cbGameLogAutoSave, KEY_GAME_LOG_AUTO_SAVE, "true");
@ -2367,6 +2389,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
id, id,
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_TOOLTIPS_ANY_ZONE, "true").equals("true"), PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_TOOLTIPS_ANY_ZONE, "true").equals("true"),
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true").equals("true"), PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "true").equals("true"),
PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GAME_CONFIRM_EMPTY_MANA_POOL, "true").equals("true"),
getUserSkipPrioritySteps()); getUserSkipPrioritySteps());
} }
} }
@ -2381,6 +2404,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JButton btnBrowseImageLocation; private javax.swing.JButton btnBrowseImageLocation;
private javax.swing.JCheckBox cbAllowRequestToShowHandCards; private javax.swing.JCheckBox cbAllowRequestToShowHandCards;
private javax.swing.JCheckBox cbCheckForNewImages; private javax.swing.JCheckBox cbCheckForNewImages;
private javax.swing.JCheckBox cbConfirmEmptyManaPool;
private javax.swing.JCheckBox cbEnableBattlefieldBGM; private javax.swing.JCheckBox cbEnableBattlefieldBGM;
private javax.swing.JCheckBox cbEnableDraftSounds; private javax.swing.JCheckBox cbEnableDraftSounds;
private javax.swing.JCheckBox cbEnableGameSounds; private javax.swing.JCheckBox cbEnableGameSounds;

View file

@ -221,12 +221,18 @@ public class HelperPanel extends JPanel {
public void setMessage(String message) { public void setMessage(String message) {
if (message.startsWith("Use alternative cost")) { if (message.startsWith("Use alternative cost")) {
textArea.setText("Use alternative cost?"); message = "Use alternative cost?";
} else if (message.length() > 40 && message.contains("Use ")) { } else if (message.contains("Use ")) {
textArea.setText("Use ability?"); if (message.length() < this.getWidth() / 10) {
} else { message = getSmallText(message);
textArea.setText(message); } else {
} message = "Use ability?" + getSmallText(message.substring(this.getWidth() / 10));
}
}
textArea.setText(message);
}
protected String getSmallText(String text) {
return "<div style='font-size:11pt'>" + text + "</div>";
} }
@Override @Override

View file

@ -377,12 +377,14 @@ public class PlayAreaPanel extends javax.swing.JPanel {
case "Game": { case "Game": {
if (JOptionPane.showConfirmDialog(PlayAreaPanel.this, "Are you sure you want to concede the game?", "Confirm concede game", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { if (JOptionPane.showConfirmDialog(PlayAreaPanel.this, "Are you sure you want to concede the game?", "Confirm concede game", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
MageFrame.getSession().sendPlayerAction(PlayerAction.CONCEDE, gameId, null); MageFrame.getSession().sendPlayerAction(PlayerAction.CONCEDE, gameId, null);
} }
break;
} }
case "Match": { case "Match": {
if (JOptionPane.showConfirmDialog(PlayAreaPanel.this, "Are you sure you want to concede the complete match?", "Confirm concede match", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { if (JOptionPane.showConfirmDialog(PlayAreaPanel.this, "Are you sure you want to concede the complete match?", "Confirm concede match", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
MageFrame.getSession().quitMatch(gameId); MageFrame.getSession().quitMatch(gameId);
} }
break;
} }
} }
} }

View file

@ -57,6 +57,7 @@ public class Connection {
private int avatarId; private int avatarId;
private boolean showAbilityPickerForced; private boolean showAbilityPickerForced;
private boolean allowRequestShowHandCards; private boolean allowRequestShowHandCards;
private boolean confirmEmptyManaPool;
private UserSkipPrioritySteps userSkipPrioritySteps; private UserSkipPrioritySteps userSkipPrioritySteps;
private static final String serialization = "?serializationtype=jboss"; private static final String serialization = "?serializationtype=jboss";
@ -242,6 +243,16 @@ public class Connection {
public void setAllowRequestShowHandCards(boolean allowRequestShowHandCards) { public void setAllowRequestShowHandCards(boolean allowRequestShowHandCards) {
this.allowRequestShowHandCards = allowRequestShowHandCards; this.allowRequestShowHandCards = allowRequestShowHandCards;
} }
public boolean confirmEmptyManaPool() {
return confirmEmptyManaPool;
}
public void setConfirmEmptyManaPool(boolean confirmEmptyManaPool) {
this.confirmEmptyManaPool = confirmEmptyManaPool;
}
public UserSkipPrioritySteps getUserSkipPrioritySteps() { public UserSkipPrioritySteps getUserSkipPrioritySteps() {
return userSkipPrioritySteps; return userSkipPrioritySteps;
} }

View file

@ -278,6 +278,7 @@ public class SessionImpl implements Session {
UserDataView userDataView = new UserDataView(connection.getAvatarId(), UserDataView userDataView = new UserDataView(connection.getAvatarId(),
connection.isShowAbilityPickerForced(), connection.isShowAbilityPickerForced(),
connection.allowRequestShowHandCards(), connection.allowRequestShowHandCards(),
connection.confirmEmptyManaPool(),
connection.getUserSkipPrioritySteps()); connection.getUserSkipPrioritySteps());
// for backward compatibility. don't remove twice call - first one does nothing but for version checking // for backward compatibility. don't remove twice call - first one does nothing but for version checking
registerResult = server.registerClient(connection.getUsername(), sessionId, client.getVersion()); registerResult = server.registerClient(connection.getUsername(), sessionId, client.getVersion());
@ -1395,10 +1396,10 @@ public class SessionImpl implements Session {
} }
@Override @Override
public boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, UserSkipPrioritySteps userSkipPrioritySteps) { public boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps) {
try { try {
if (isConnected()) { if (isConnected()) {
UserDataView userDataView = new UserDataView(avatarId, showAbilityPickerForced, allowRequestShowHandCards, userSkipPrioritySteps); UserDataView userDataView = new UserDataView(avatarId, showAbilityPickerForced, allowRequestShowHandCards, confirmEmptyManaPool, userSkipPrioritySteps);
server.setUserData(connection.getUsername(), sessionId, userDataView); server.setUserData(connection.getUsername(), sessionId, userDataView);
} }
return true; return true;

View file

@ -36,5 +36,5 @@ public interface ClientData {
String getUserName(); String getUserName();
boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, UserSkipPrioritySteps userSkipPrioritySteps); boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps);
} }

View file

@ -115,7 +115,7 @@ public class PlayerView implements Serializable {
if (player.getUserData() != null) { if (player.getUserData() != null) {
this.userDataView = new UserDataView(player.getUserData()); this.userDataView = new UserDataView(player.getUserData());
} else { } else {
this.userDataView = new UserDataView(0, false, false, null); this.userDataView = new UserDataView(0, false, false, true, null);
} }
for (CommandObject commandObject : game.getState().getCommand()) { for (CommandObject commandObject : game.getState().getCommand()) {

View file

@ -15,13 +15,16 @@ public class UserDataView implements Serializable {
protected int userGroup; protected int userGroup;
protected boolean showAbilityPickerForced; protected boolean showAbilityPickerForced;
protected boolean allowRequestShowHandCards; protected boolean allowRequestShowHandCards;
protected boolean confirmEmptyManaPool;
protected UserSkipPrioritySteps userSkipPrioritySteps; protected UserSkipPrioritySteps userSkipPrioritySteps;
public UserDataView(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, UserSkipPrioritySteps userSkipPrioritySteps) { public UserDataView(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards,
boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps) {
this.avatarId = avatarId; this.avatarId = avatarId;
this.showAbilityPickerForced = showAbilityPickerForced; this.showAbilityPickerForced = showAbilityPickerForced;
this.allowRequestShowHandCards = allowRequestShowHandCards; this.allowRequestShowHandCards = allowRequestShowHandCards;
this.userSkipPrioritySteps = userSkipPrioritySteps; this.userSkipPrioritySteps = userSkipPrioritySteps;
this.confirmEmptyManaPool = confirmEmptyManaPool;
} }
public UserDataView(UserData userData) { public UserDataView(UserData userData) {
@ -30,6 +33,7 @@ public class UserDataView implements Serializable {
this.allowRequestShowHandCards = userData.isAllowRequestShowHandCards(); this.allowRequestShowHandCards = userData.isAllowRequestShowHandCards();
this.showAbilityPickerForced = userData.isShowAbilityPickerForced(); this.showAbilityPickerForced = userData.isShowAbilityPickerForced();
this.userSkipPrioritySteps = userData.getUserSkipPrioritySteps(); this.userSkipPrioritySteps = userData.getUserSkipPrioritySteps();
this.confirmEmptyManaPool = userData.confirmEmptyManaPool();
} }
public int getAvatarId() { public int getAvatarId() {
@ -47,5 +51,9 @@ public class UserDataView implements Serializable {
public UserSkipPrioritySteps getUserSkipPrioritySteps() { public UserSkipPrioritySteps getUserSkipPrioritySteps() {
return userSkipPrioritySteps; return userSkipPrioritySteps;
} }
public boolean confirmEmptyManaPool() {
return confirmEmptyManaPool;
}
} }

View file

@ -175,7 +175,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
public ComputerPlayer(String name, RangeOfInfluence range) { public ComputerPlayer(String name, RangeOfInfluence range) {
super(name, range); super(name, range);
human = false; human = false;
userData = new UserData(UserGroup.COMPUTER, 64, false, true, null); userData = new UserData(UserGroup.COMPUTER, 64, false, true, false, null);
pickedCards = new ArrayList<>(); pickedCards = new ArrayList<>();
} }

View file

@ -68,6 +68,7 @@ import org.apache.log4j.Logger;
import java.io.Serializable; import java.io.Serializable;
import java.util.*; import java.util.*;
import mage.util.GameLog;
/** /**
* *
@ -494,31 +495,35 @@ public class HumanPlayer extends PlayerImpl {
passed = false; passed = false;
if (!abort) { if (!abort) {
if (passedAllTurns) { if (passedAllTurns) {
pass(game); if(passWithManaPoolCheck(game)) {
return false; return false;
}
} }
if (game.getStack().isEmpty()) { if (game.getStack().isEmpty()) {
passedUntilStackResolved = false; passedUntilStackResolved = false;
boolean dontCheckPassStep = false; boolean dontCheckPassStep = false;
if (passedTurn) { if (passedTurn) {
pass(game); if(passWithManaPoolCheck(game)) {
return false; return false;
}
} }
if (passedUntilNextMain) { if (passedUntilNextMain) {
if (game.getTurn().getStepType().equals(PhaseStep.POSTCOMBAT_MAIN) || game.getTurn().getStepType().equals(PhaseStep.PRECOMBAT_MAIN)) { if (game.getTurn().getStepType().equals(PhaseStep.POSTCOMBAT_MAIN) || game.getTurn().getStepType().equals(PhaseStep.PRECOMBAT_MAIN)) {
// it's a main phase // it's a main phase
if (!skippedAtLeastOnce || (!playerId.equals(game.getActivePlayerId()) && !this.getUserData().getUserSkipPrioritySteps().isStopOnAllMainPhases())) { if (!skippedAtLeastOnce || (!playerId.equals(game.getActivePlayerId()) && !this.getUserData().getUserSkipPrioritySteps().isStopOnAllMainPhases())) {
skippedAtLeastOnce = true; skippedAtLeastOnce = true;
pass(game); if(passWithManaPoolCheck(game)) {
return false; return false;
}
} else { } else {
dontCheckPassStep = true; dontCheckPassStep = true;
passedUntilNextMain = false; // reset skip action passedUntilNextMain = false; // reset skip action
} }
} else { } else {
skippedAtLeastOnce = true; skippedAtLeastOnce = true;
pass(game); if(passWithManaPoolCheck(game)) {
return false; return false;
}
} }
} }
if (passedUntilEndOfTurn) { if (passedUntilEndOfTurn) {
@ -526,48 +531,53 @@ public class HumanPlayer extends PlayerImpl {
// It's end of turn phase // It's end of turn phase
if (!skippedAtLeastOnce || (playerId.equals(game.getActivePlayerId()) && !this.getUserData().getUserSkipPrioritySteps().isStopOnAllEndPhases())) { if (!skippedAtLeastOnce || (playerId.equals(game.getActivePlayerId()) && !this.getUserData().getUserSkipPrioritySteps().isStopOnAllEndPhases())) {
skippedAtLeastOnce = true; skippedAtLeastOnce = true;
pass(game); if(passWithManaPoolCheck(game)) {
return false; return false;
}
} else { } else {
dontCheckPassStep = true; dontCheckPassStep = true;
passedUntilEndOfTurn = false; passedUntilEndOfTurn = false;
} }
} else { } else {
skippedAtLeastOnce = true; skippedAtLeastOnce = true;
pass(game); if(passWithManaPoolCheck(game)) {
return false; return false;
}
} }
} }
if (!dontCheckPassStep && checkPassStep(game)) { if (!dontCheckPassStep && checkPassStep(game)) {
pass(game); if(passWithManaPoolCheck(game)) {
return false; return false;
}
} }
} else if (passedUntilStackResolved) { } else if (passedUntilStackResolved) {
if (dateLastAddedToStack == game.getStack().getDateLastAdded()) { if (dateLastAddedToStack == game.getStack().getDateLastAdded()) {
dateLastAddedToStack = game.getStack().getDateLastAdded(); dateLastAddedToStack = game.getStack().getDateLastAdded();
pass(game); if(passWithManaPoolCheck(game)) {
return false; return false;
}
} else { } else {
passedUntilStackResolved = false; passedUntilStackResolved = false;
} }
} }
updateGameStatePriority("priority", game); while (isInGame()) {
game.firePriorityEvent(playerId); updateGameStatePriority("priority", game);
waitForResponse(game); game.firePriorityEvent(playerId);
if(game.executingRollback()) { waitForResponse(game);
return true; if(game.executingRollback()) {
return true;
}
if (response.getBoolean() != null || response.getInteger() != null) {
if (passWithManaPoolCheck(game)) {
return false;
} else {
continue;
}
}
break;
} }
if (response.getBoolean() != null) {
pass(game); if (response.getString() != null && response.getString().equals("special")) {
return false;
} else if (response.getInteger() != null) {
/*if (response.getInteger() == -9999) {
passedAllTurns = true;
}*/
pass(game);
//passedTurn = true;
return false;
} else if (response.getString() != null && response.getString().equals("special")) {
specialAction(game); specialAction(game);
} else if (response.getUUID() != null) { } else if (response.getUUID() != null) {
boolean result = false; boolean result = false;
@ -1216,4 +1226,27 @@ public class HumanPlayer extends PlayerImpl {
super.sendPlayerAction(playerAction, game); super.sendPlayerAction(playerAction, game);
} }
} }
protected boolean passWithManaPoolCheck(Game game) {
if (userData.confirmEmptyManaPool() &&
game.getStack().isEmpty() && getManaPool().count() > 0) {
String activePlayerText;
if (game.getActivePlayerId().equals(playerId)) {
activePlayerText = "Your turn";
} else {
activePlayerText = game.getPlayer(game.getActivePlayerId()).getName() + "'s turn";
}
String priorityPlayerText = "";
if (!isGameUnderControl()) {
priorityPlayerText = " / priority " + game.getPlayer(game.getPriorityPlayerId()).getName();
}
if (!chooseUse(Outcome.Detriment, GameLog.getPlayerConfirmColoredText("You have still mana in your mana pool. Pass regardless?")
+ GameLog.getSmallSecondLineText(activePlayerText + " / " + game.getStep().getType().toString() + priorityPlayerText), game)) {
sendPlayerAction(PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS, game);
return false;
}
}
pass(game);
return true;
}
} }

View file

@ -142,7 +142,7 @@ public class Session {
if (user == null) { if (user == null) {
user = UserManager.getInstance().findUser("Admin"); user = UserManager.getInstance().findUser("Admin");
} }
user.setUserData(new UserData(UserGroup.ADMIN, 0, false, false, null)); user.setUserData(new UserData(UserGroup.ADMIN, 0, false, false, false, null));
if (!UserManager.getInstance().connectToSession(sessionId, user.getId())) { if (!UserManager.getInstance().connectToSession(sessionId, user.getId())) {
logger.info("Error connecting Admin!"); logger.info("Error connecting Admin!");
} }
@ -154,7 +154,9 @@ public class Session {
if (user != null) { if (user != null) {
UserData userData = user.getUserData(); UserData userData = user.getUserData();
if (userData == null) { if (userData == null) {
userData = new UserData(UserGroup.PLAYER, userDataView.getAvatarId(), userDataView.isShowAbilityPickerForced(), userDataView.allowRequestShowHandCards(), userDataView.getUserSkipPrioritySteps()); userData = new UserData(UserGroup.PLAYER, userDataView.getAvatarId(),
userDataView.isShowAbilityPickerForced(), userDataView.allowRequestShowHandCards(),
userDataView.confirmEmptyManaPool(), userDataView.getUserSkipPrioritySteps());
user.setUserData(userData); user.setUserData(userData);
} else { } else {
if (userDataView.getAvatarId() == 51) { // Update special avatar if first avatar is selected if (userDataView.getAvatarId() == 51) { // Update special avatar if first avatar is selected
@ -164,6 +166,7 @@ public class Session {
userData.setShowAbilityPickerForced(userDataView.isShowAbilityPickerForced()); userData.setShowAbilityPickerForced(userDataView.isShowAbilityPickerForced());
userData.setAllowRequestShowHandCards(userDataView.allowRequestShowHandCards()); userData.setAllowRequestShowHandCards(userDataView.allowRequestShowHandCards());
userData.setUserSkipPrioritySteps(userDataView.getUserSkipPrioritySteps()); userData.setUserSkipPrioritySteps(userDataView.getUserSkipPrioritySteps());
userData.setConfirmEmptyManaPool(userDataView.confirmEmptyManaPool());
} }
return true; return true;
} }

View file

@ -573,6 +573,10 @@ public abstract class PlayerImpl implements Player, Serializable {
playersUnderYourControl.clear(); playersUnderYourControl.clear();
} }
/**
* returns true if the player has the control itself - false if the player is controlled by another player
* @return
*/
@Override @Override
public boolean isGameUnderControl() { public boolean isGameUnderControl() {
return isGameUnderControl; return isGameUnderControl;
@ -3132,5 +3136,4 @@ public abstract class PlayerImpl implements Player, Serializable {
public void abortReset() { public void abortReset() {
abort = false; abort = false;
} }
} }

View file

@ -13,14 +13,17 @@ public class UserData implements Serializable {
protected int avatarId; protected int avatarId;
protected boolean showAbilityPickerForced; protected boolean showAbilityPickerForced;
protected boolean allowRequestShowHandCards; protected boolean allowRequestShowHandCards;
protected boolean confirmEmptyManaPool;
protected UserSkipPrioritySteps userSkipPrioritySteps; protected UserSkipPrioritySteps userSkipPrioritySteps;
public UserData(UserGroup userGroup, int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, UserSkipPrioritySteps userSkipPrioritySteps) { public UserData(UserGroup userGroup, int avatarId, boolean showAbilityPickerForced,
boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps) {
this.groupId = userGroup.getGroupId(); this.groupId = userGroup.getGroupId();
this.avatarId = avatarId; this.avatarId = avatarId;
this.showAbilityPickerForced = showAbilityPickerForced; this.showAbilityPickerForced = showAbilityPickerForced;
this.allowRequestShowHandCards = allowRequestShowHandCards; this.allowRequestShowHandCards = allowRequestShowHandCards;
this.userSkipPrioritySteps = userSkipPrioritySteps; this.userSkipPrioritySteps = userSkipPrioritySteps;
this.confirmEmptyManaPool = confirmEmptyManaPool;
} }
public void setGroupId(int groupId) { public void setGroupId(int groupId) {
@ -66,5 +69,13 @@ public class UserData implements Serializable {
public void setUserSkipPrioritySteps(UserSkipPrioritySteps userSkipPrioritySteps) { public void setUserSkipPrioritySteps(UserSkipPrioritySteps userSkipPrioritySteps) {
this.userSkipPrioritySteps = userSkipPrioritySteps; this.userSkipPrioritySteps = userSkipPrioritySteps;
} }
public boolean confirmEmptyManaPool() {
return confirmEmptyManaPool;
}
public void setConfirmEmptyManaPool(boolean confirmEmptyManaPool) {
this.confirmEmptyManaPool = confirmEmptyManaPool;
}
} }

View file

@ -39,6 +39,7 @@ public class GameLog {
static final String LOG_COLOR_PLAYER = "#20B2AA"; // LightSeaGreen static final String LOG_COLOR_PLAYER = "#20B2AA"; // LightSeaGreen
static final String LOG_COLOR_PLAYER_REQUEST = "#D2691E"; // Chocolate static final String LOG_COLOR_PLAYER_REQUEST = "#D2691E"; // Chocolate
static final String LOG_COLOR_PLAYER_CONFIRM = "#D2691E"; // Chocolate
static final String LOG_COLOR_GREEN = "#90EE90"; // LightGreen static final String LOG_COLOR_GREEN = "#90EE90"; // LightGreen
static final String LOG_COLOR_RED = "#FF6347"; // Tomato static final String LOG_COLOR_RED = "#FF6347"; // Tomato
static final String LOG_COLOR_BLUE = "#87CEFA"; // LightSkyBlue static final String LOG_COLOR_BLUE = "#87CEFA"; // LightSkyBlue
@ -70,6 +71,14 @@ public class GameLog {
return "<font color=\'" + LOG_COLOR_PLAYER_REQUEST + "\'>" + name + "</font>"; return "<font color=\'" + LOG_COLOR_PLAYER_REQUEST + "\'>" + name + "</font>";
} }
public static String getPlayerConfirmColoredText(String name) {
return "<font color=\'" + LOG_COLOR_PLAYER_CONFIRM + "\'>" + name + "</font>";
}
public static String getSmallSecondLineText(String text) {
return "<div style='font-size:11pt'>" + text + "</div>";
}
private static String getColorName(ObjectColor objectColor) { private static String getColorName(ObjectColor objectColor) {
if (objectColor.isMulticolored()) { if (objectColor.isMulticolored()) {
return LOG_COLOR_MULTI; return LOG_COLOR_MULTI;