fixing couter-logical defaultNo parameter

This commit is contained in:
Maxmtg
2012-10-01 18:13:35 +00:00
parent 22c3888d1c
commit 5c11cbe5d2
2 changed files with 6 additions and 6 deletions

View File

@@ -562,7 +562,7 @@ public final class GameActionUtil {
* @return a boolean. * @return a boolean.
*/ */
public static boolean showYesNoDialog(final Card c, final String question) { public static boolean showYesNoDialog(final Card c, final String question) {
return GameActionUtil.showYesNoDialog(c, question, false); return GameActionUtil.showYesNoDialog(c, question, true);
} }
/** /**
@@ -578,7 +578,7 @@ public final class GameActionUtil {
* true if the default option should be "No", false otherwise * true if the default option should be "No", false otherwise
* @return a boolean. * @return a boolean.
*/ */
public static boolean showYesNoDialog(final Card c, String question, final boolean defaultNo) { public static boolean showYesNoDialog(final Card c, String question, final boolean defaultChoice) {
CMatchUI.SINGLETON_INSTANCE.setCard(c); CMatchUI.SINGLETON_INSTANCE.setCard(c);
final StringBuilder title = new StringBuilder(); final StringBuilder title = new StringBuilder();
title.append(c.getName()).append(" - Ability"); title.append(c.getName()).append(" - Ability");
@@ -588,7 +588,7 @@ public final class GameActionUtil {
} }
int answer; int answer;
if (defaultNo) { if (!defaultChoice) {
final Object[] options = { "Yes", "No" }; final Object[] options = { "Yes", "No" };
answer = JOptionPane.showOptionDialog(null, question, title.toString(), JOptionPane.YES_NO_OPTION, answer = JOptionPane.showOptionDialog(null, question, title.toString(), JOptionPane.YES_NO_OPTION,
JOptionPane.PLAIN_MESSAGE, null, options, options[1]); JOptionPane.PLAIN_MESSAGE, null, options, options[1]);

View File

@@ -144,18 +144,18 @@ public class Untap extends Phase implements java.io.Serializable {
if (c.isTapped()) { if (c.isTapped()) {
if (c.getController().isHuman()) { if (c.getController().isHuman()) {
String prompt = "Untap " + c.getName() + "?"; String prompt = "Untap " + c.getName() + "?";
boolean defaultNo = false; boolean defaultChoice = true;
if (c.getGainControlTargets().size() > 0) { if (c.getGainControlTargets().size() > 0) {
final ArrayList<Card> targets = c.getGainControlTargets(); final ArrayList<Card> targets = c.getGainControlTargets();
prompt += "\r\n" + c + " is controlling: "; prompt += "\r\n" + c + " is controlling: ";
for (final Card target : targets) { for (final Card target : targets) {
prompt += target; prompt += target;
if (AllZoneUtil.isCardInPlay(target)) { if (AllZoneUtil.isCardInPlay(target)) {
defaultNo |= true; defaultChoice = false;
} }
} }
} }
if (GameActionUtil.showYesNoDialog(c, prompt, defaultNo)) { if (GameActionUtil.showYesNoDialog(c, prompt, defaultChoice)) {
c.untap(); c.untap();
} }
} else { // computer } else { // computer