Move several confirm popups to prompt pane - required modifying prompt pane to have a cardview instead of a spellabilityview

This commit is contained in:
pfps
2017-01-21 16:28:11 +00:00
parent ca45bf3da5
commit 5924706b1a
15 changed files with 175 additions and 79 deletions

View File

@@ -792,8 +792,8 @@ public final class CMatchUI
cPrompt.setMessage(message); cPrompt.setMessage(message);
} }
// no override for now // no override for now
public void showPromptMessage(final PlayerView playerView, final String message, final SpellAbilityView sav ) { public void showPromptMessage(final PlayerView playerView, final String message, final CardView card ) {
cPrompt.setMessage(message,sav); cPrompt.setMessage(message,card);
} }
@Override @Override

View File

@@ -29,7 +29,6 @@ import javax.swing.JButton;
import forge.FThreads; import forge.FThreads;
import forge.game.GameView; import forge.game.GameView;
import forge.game.card.CardView; import forge.game.card.CardView;
import forge.game.spellability.SpellAbilityView;
import forge.gui.framework.ICDoc; import forge.gui.framework.ICDoc;
import forge.gui.framework.SDisplayUtil; import forge.gui.framework.SDisplayUtil;
import forge.screens.match.CMatchUI; import forge.screens.match.CMatchUI;
@@ -105,11 +104,11 @@ public class CPrompt implements ICDoc {
public void setMessage(final String s0) { public void setMessage(final String s0) {
view.getTarMessage().setText(FSkin.encodeSymbols(s0, false)); view.getTarMessage().setText(FSkin.encodeSymbols(s0, false));
view.setSpellAbilityView(null); view.setCardView(null);
} }
public void setMessage(final String s0, final SpellAbilityView sav) { public void setMessage(final String s0, final CardView card) {
view.getTarMessage().setText(FSkin.encodeSymbols(s0, false)); view.getTarMessage().setText(FSkin.encodeSymbols(s0, false));
view.setSpellAbilityView(sav); view.setCardView(card);
} }
/** /**

View File

@@ -18,7 +18,6 @@
package forge.screens.match.views; package forge.screens.match.views;
import forge.game.card.CardView; import forge.game.card.CardView;
import forge.game.spellability.SpellAbilityView;
import forge.gui.framework.DragCell; import forge.gui.framework.DragCell;
import forge.gui.framework.DragTab; import forge.gui.framework.DragTab;
import forge.gui.framework.EDocID; import forge.gui.framework.EDocID;
@@ -56,10 +55,10 @@ public class VPrompt implements IVDoc<CPrompt> {
private final FScrollPane messageScroller = new FScrollPane(tarMessage, false, private final FScrollPane messageScroller = new FScrollPane(tarMessage, false,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
private final JLabel lblGames; private final JLabel lblGames;
private SpellAbilityView sav = null ; private CardView card = null ;
public void setSpellAbilityView(final SpellAbilityView sav) { public void setCardView(final CardView card) {
this.sav = sav ; this.card = card ;
} }
private KeyAdapter buttonKeyAdapter = new KeyAdapter() { private KeyAdapter buttonKeyAdapter = new KeyAdapter() {
@@ -97,8 +96,8 @@ public class VPrompt implements IVDoc<CPrompt> {
messageScroller.getViewport().getView().addMouseListener(new MouseAdapter() { messageScroller.getViewport().getView().addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseEntered(final MouseEvent e) { public void mouseEntered(final MouseEvent e) {
if ( sav != null ) { if ( card != null ) {
controller.getMatchUI().setCard(sav.getHostCard()); controller.getMatchUI().setCard(card);
} }
} }
}); });

View File

@@ -157,7 +157,7 @@ public class MatchController extends AbstractGuiGame {
} }
@Override @Override
public void showPromptMessage(final PlayerView player, final String message, final SpellAbilityView sav) { public void showPromptMessage(final PlayerView player, final String message, final CardView card) {
view.getPrompt(player).setMessage(message); view.getPrompt(player).setMessage(message);
} }

View File

@@ -32,7 +32,7 @@ public interface IGuiGame {
void afterGameEnd(); void afterGameEnd();
void showCombat(); void showCombat();
void showPromptMessage(PlayerView playerView, String message); void showPromptMessage(PlayerView playerView, String message);
void showPromptMessage(PlayerView playerView, String message, SpellAbilityView sav); void showPromptMessage(PlayerView playerView, String message, CardView card);
void updateButtons(PlayerView owner, boolean okEnabled, boolean cancelEnabled, boolean focusOk); void updateButtons(PlayerView owner, boolean okEnabled, boolean cancelEnabled, boolean focusOk);
void updateButtons(PlayerView owner, String label1, String label2, boolean enable1, boolean enable2, boolean focus1); void updateButtons(PlayerView owner, String label1, String label2, boolean enable1, boolean enable2, boolean focus1);
void flashIncorrectAction(); void flashIncorrectAction();

View File

@@ -21,6 +21,7 @@ import java.util.List;
import forge.game.Game; import forge.game.Game;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.card.CardView;
import forge.game.phase.PhaseHandler; import forge.game.phase.PhaseHandler;
import forge.game.player.Player; import forge.game.player.Player;
import forge.game.player.PlayerView; import forge.game.player.PlayerView;
@@ -119,7 +120,10 @@ public abstract class InputBase implements java.io.Serializable, Input {
controller.getGui().showPromptMessage(getOwner(), message); controller.getGui().showPromptMessage(getOwner(), message);
} }
protected final void showMessage(final String message, final SpellAbilityView sav) { protected final void showMessage(final String message, final SpellAbilityView sav) {
controller.getGui().showPromptMessage(getOwner(), message, sav); controller.getGui().showPromptMessage(getOwner(), message, sav.getHostCard());
}
protected final void showMessage(final String message, final CardView card) {
controller.getGui().showPromptMessage(getOwner(), message, card);
} }
protected String getTurnPhasePriorityMessage(final Game game) { protected String getTurnPhasePriorityMessage(final Game game) {

View File

@@ -18,7 +18,9 @@
package forge.match.input; package forge.match.input;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.card.CardView;
import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityView;
import forge.game.trigger.Trigger; import forge.game.trigger.Trigger;
import forge.game.trigger.WrappedAbility; import forge.game.trigger.WrappedAbility;
import forge.model.FModel; import forge.model.FModel;
@@ -42,38 +44,85 @@ public class InputConfirm extends InputSyncronizedBase {
private final boolean defaultYes; private final boolean defaultYes;
private boolean result; private boolean result;
private SpellAbility sa; private SpellAbility sa;
private CardView card;
public InputConfirm(final PlayerControllerHuman controller, String message0, SpellAbility sa) { public InputConfirm(final PlayerControllerHuman controller, String message0) {
this(controller, message0, "Yes", "No", true, sa); this(controller, message0, "Yes", "No", true);
} }
public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0, SpellAbility sa) { public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0) {
this(controller, message0, yesButtonText0, noButtonText0, true, sa); this(controller, message0, yesButtonText0, noButtonText0, true);
} }
public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0, boolean defaultYes0, SpellAbility sa) { public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0, boolean defaultYes0) {
super(controller); super(controller);
message = message0; message = message0;
yesButtonText = yesButtonText0; yesButtonText = yesButtonText0;
noButtonText = noButtonText0; noButtonText = noButtonText0;
defaultYes = defaultYes0; defaultYes = defaultYes0;
result = defaultYes0; result = defaultYes0;
this.sa = sa ; this.sa = null;
this.card = null;
}
public InputConfirm(final PlayerControllerHuman controller, String message0, SpellAbility sa0) {
this(controller, message0, "Yes", "No", true, sa0);
}
public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0, SpellAbility sa0) {
this(controller, message0, yesButtonText0, noButtonText0, true, sa0);
}
public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0, boolean defaultYes0, SpellAbility sa0) {
super(controller);
message = message0;
yesButtonText = yesButtonText0;
noButtonText = noButtonText0;
defaultYes = defaultYes0;
result = defaultYes0;
this.sa = sa0;
this.card = sa.getView().getHostCard();
}
public InputConfirm(final PlayerControllerHuman controller, String message0, CardView card0) {
this(controller, message0, "Yes", "No", true, card0);
}
public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0, CardView card0) {
this(controller, message0, yesButtonText0, noButtonText0, true, card0);
}
public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0, boolean defaultYes0, CardView card0) {
super(controller);
message = message0;
yesButtonText = yesButtonText0;
noButtonText = noButtonText0;
defaultYes = defaultYes0;
result = defaultYes0;
this.sa = null ;
this.card = card0;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected final void showMessage() { protected final void showMessage() {
getController().getGui().updateButtons(getOwner(), yesButtonText, noButtonText, true, true, defaultYes); getController().getGui().updateButtons(getOwner(), yesButtonText, noButtonText, true, true, defaultYes);
if ( FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_DETAILED_SPELLDESC_IN_PROMPT) &&
(card!=null) ) {
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_DETAILED_SPELLDESC_IN_PROMPT) final StringBuilder sb = new StringBuilder();
&& (sa != null)) { //was sb.append(sa.getStackDescription()).append("\n").append(message);
final StringBuilder sb = new StringBuilder(); sb.append(card.toString());
sb.append(sa.getStackDescription()).append("\n").append(message); if ( sa != null ) {
showMessage(sb.toString(), sa.getView()); sb.append(" - ").append(sa.toString());
}
sb.append("\n\n").append(message);
showMessage(sb.toString(), card);
} else { } else {
showMessage(message, (sa != null) ? sa.getView() : null); if ( card!=null ) {
showMessage(message, card);
} else {
showMessage(message);
}
} }
} }

View File

@@ -110,6 +110,7 @@ public class InputConfirmMulligan extends InputSyncronizedBase {
} }
final CardView cView = c0.getView(); final CardView cView = c0.getView();
//pfps leave this as is for now - it is confirming during another confirm so it might need the popup
if (isSerumPowder && getController().getGui().confirm(cView, "Use " + cView + "'s ability?")) { if (isSerumPowder && getController().getGui().confirm(cView, "Use " + cView + "'s ability?")) {
cardSelectLocked = true; cardSelectLocked = true;
ThreadUtil.invokeInGameThread(new Runnable() { ThreadUtil.invokeInGameThread(new Runnable() {

View File

@@ -9,21 +9,19 @@ public class InputSelectCardsFromList extends InputSelectEntitiesFromList<Card>
private static final long serialVersionUID = 6230360322294805986L; private static final long serialVersionUID = 6230360322294805986L;
public InputSelectCardsFromList(final PlayerControllerHuman controller, final int cnt, final FCollectionView<Card> validCards) { public InputSelectCardsFromList(final PlayerControllerHuman controller, final int cnt, final FCollectionView<Card> validCards) {
super(controller, cnt, cnt, validCards); // to avoid hangs this(controller, cnt, cnt, validCards);
} }
public InputSelectCardsFromList(final PlayerControllerHuman controller, final int cnt, final FCollectionView<Card> validCards, final SpellAbility sa) { public InputSelectCardsFromList(final PlayerControllerHuman controller, final int cnt, final FCollectionView<Card> validCards, final SpellAbility sa) {
this(controller,cnt,validCards); this(controller, cnt, cnt, validCards, sa);
this.sa = sa;
} }
public InputSelectCardsFromList(final PlayerControllerHuman controller, final int min, final int max, final FCollectionView<Card> validCards) { public InputSelectCardsFromList(final PlayerControllerHuman controller, final int min, final int max, final FCollectionView<Card> validCards) {
super(controller, min, max, validCards); // to avoid hangs super(controller, min, max, validCards);
} }
public InputSelectCardsFromList(final PlayerControllerHuman controller, final int min, final int max, final FCollectionView<Card> validCards, final SpellAbility sa) { public InputSelectCardsFromList(final PlayerControllerHuman controller, final int min, final int max, final FCollectionView<Card> validCards, final SpellAbility sa) {
this(controller,min,max,validCards); super(controller, min, max, validCards, sa);
this.sa = sa;
} }
} }

View File

@@ -19,17 +19,15 @@ public class InputSelectEntitiesFromList<T extends GameEntity> extends InputSele
protected final FCollection<T> selected = new FCollection<T>(); protected final FCollection<T> selected = new FCollection<T>();
public InputSelectEntitiesFromList(final PlayerControllerHuman controller, final int min, final int max, final FCollectionView<T> validChoices0) { public InputSelectEntitiesFromList(final PlayerControllerHuman controller, final int min, final int max, final FCollectionView<T> validChoices0) {
super(controller, Math.min(min, validChoices0.size()), Math.min(max, validChoices0.size())); this(controller, min, max, validChoices0, null);
validChoices = validChoices0;
if (min > validChoices.size()) {
System.out.println(String.format("Trying to choose at least %d cards from a list with only %d cards!", min, validChoices.size()));
}
} }
public InputSelectEntitiesFromList(final PlayerControllerHuman controller, final int min, final int max, final FCollectionView<T> validChoices0, final SpellAbility sa) { public InputSelectEntitiesFromList(final PlayerControllerHuman controller, final int min, final int max, final FCollectionView<T> validChoices0, final SpellAbility sa0) {
this(controller,min,max,validChoices0); super(controller, Math.min(min, validChoices0.size()), Math.min(max, validChoices0.size()),sa0);
this.sa = sa; validChoices = validChoices0;
if (min > validChoices.size()) {
System.out.println(String.format("Trying to choose at least %d things from a list with only %d things!", min, validChoices.size()));
}
} }
@Override @Override
@@ -95,4 +93,4 @@ public class InputSelectEntitiesFromList<T extends GameEntity> extends InputSele
? String.format(message, selected.size()) ? String.format(message, selected.size())
: String.format(message, max - selected.size()); : String.format(message, max - selected.size());
} }
} }

View File

@@ -20,6 +20,7 @@ public abstract class InputSelectManyBase<T extends GameEntity> extends InputSyn
protected final int max; protected final int max;
protected boolean allowCancel = false; protected boolean allowCancel = false;
protected SpellAbility sa = null; protected SpellAbility sa = null;
protected CardView card;
protected String message = "Source-Card-Name - Select %d more card(s)"; protected String message = "Source-Card-Name - Select %d more card(s)";
@@ -32,9 +33,16 @@ public abstract class InputSelectManyBase<T extends GameEntity> extends InputSyn
this.max = max; this.max = max;
} }
protected InputSelectManyBase(final PlayerControllerHuman controller, final int min, final int max, final SpellAbility sa) { protected InputSelectManyBase(final PlayerControllerHuman controller, final int min, final int max, final SpellAbility sa0) {
this(controller,min,max); this(controller,min,max);
this.sa = sa; this.sa = sa0;
this.card = sa0.getView().getHostCard();
}
protected InputSelectManyBase(final PlayerControllerHuman controller, final int min, final int max, final CardView card0) {
this(controller,min,max);
this.sa = null;
this.card = card0;
} }
protected void refresh() { protected void refresh() {
@@ -54,11 +62,22 @@ public abstract class InputSelectManyBase<T extends GameEntity> extends InputSyn
@Override @Override
public final void showMessage() { public final void showMessage() {
if ( FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_DETAILED_SPELLDESC_IN_PROMPT) && if ( FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_DETAILED_SPELLDESC_IN_PROMPT) &&
(sa!=null) ) { (card!=null) ) {
showMessage( sa.getStackDescription() + "\n" + getMessage(), sa.getView() ) ; // showMessage( sa.getStackDescription() + "\n" + getMessage(), sa.getView() ) ;
} else { final StringBuilder sb = new StringBuilder();
showMessage(getMessage(), (sa!=null)?sa.getView():null); sb.append(card.toString());
} if ( sa != null ) {
sb.append(" - ").append(sa.toString());
}
sb.append("\n\n").append(getMessage());
showMessage(sb.toString(), card);
} else {
if (card!=null) {
showMessage(getMessage(), card);
} else {
showMessage(getMessage());
}
}
getController().getGui().updateButtons(getOwner(), hasEnoughTargets(), allowCancel, true); getController().getGui().updateButtons(getOwner(), hasEnoughTargets(), allowCancel, true);
} }

View File

@@ -51,16 +51,12 @@ public final class InputSelectTargets extends InputSyncronizedBase {
getController().getGui().setCard(CardView.get(sa.getHostCard())); getController().getGui().setCard(CardView.get(sa.getHostCard()));
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_DETAILED_SPELLDESC_IN_PROMPT)) { if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_DETAILED_SPELLDESC_IN_PROMPT)) {
// sb.append(sa.getStackDescription().replace("(Targeting ERROR)", "")).append("\n<b>").append(tgt.getVTSelection()).append("</b>\n"); // sb.append(sa.getStackDescription().replace("(Targeting ERROR)", "")).append("\n").append(tgt.getVTSelection()).append("\n");
if (sa.isAbility()) { if (sa.isAbility()) {
sb.append(sa.getHostCard()).append(" - "); sb.append(sa.getHostCard()).append(" - ");
} }
if (GuiBase.getInterface().isLibgdxPort()) { // Apparently <b>...</b> tags do not work in mobile Forge, so don't include them (for now)
// Apparently <b>...</b> tags do not work in mobile Forge sb.append(sa.toString().replace("(Targeting ERROR)", "")).append("\n\n").append(tgt.getVTSelection()).append("\n");
sb.append(sa.toString().replace("(Targeting ERROR)", "")).append("\n").append(tgt.getVTSelection()).append("\n");
} else {
sb.append(sa.toString().replace("(Targeting ERROR)", "")).append("\n<b>").append(tgt.getVTSelection()).append("</b>\n");
}
} else { } else {
sb.append(sa.getHostCard()).append(" - ").append(tgt.getVTSelection()).append("\n"); sb.append(sa.getHostCard()).append(" - ").append(tgt.getVTSelection()).append("\n");
} }

View File

@@ -74,7 +74,7 @@ public class NetGuiGame extends AbstractGuiGame {
} }
@Override @Override
public void showPromptMessage(final PlayerView playerView, final String message, final SpellAbilityView sav) { public void showPromptMessage(final PlayerView playerView, final String message, final CardView card) {
updateGameView(); updateGameView();
send(ProtocolMethod.showPromptMessage, playerView, message); send(ProtocolMethod.showPromptMessage, playerView, message);
} }

View File

@@ -30,6 +30,7 @@ import forge.game.player.PlayerView;
import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityStackInstance; import forge.game.spellability.SpellAbilityStackInstance;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
import forge.match.input.InputConfirm;
import forge.match.input.InputSelectCardsFromList; import forge.match.input.InputSelectCardsFromList;
import forge.match.input.InputSelectManyBase; import forge.match.input.InputSelectManyBase;
import forge.util.Aggregates; import forge.util.Aggregates;
@@ -946,10 +947,15 @@ public class HumanCostDecision extends CostDecisionMakerBase {
if (cost.payCostFromSource()) { if (cost.payCostFromSource()) {
final int maxCounters = source.getCounters(cost.counter); final int maxCounters = source.getCounters(cost.counter);
if (amount.equals("All")) { if (amount.equals("All")) {
final CardView view = CardView.get(ability.getHostCard()); // final CardView view = CardView.get(ability.getHostCard());
if (!controller.getGui().confirm(view, "Remove all counters?")) { // if (!controller.getGui().confirm(view, "Remove all counters?")) {
return null; // return null;
} // }
final InputConfirm inp = new InputConfirm(controller, "Remove all counters?", ability);
inp.showAndWait();
if (!inp.getResult()) {
return null;
}
cntRemoved = maxCounters; cntRemoved = maxCounters;
} }
else if (c == null && "XChoice".equals(sVarAmount)) { else if (c == null && "XChoice".equals(sVarAmount)) {

View File

@@ -316,9 +316,15 @@ public class PlayerControllerHuman
} }
private final boolean assignDamageAsIfNotBlocked(final Card attacker) { private final boolean assignDamageAsIfNotBlocked(final Card attacker) {
return attacker.hasKeyword("CARDNAME assigns its combat damage as though it weren't blocked.") if ( attacker.hasKeyword("CARDNAME assigns its combat damage as though it weren't blocked.") ||
|| (attacker.hasKeyword("You may have CARDNAME assign its combat damage as though it weren't blocked.") attacker.hasKeyword("You may have CARDNAME assign its combat damage as though it weren't blocked.") ) {
&& getGui().confirm(CardView.get(attacker), "Do you want to assign its combat damage as though it weren't blocked?")); // return getGui().confirm(CardView.get(attacker), "Do you want to assign its combat damage as though it weren't blocked?");
final InputConfirm inp = new InputConfirm(this, "Do you want to assign its combat damage as though it weren't blocked?", CardView.get(attacker));
inp.showAndWait();
return inp.getResult();
} else {
return false;
}
} }
@Override @Override
@@ -488,18 +494,27 @@ public class PlayerControllerHuman
*/ */
@Override @Override
public boolean confirmAction(final SpellAbility sa, final PlayerActionConfirmMode mode, final String message) { public boolean confirmAction(final SpellAbility sa, final PlayerActionConfirmMode mode, final String message) {
return getGui().confirm(CardView.get(sa.getHostCard()), message); // return getGui().confirm(CardView.get(sa.getHostCard()), message);
final InputConfirm inp = new InputConfirm(this, message, sa);
inp.showAndWait();
return inp.getResult();
} }
@Override @Override
public boolean confirmBidAction(final SpellAbility sa, final PlayerActionConfirmMode bidlife, public boolean confirmBidAction(final SpellAbility sa, final PlayerActionConfirmMode bidlife,
final String string, final int bid, final Player winner) { final String string, final int bid, final Player winner) {
return getGui().confirm(CardView.get(sa.getHostCard()), string + " Highest Bidder " + winner); // return getGui().confirm(CardView.get(sa.getHostCard()), string + " Highest Bidder " + winner);
final InputConfirm inp = new InputConfirm(this, string + " Highest Bidder " + winner, sa);
inp.showAndWait();
return inp.getResult();
} }
@Override @Override
public boolean confirmStaticApplication(final Card hostCard, final GameEntity affected, final String logic, final String message) { public boolean confirmStaticApplication(final Card hostCard, final GameEntity affected, final String logic, final String message) {
return getGui().confirm(CardView.get(hostCard), message); // return getGui().confirm(CardView.get(hostCard), message);
final InputConfirm inp = new InputConfirm(this, message, hostCard.getView());
inp.showAndWait();
return inp.getResult();
} }
@Override @Override
@@ -518,11 +533,11 @@ public class PlayerControllerHuman
return true; return true;
} }
final StringBuilder buildQuestion = new StringBuilder("<b>Use triggered ability of "); final StringBuilder buildQuestion = new StringBuilder("Use triggered ability of ");
buildQuestion.append(regtrig.getHostCard().toString()).append("?</b>"); buildQuestion.append(regtrig.getHostCard().toString()).append("?");
if (!FModel.getPreferences().getPrefBoolean(FPref.UI_COMPACT_PROMPT) && if (!FModel.getPreferences().getPrefBoolean(FPref.UI_COMPACT_PROMPT) &&
!FModel.getPreferences().getPrefBoolean(FPref.UI_DETAILED_SPELLDESC_IN_PROMPT) ) { !FModel.getPreferences().getPrefBoolean(FPref.UI_DETAILED_SPELLDESC_IN_PROMPT) ) {
//append trigger description unless prompt is compact //append trigger description unless prompt is compact or detailed descriptions are on
buildQuestion.append("\n("); buildQuestion.append("\n(");
buildQuestion.append(triggerParams.get("TriggerDescription").replace("CARDNAME", regtrig.getHostCard().getName())); buildQuestion.append(triggerParams.get("TriggerDescription").replace("CARDNAME", regtrig.getHostCard().getName()));
buildQuestion.append(")"); buildQuestion.append(")");
@@ -539,7 +554,6 @@ public class PlayerControllerHuman
} }
} }
// pfps: trigger is on stack so do we really need to put it in the prompt area?
final InputConfirm inp = new InputConfirm(this, buildQuestion.toString(), wrapper); final InputConfirm inp = new InputConfirm(this, buildQuestion.toString(), wrapper);
inp.showAndWait(); inp.showAndWait();
return inp.getResult(); return inp.getResult();
@@ -550,7 +564,7 @@ public class PlayerControllerHuman
if (game.getPlayers().size() == 2) { if (game.getPlayers().size() == 2) {
final String prompt = String.format("%s, you %s\n\nWould you like to play or draw?", final String prompt = String.format("%s, you %s\n\nWould you like to play or draw?",
player.getName(), isFirstGame ? " have won the coin toss." : " lost the last game."); player.getName(), isFirstGame ? " have won the coin toss." : " lost the last game.");
final InputConfirm inp = new InputConfirm(this, prompt, "Play", "Draw", null); final InputConfirm inp = new InputConfirm(this, prompt, "Play", "Draw");
inp.showAndWait(); inp.showAndWait();
return inp.getResult() ? this.player : this.player.getOpponents().get(0); return inp.getResult() ? this.player : this.player.getOpponents().get(0);
} }
@@ -644,7 +658,10 @@ public class PlayerControllerHuman
final CardView view = CardView.get(c); final CardView view = CardView.get(c);
tempShowCard(c); tempShowCard(c);
final boolean result = getGui().confirm(view, String.format("Put %s on the top or bottom of your library?", view), ImmutableList.of("Top", "Bottom")); // final boolean result = getGui().confirm(view, String.format("Put %s on the top or bottom of your library?", view), ImmutableList.of("Top", "Bottom"));
final InputConfirm inp = new InputConfirm(this, String.format("Put %s on the top or bottom of your library?", view), "Top", "Bottom", true, view);
inp.showAndWait();
final boolean result = inp.getResult();
endTempShowCards(); endTempShowCards();
return result; return result;
@@ -845,7 +862,9 @@ public class PlayerControllerHuman
*/ */
@Override @Override
public boolean confirmReplacementEffect(final ReplacementEffect replacementEffect, final SpellAbility effectSA, final String question) { public boolean confirmReplacementEffect(final ReplacementEffect replacementEffect, final SpellAbility effectSA, final String question) {
return getGui().confirm(CardView.get(replacementEffect.getHostCard()), question); final InputConfirm inp = new InputConfirm(this, question, effectSA);
inp.showAndWait();
return inp.getResult();
} }
@Override @Override
@@ -1008,9 +1027,13 @@ public class PlayerControllerHuman
case UntapOrLeaveTapped: labels = ImmutableList.of("Untap", "Leave tapped"); break; case UntapOrLeaveTapped: labels = ImmutableList.of("Untap", "Leave tapped"); break;
case UntapTimeVault: labels = ImmutableList.of("Untap (and skip this turn)", "Leave tapped"); break; case UntapTimeVault: labels = ImmutableList.of("Untap (and skip this turn)", "Leave tapped"); break;
case PlayOrDraw: labels = ImmutableList.of("Play", "Draw"); break; case PlayOrDraw: labels = ImmutableList.of("Play", "Draw"); break;
case LeftOrRight: labels = ImmutableList.of("Left", "Right"); break;
default: labels = ImmutableList.copyOf(kindOfChoice.toString().split("Or")); default: labels = ImmutableList.copyOf(kindOfChoice.toString().split("Or"));
} }
return getGui().confirm(CardView.get(sa.getHostCard()), question, defaultVal == null || defaultVal.booleanValue(), labels); // return getGui().confirm(CardView.get(sa.getHostCard()), question, defaultVal == null || defaultVal.booleanValue(), labels);
final InputConfirm inp = new InputConfirm(this, question, labels.get(0), labels.get(1), defaultVal == null || defaultVal.booleanValue(), sa);
inp.showAndWait();
return inp.getResult();
} }
@Override @Override
@@ -1141,7 +1164,11 @@ public class PlayerControllerHuman
if (colorNames.size() > 2) { if (colorNames.size() > 2) {
return MagicColor.fromName(getGui().one(message, colorNames)); return MagicColor.fromName(getGui().one(message, colorNames));
} }
final int idxChosen = getGui().confirm(CardView.get(c), message, colorNames) ? 0 : 1; //final boolean confirmed = getGui().confirm(CardView.get(c), message, colorNames) ;
final InputConfirm inp = new InputConfirm(this, message, colorNames.get(0), colorNames.get(1), CardView.get(c));
inp.showAndWait();
final boolean confirmed = inp.getResult();
final int idxChosen = confirmed ? 0 : 1;
return MagicColor.fromName(colorNames.get(idxChosen)); return MagicColor.fromName(colorNames.get(idxChosen));
} }