mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Finished changes for new preference option to force showing ability picker for 0 mana spells or abilities with only tap costs.
This commit is contained in:
parent
ee76ccfee4
commit
67e25d43bd
7 changed files with 28 additions and 14 deletions
|
@ -693,7 +693,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
ProxyType proxyType = Connection.ProxyType.valueByText(prefs.get("proxyType", "None"));
|
ProxyType proxyType = Connection.ProxyType.valueByText(prefs.get("proxyType", "None"));
|
||||||
String proxyUsername = prefs.get("proxyUsername", "");
|
String proxyUsername = prefs.get("proxyUsername", "");
|
||||||
String proxyPassword = prefs.get("proxyPassword", "");
|
String proxyPassword = prefs.get("proxyPassword", "");
|
||||||
|
int avatarId = PreferencesDialog.getSelectedAvatar();
|
||||||
|
boolean showAbilityPickerForced = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_ABILITY_PICKER_FORCED, "true").equals("true");
|
||||||
try {
|
try {
|
||||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||||
Connection connection = new Connection();
|
Connection connection = new Connection();
|
||||||
|
@ -705,6 +706,8 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
connection.setProxyPort(proxyPort);
|
connection.setProxyPort(proxyPort);
|
||||||
connection.setProxyUsername(proxyUsername);
|
connection.setProxyUsername(proxyUsername);
|
||||||
connection.setProxyPassword(proxyPassword);
|
connection.setProxyPassword(proxyPassword);
|
||||||
|
connection.setAvatarId(avatarId);
|
||||||
|
connection.setShowAbilityPickerForced(showAbilityPickerForced);
|
||||||
logger.debug("connecting (auto): " + proxyType + " " + proxyServer + " " + proxyPort + " " + proxyUsername);
|
logger.debug("connecting (auto): " + proxyType + " " + proxyServer + " " + proxyPort + " " + proxyUsername);
|
||||||
if (MageFrame.connect(connection)) {
|
if (MageFrame.connect(connection)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -199,7 +199,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
||||||
this.bigCard = bigCard;
|
this.bigCard = bigCard;
|
||||||
this.gameId = gameId;
|
this.gameId = gameId;
|
||||||
|
|
||||||
boolean piles = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_DRAFT_PILES_TOGGLE, "True").equals("True");
|
boolean piles = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_DRAFT_PILES_TOGGLE, "true").equals("true");
|
||||||
cbSortBy.setSelectedItem(sortSetting.getSortBy());
|
cbSortBy.setSelectedItem(sortSetting.getSortBy());
|
||||||
chkPiles.setSelected(piles);
|
chkPiles.setSelected(piles);
|
||||||
currentView.loadCards(showCards, sortSetting, piles, bigCard, gameId);
|
currentView.loadCards(showCards, sortSetting, piles, bigCard, gameId);
|
||||||
|
|
|
@ -302,10 +302,11 @@ public class ConnectDialog extends MageDialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avatar
|
// pref settings
|
||||||
int avatarId = PreferencesDialog.getSelectedAvatar();
|
int avatarId = PreferencesDialog.getSelectedAvatar();
|
||||||
connection.setAvatarId(avatarId);
|
connection.setAvatarId(avatarId);
|
||||||
|
boolean showAbilityPickerForced = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_ABILITY_PICKER_FORCED, "true").equals("true");
|
||||||
|
connection.setShowAbilityPickerForced(showAbilityPickerForced);
|
||||||
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();
|
||||||
|
|
|
@ -194,8 +194,8 @@
|
||||||
<Component class="javax.swing.JCheckBox" name="showAbilityPickerForced">
|
<Component class="javax.swing.JCheckBox" name="showAbilityPickerForced">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="selected" type="boolean" value="true"/>
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
<Property name="text" type="java.lang.String" value="Show ability picker for abilities without costs"/>
|
<Property name="text" type="java.lang.String" value="Show ability picker for abilities or spells without costs"/>
|
||||||
<Property name="toolTipText" type="java.lang.String" value="This prevents that you accidently activate abilities without costs that e.g. tap the permanent."/>
|
<Property name="toolTipText" type="java.lang.String" value="This prevents you from accidently activating abilities without other costs than tapping or casting spells with 0 mana costs."/>
|
||||||
<Property name="horizontalAlignment" type="int" value="2"/>
|
<Property name="horizontalAlignment" type="int" value="2"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
|
|
|
@ -412,8 +412,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
main_game.add(showPlayerNamesPermanently, java.awt.BorderLayout.LINE_START);
|
main_game.add(showPlayerNamesPermanently, java.awt.BorderLayout.LINE_START);
|
||||||
|
|
||||||
showAbilityPickerForced.setSelected(true);
|
showAbilityPickerForced.setSelected(true);
|
||||||
showAbilityPickerForced.setText("Show ability picker for abilities without costs");
|
showAbilityPickerForced.setText("Show ability picker for abilities or spells without costs");
|
||||||
showAbilityPickerForced.setToolTipText("This prevents that you accidently activate abilities without costs that e.g. tap the permanent.");
|
showAbilityPickerForced.setToolTipText("This prevents you from accidently activating abilities without other costs than tapping or casting spells with 0 mana costs.");
|
||||||
showAbilityPickerForced.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
showAbilityPickerForced.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||||
showAbilityPickerForced.addActionListener(new java.awt.event.ActionListener() {
|
showAbilityPickerForced.addActionListener(new java.awt.event.ActionListener() {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
@ -1667,6 +1667,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
load(prefs, dialog.checkBoxEndOfCOthers, PhaseManager.END_OF_COMBAT_OTHERS);
|
load(prefs, dialog.checkBoxEndOfCOthers, PhaseManager.END_OF_COMBAT_OTHERS);
|
||||||
load(prefs, dialog.checkBoxMain2Others, PhaseManager.MAIN_2_OTHERS);
|
load(prefs, dialog.checkBoxMain2Others, PhaseManager.MAIN_2_OTHERS);
|
||||||
load(prefs, dialog.checkBoxEndTurnOthers, PhaseManager.END_OF_TURN_OTHERS);
|
load(prefs, dialog.checkBoxEndTurnOthers, PhaseManager.END_OF_TURN_OTHERS);
|
||||||
|
|
||||||
load(prefs, dialog.displayBigCardsInHand, KEY_HAND_USE_BIG_CARDS, "true");
|
load(prefs, dialog.displayBigCardsInHand, KEY_HAND_USE_BIG_CARDS, "true");
|
||||||
load(prefs, dialog.showToolTipsInAnyZone, KEY_SHOW_TOOLTIPS_ANY_ZONE, "true");
|
load(prefs, dialog.showToolTipsInAnyZone, KEY_SHOW_TOOLTIPS_ANY_ZONE, "true");
|
||||||
load(prefs, dialog.nonLandPermanentsInOnePile, KEY_PERMANENTS_IN_ONE_PILE, "true");
|
load(prefs, dialog.nonLandPermanentsInOnePile, KEY_PERMANENTS_IN_ONE_PILE, "true");
|
||||||
|
|
|
@ -30,7 +30,6 @@ package mage.player.human;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -829,9 +828,14 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||||
if (ability instanceof PlayLandAbility) {
|
if (ability instanceof PlayLandAbility) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (ability.getManaCostsToPay().convertedManaCost() > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (ability instanceof ManaAbility) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
for(Cost cost : ability.getCosts() ) {
|
for(Cost cost : ability.getCosts() ) {
|
||||||
if (!(cost instanceof TapSourceCost)
|
if (!(cost instanceof TapSourceCost)) {
|
||||||
|| !((cost instanceof ManaCosts) && ((ManaCosts)cost).convertedManaCost() >0)) {
|
|
||||||
// if cost exists that have to be paid, pick ability dialog can be suppressed
|
// if cost exists that have to be paid, pick ability dialog can be suppressed
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,9 +120,14 @@ public class Session {
|
||||||
public boolean setUserData(String userName, UserDataView userDataView) {
|
public boolean setUserData(String userName, UserDataView userDataView) {
|
||||||
User user = UserManager.getInstance().findUser(userName);
|
User user = UserManager.getInstance().findUser(userName);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
UserData userData = new UserData(UserGroup.PLAYER, userDataView.getAvatarId(), userDataView.isShowAbilityPickerForced());
|
UserData userData = user.getUserData();
|
||||||
updateAvatar(userName, userData);
|
if (userData == null) {
|
||||||
user.setUserData(userData);
|
userData = new UserData(UserGroup.PLAYER, userDataView.getAvatarId(), userDataView.isShowAbilityPickerForced());
|
||||||
|
user.setUserData(userData);
|
||||||
|
} else {
|
||||||
|
userData.setAvatarId(userDataView.getAvatarId());
|
||||||
|
userData.setShowAbilityPickerForced(userDataView.isShowAbilityPickerForced());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue