diff --git a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java
index 4c72ed3535..a92c7a937f 100644
--- a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java
+++ b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java
@@ -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.setShowAbilityPickerForced(showAbilityPickerForced);
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());
task = new ConnectTask();
task.execute();
diff --git a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.form b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.form
index 024fe54224..3a64ad1f59 100644
--- a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.form
+++ b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.form
@@ -31,7 +31,7 @@
-
+
@@ -85,7 +85,7 @@
-
+
@@ -203,16 +203,17 @@
-
+
-
+
+
@@ -232,6 +233,8 @@
+
+
@@ -293,6 +296,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -1128,7 +1142,7 @@
-
+
diff --git a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java
index 5221a55051..c1775a462a 100644
--- a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java
+++ b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java
@@ -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_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS = "gameAllowRequestShowHandCards";
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";
@@ -335,6 +336,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
showAbilityPickerForced = new javax.swing.JCheckBox();
cbAllowRequestToShowHandCards = new javax.swing.JCheckBox();
cbShowStormCounter = new javax.swing.JCheckBox();
+ cbConfirmEmptyManaPool = new javax.swing.JCheckBox();
main_gamelog = new javax.swing.JPanel();
cbGameLogAutoSave = new javax.swing.JCheckBox();
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("If activated you get a confirm message if you pass priority while stack is empty
\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);
main_game.setLayout(main_gameLayout);
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.createSequentialGroup()
.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.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.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(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(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))))
);
main_gameLayout.setVerticalGroup(
@@ -579,7 +592,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbAllowRequestToShowHandCards)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(cbShowStormCounter))
+ .addComponent(cbShowStormCounter)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(cbConfirmEmptyManaPool))
);
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)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.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");
@@ -1383,7 +1398,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
tabAvatars.setLayout(tabAvatarsLayout);
tabAvatarsLayout.setHorizontalGroup(
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.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -1602,7 +1617,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(exitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
- .addComponent(tabsPanel)
+ .addComponent(tabsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 595, Short.MAX_VALUE)
);
layout.setVerticalGroup(
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.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.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);
// Phases
@@ -1696,6 +1712,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
getSelectedAvatar(),
dialog.showAbilityPickerForced.isSelected(),
dialog.cbAllowRequestToShowHandCards.isSelected(),
+ dialog.cbConfirmEmptyManaPool.isSelected(),
getUserSkipPrioritySteps());
prefs.flush();
@@ -1947,6 +1964,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
// TODO add your handling code here:
}//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() {
if (cbProxyType.getSelectedItem() == Connection.ProxyType.SOCKS) {
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.cbAllowRequestToShowHandCards, KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, "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");
@@ -2367,6 +2389,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
id,
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_CONFIRM_EMPTY_MANA_POOL, "true").equals("true"),
getUserSkipPrioritySteps());
}
}
@@ -2381,6 +2404,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
private javax.swing.JButton btnBrowseImageLocation;
private javax.swing.JCheckBox cbAllowRequestToShowHandCards;
private javax.swing.JCheckBox cbCheckForNewImages;
+ private javax.swing.JCheckBox cbConfirmEmptyManaPool;
private javax.swing.JCheckBox cbEnableBattlefieldBGM;
private javax.swing.JCheckBox cbEnableDraftSounds;
private javax.swing.JCheckBox cbEnableGameSounds;
diff --git a/Mage.Client/src/main/java/mage/client/game/HelperPanel.java b/Mage.Client/src/main/java/mage/client/game/HelperPanel.java
index b2e2a1f286..5f325d1f98 100644
--- a/Mage.Client/src/main/java/mage/client/game/HelperPanel.java
+++ b/Mage.Client/src/main/java/mage/client/game/HelperPanel.java
@@ -221,12 +221,18 @@ public class HelperPanel extends JPanel {
public void setMessage(String message) {
if (message.startsWith("Use alternative cost")) {
- textArea.setText("Use alternative cost?");
- } else if (message.length() > 40 && message.contains("Use ")) {
- textArea.setText("Use ability?");
- } else {
- textArea.setText(message);
- }
+ message = "Use alternative cost?";
+ } else if (message.contains("Use ")) {
+ if (message.length() < this.getWidth() / 10) {
+ message = getSmallText(message);
+ } else {
+ message = "Use ability?" + getSmallText(message.substring(this.getWidth() / 10));
+ }
+ }
+ textArea.setText(message);
+ }
+ protected String getSmallText(String text) {
+ return "" + text + "
";
}
@Override
diff --git a/Mage.Client/src/main/java/mage/client/game/PlayAreaPanel.java b/Mage.Client/src/main/java/mage/client/game/PlayAreaPanel.java
index 8c4de96db8..4ffc7cd5f8 100644
--- a/Mage.Client/src/main/java/mage/client/game/PlayAreaPanel.java
+++ b/Mage.Client/src/main/java/mage/client/game/PlayAreaPanel.java
@@ -377,12 +377,14 @@ public class PlayAreaPanel extends javax.swing.JPanel {
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) {
MageFrame.getSession().sendPlayerAction(PlayerAction.CONCEDE, gameId, null);
- }
+ }
+ break;
}
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) {
MageFrame.getSession().quitMatch(gameId);
- }
+ }
+ break;
}
}
}
diff --git a/Mage.Common/src/mage/remote/Connection.java b/Mage.Common/src/mage/remote/Connection.java
index b93e28ebd3..1ce44b0ef7 100644
--- a/Mage.Common/src/mage/remote/Connection.java
+++ b/Mage.Common/src/mage/remote/Connection.java
@@ -57,6 +57,7 @@ public class Connection {
private int avatarId;
private boolean showAbilityPickerForced;
private boolean allowRequestShowHandCards;
+ private boolean confirmEmptyManaPool;
private UserSkipPrioritySteps userSkipPrioritySteps;
private static final String serialization = "?serializationtype=jboss";
@@ -242,6 +243,16 @@ public class Connection {
public void setAllowRequestShowHandCards(boolean allowRequestShowHandCards) {
this.allowRequestShowHandCards = allowRequestShowHandCards;
}
+
+ public boolean confirmEmptyManaPool() {
+ return confirmEmptyManaPool;
+ }
+
+ public void setConfirmEmptyManaPool(boolean confirmEmptyManaPool) {
+ this.confirmEmptyManaPool = confirmEmptyManaPool;
+ }
+
+
public UserSkipPrioritySteps getUserSkipPrioritySteps() {
return userSkipPrioritySteps;
}
diff --git a/Mage.Common/src/mage/remote/SessionImpl.java b/Mage.Common/src/mage/remote/SessionImpl.java
index 3ae7e62208..702857db49 100644
--- a/Mage.Common/src/mage/remote/SessionImpl.java
+++ b/Mage.Common/src/mage/remote/SessionImpl.java
@@ -278,6 +278,7 @@ public class SessionImpl implements Session {
UserDataView userDataView = new UserDataView(connection.getAvatarId(),
connection.isShowAbilityPickerForced(),
connection.allowRequestShowHandCards(),
+ connection.confirmEmptyManaPool(),
connection.getUserSkipPrioritySteps());
// for backward compatibility. don't remove twice call - first one does nothing but for version checking
registerResult = server.registerClient(connection.getUsername(), sessionId, client.getVersion());
@@ -1395,10 +1396,10 @@ public class SessionImpl implements Session {
}
@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 {
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);
}
return true;
diff --git a/Mage.Common/src/mage/remote/interfaces/ClientData.java b/Mage.Common/src/mage/remote/interfaces/ClientData.java
index e2cc74ff1f..64242130e9 100644
--- a/Mage.Common/src/mage/remote/interfaces/ClientData.java
+++ b/Mage.Common/src/mage/remote/interfaces/ClientData.java
@@ -36,5 +36,5 @@ public interface ClientData {
String getUserName();
- boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, UserSkipPrioritySteps userSkipPrioritySteps);
+ boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps);
}
diff --git a/Mage.Common/src/mage/view/PlayerView.java b/Mage.Common/src/mage/view/PlayerView.java
index fb9e36ad62..5ed57121f8 100644
--- a/Mage.Common/src/mage/view/PlayerView.java
+++ b/Mage.Common/src/mage/view/PlayerView.java
@@ -115,7 +115,7 @@ public class PlayerView implements Serializable {
if (player.getUserData() != null) {
this.userDataView = new UserDataView(player.getUserData());
} else {
- this.userDataView = new UserDataView(0, false, false, null);
+ this.userDataView = new UserDataView(0, false, false, true, null);
}
for (CommandObject commandObject : game.getState().getCommand()) {
diff --git a/Mage.Common/src/mage/view/UserDataView.java b/Mage.Common/src/mage/view/UserDataView.java
index 48aed4d25c..d1e17f3884 100644
--- a/Mage.Common/src/mage/view/UserDataView.java
+++ b/Mage.Common/src/mage/view/UserDataView.java
@@ -15,13 +15,16 @@ public class UserDataView implements Serializable {
protected int userGroup;
protected boolean showAbilityPickerForced;
protected boolean allowRequestShowHandCards;
+ protected boolean confirmEmptyManaPool;
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.showAbilityPickerForced = showAbilityPickerForced;
this.allowRequestShowHandCards = allowRequestShowHandCards;
this.userSkipPrioritySteps = userSkipPrioritySteps;
+ this.confirmEmptyManaPool = confirmEmptyManaPool;
}
public UserDataView(UserData userData) {
@@ -30,6 +33,7 @@ public class UserDataView implements Serializable {
this.allowRequestShowHandCards = userData.isAllowRequestShowHandCards();
this.showAbilityPickerForced = userData.isShowAbilityPickerForced();
this.userSkipPrioritySteps = userData.getUserSkipPrioritySteps();
+ this.confirmEmptyManaPool = userData.confirmEmptyManaPool();
}
public int getAvatarId() {
@@ -47,5 +51,9 @@ public class UserDataView implements Serializable {
public UserSkipPrioritySteps getUserSkipPrioritySteps() {
return userSkipPrioritySteps;
}
+
+ public boolean confirmEmptyManaPool() {
+ return confirmEmptyManaPool;
+ }
}
diff --git a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java
index 170b26a3ce..8b8d0febd6 100644
--- a/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java
+++ b/Mage.Server.Plugins/Mage.Player.AI/src/main/java/mage/player/ai/ComputerPlayer.java
@@ -175,7 +175,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
public ComputerPlayer(String name, RangeOfInfluence range) {
super(name, range);
human = false;
- userData = new UserData(UserGroup.COMPUTER, 64, false, true, null);
+ userData = new UserData(UserGroup.COMPUTER, 64, false, true, false, null);
pickedCards = new ArrayList<>();
}
diff --git a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java
index 537b568f6c..26308d7616 100644
--- a/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java
+++ b/Mage.Server.Plugins/Mage.Player.Human/src/mage/player/human/HumanPlayer.java
@@ -68,6 +68,7 @@ import org.apache.log4j.Logger;
import java.io.Serializable;
import java.util.*;
+import mage.util.GameLog;
/**
*
@@ -494,31 +495,35 @@ public class HumanPlayer extends PlayerImpl {
passed = false;
if (!abort) {
if (passedAllTurns) {
- pass(game);
- return false;
+ if(passWithManaPoolCheck(game)) {
+ return false;
+ }
}
if (game.getStack().isEmpty()) {
passedUntilStackResolved = false;
boolean dontCheckPassStep = false;
if (passedTurn) {
- pass(game);
- return false;
+ if(passWithManaPoolCheck(game)) {
+ return false;
+ }
}
if (passedUntilNextMain) {
if (game.getTurn().getStepType().equals(PhaseStep.POSTCOMBAT_MAIN) || game.getTurn().getStepType().equals(PhaseStep.PRECOMBAT_MAIN)) {
// it's a main phase
if (!skippedAtLeastOnce || (!playerId.equals(game.getActivePlayerId()) && !this.getUserData().getUserSkipPrioritySteps().isStopOnAllMainPhases())) {
skippedAtLeastOnce = true;
- pass(game);
- return false;
+ if(passWithManaPoolCheck(game)) {
+ return false;
+ }
} else {
dontCheckPassStep = true;
passedUntilNextMain = false; // reset skip action
}
} else {
skippedAtLeastOnce = true;
- pass(game);
- return false;
+ if(passWithManaPoolCheck(game)) {
+ return false;
+ }
}
}
if (passedUntilEndOfTurn) {
@@ -526,48 +531,53 @@ public class HumanPlayer extends PlayerImpl {
// It's end of turn phase
if (!skippedAtLeastOnce || (playerId.equals(game.getActivePlayerId()) && !this.getUserData().getUserSkipPrioritySteps().isStopOnAllEndPhases())) {
skippedAtLeastOnce = true;
- pass(game);
- return false;
+ if(passWithManaPoolCheck(game)) {
+ return false;
+ }
} else {
dontCheckPassStep = true;
passedUntilEndOfTurn = false;
}
} else {
skippedAtLeastOnce = true;
- pass(game);
- return false;
+ if(passWithManaPoolCheck(game)) {
+ return false;
+ }
}
}
if (!dontCheckPassStep && checkPassStep(game)) {
- pass(game);
- return false;
+ if(passWithManaPoolCheck(game)) {
+ return false;
+ }
}
} else if (passedUntilStackResolved) {
if (dateLastAddedToStack == game.getStack().getDateLastAdded()) {
dateLastAddedToStack = game.getStack().getDateLastAdded();
- pass(game);
- return false;
+ if(passWithManaPoolCheck(game)) {
+ return false;
+ }
} else {
passedUntilStackResolved = false;
}
}
- updateGameStatePriority("priority", game);
- game.firePriorityEvent(playerId);
- waitForResponse(game);
- if(game.executingRollback()) {
- return true;
+ while (isInGame()) {
+ updateGameStatePriority("priority", game);
+ game.firePriorityEvent(playerId);
+ waitForResponse(game);
+ 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);
- 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")) {
+
+ if (response.getString() != null && response.getString().equals("special")) {
specialAction(game);
} else if (response.getUUID() != null) {
boolean result = false;
@@ -1216,4 +1226,27 @@ public class HumanPlayer extends PlayerImpl {
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;
+ }
}
diff --git a/Mage.Server/src/main/java/mage/server/Session.java b/Mage.Server/src/main/java/mage/server/Session.java
index 2a4cee3dae..73701d39fa 100644
--- a/Mage.Server/src/main/java/mage/server/Session.java
+++ b/Mage.Server/src/main/java/mage/server/Session.java
@@ -142,7 +142,7 @@ public class Session {
if (user == null) {
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())) {
logger.info("Error connecting Admin!");
}
@@ -154,7 +154,9 @@ public class Session {
if (user != null) {
UserData userData = user.getUserData();
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);
} else {
if (userDataView.getAvatarId() == 51) { // Update special avatar if first avatar is selected
@@ -164,6 +166,7 @@ public class Session {
userData.setShowAbilityPickerForced(userDataView.isShowAbilityPickerForced());
userData.setAllowRequestShowHandCards(userDataView.allowRequestShowHandCards());
userData.setUserSkipPrioritySteps(userDataView.getUserSkipPrioritySteps());
+ userData.setConfirmEmptyManaPool(userDataView.confirmEmptyManaPool());
}
return true;
}
diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java
index 1d3bd46276..e0864e3627 100644
--- a/Mage/src/mage/players/PlayerImpl.java
+++ b/Mage/src/mage/players/PlayerImpl.java
@@ -573,6 +573,10 @@ public abstract class PlayerImpl implements Player, Serializable {
playersUnderYourControl.clear();
}
+ /**
+ * returns true if the player has the control itself - false if the player is controlled by another player
+ * @return
+ */
@Override
public boolean isGameUnderControl() {
return isGameUnderControl;
@@ -3132,5 +3136,4 @@ public abstract class PlayerImpl implements Player, Serializable {
public void abortReset() {
abort = false;
}
-
}
diff --git a/Mage/src/mage/players/net/UserData.java b/Mage/src/mage/players/net/UserData.java
index fe2a2ce164..71090e3e18 100644
--- a/Mage/src/mage/players/net/UserData.java
+++ b/Mage/src/mage/players/net/UserData.java
@@ -13,14 +13,17 @@ public class UserData implements Serializable {
protected int avatarId;
protected boolean showAbilityPickerForced;
protected boolean allowRequestShowHandCards;
+ protected boolean confirmEmptyManaPool;
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.avatarId = avatarId;
this.showAbilityPickerForced = showAbilityPickerForced;
this.allowRequestShowHandCards = allowRequestShowHandCards;
this.userSkipPrioritySteps = userSkipPrioritySteps;
+ this.confirmEmptyManaPool = confirmEmptyManaPool;
}
public void setGroupId(int groupId) {
@@ -66,5 +69,13 @@ public class UserData implements Serializable {
public void setUserSkipPrioritySteps(UserSkipPrioritySteps userSkipPrioritySteps) {
this.userSkipPrioritySteps = userSkipPrioritySteps;
}
+
+ public boolean confirmEmptyManaPool() {
+ return confirmEmptyManaPool;
+ }
+
+ public void setConfirmEmptyManaPool(boolean confirmEmptyManaPool) {
+ this.confirmEmptyManaPool = confirmEmptyManaPool;
+ }
}
diff --git a/Mage/src/mage/util/GameLog.java b/Mage/src/mage/util/GameLog.java
index c71081c96d..b302a09d3d 100644
--- a/Mage/src/mage/util/GameLog.java
+++ b/Mage/src/mage/util/GameLog.java
@@ -39,6 +39,7 @@ public class GameLog {
static final String LOG_COLOR_PLAYER = "#20B2AA"; // LightSeaGreen
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_RED = "#FF6347"; // Tomato
static final String LOG_COLOR_BLUE = "#87CEFA"; // LightSkyBlue
@@ -70,6 +71,14 @@ public class GameLog {
return "" + name + "";
}
+ public static String getPlayerConfirmColoredText(String name) {
+ return "" + name + "";
+ }
+
+ public static String getSmallSecondLineText(String text) {
+ return "" + text + "
";
+ }
+
private static String getColorName(ObjectColor objectColor) {
if (objectColor.isMulticolored()) {
return LOG_COLOR_MULTI;