Drag the current spellability closer to the GUI so that it can be (eventually) displayed

This commit is contained in:
pfps
2017-01-18 16:37:41 +00:00
parent 330dc48564
commit 43b99d130a
14 changed files with 122 additions and 85 deletions

View File

@@ -1292,7 +1292,7 @@ public class AiController {
throw new UnsupportedOperationException("AI is not supposed to reach this code at the moment"); throw new UnsupportedOperationException("AI is not supposed to reach this code at the moment");
} }
public Map<GameEntity, CounterType> chooseProliferation() { public Map<GameEntity, CounterType> chooseProliferation(final SpellAbility sa) {
final Map<GameEntity, CounterType> result = Maps.newHashMap(); final Map<GameEntity, CounterType> result = Maps.newHashMap();
final List<Player> allies = player.getAllies(); final List<Player> allies = player.getAllies();

View File

@@ -626,7 +626,7 @@ public class PlayerControllerAi extends PlayerController {
} }
@Override @Override
public boolean confirmPayment(CostPart costPart, String prompt) { public boolean confirmPayment(CostPart costPart, String prompt, SpellAbility sa) {
return brains.confirmPayment(costPart); // AI is expected to know what it is paying for at the moment (otherwise add another parameter to this method) return brains.confirmPayment(costPart); // AI is expected to know what it is paying for at the moment (otherwise add another parameter to this method)
} }
@@ -760,8 +760,8 @@ public class PlayerControllerAi extends PlayerController {
} }
@Override @Override
public Map<GameEntity, CounterType> chooseProliferation() { public Map<GameEntity, CounterType> chooseProliferation(SpellAbility sa) {
return brains.chooseProliferation(); return brains.chooseProliferation(sa);
} }
@Override @Override

View File

@@ -24,7 +24,7 @@ public class CountersProliferateEffect extends SpellAbilityEffect {
@Override @Override
public void resolve(SpellAbility sa) { public void resolve(SpellAbility sa) {
Player controller = sa.getHostCard().getController(); Player controller = sa.getHostCard().getController();
Map<GameEntity, CounterType> proliferateChoice = controller.getController().chooseProliferation(); Map<GameEntity, CounterType> proliferateChoice = controller.getController().chooseProliferation(sa);
if (proliferateChoice == null ) if (proliferateChoice == null )
return; return;
for(Entry<GameEntity, CounterType> ge: proliferateChoice.entrySet()) { for(Entry<GameEntity, CounterType> ge: proliferateChoice.entrySet()) {

View File

@@ -201,7 +201,7 @@ public abstract class PlayerController {
return chooseCounterType(options, sa, prompt); return chooseCounterType(options, sa, prompt);
} }
public abstract boolean confirmPayment(CostPart costPart, String string); public abstract boolean confirmPayment(CostPart costPart, String string, SpellAbility sa);
public abstract ReplacementEffect chooseSingleReplacementEffect(String prompt, List<ReplacementEffect> possibleReplacers, Map<String, Object> runParams); public abstract ReplacementEffect chooseSingleReplacementEffect(String prompt, List<ReplacementEffect> possibleReplacers, Map<String, Object> runParams);
public abstract String chooseProtectionType(String string, SpellAbility sa, List<String> choices); public abstract String chooseProtectionType(String string, SpellAbility sa, List<String> choices);
public abstract CardShields chooseRegenerationShield(Card c); public abstract CardShields chooseRegenerationShield(Card c);
@@ -212,7 +212,7 @@ public abstract class PlayerController {
public abstract void playTrigger(Card host, WrappedAbility wrapperAbility, boolean isMandatory); public abstract void playTrigger(Card host, WrappedAbility wrapperAbility, boolean isMandatory);
public abstract boolean playSaFromPlayEffect(SpellAbility tgtSA); public abstract boolean playSaFromPlayEffect(SpellAbility tgtSA);
public abstract Map<GameEntity, CounterType> chooseProliferation(); public abstract Map<GameEntity, CounterType> chooseProliferation(SpellAbility sa);
public abstract boolean chooseCardsPile(SpellAbility sa, CardCollectionView pile1, CardCollectionView pile2, String faceUp); public abstract boolean chooseCardsPile(SpellAbility sa, CardCollectionView pile1, CardCollectionView pile2, String faceUp);
public abstract void revealAnte(String message, Multimap<Player, PaperCard> removedAnteCards); public abstract void revealAnte(String message, Multimap<Player, PaperCard> removedAnteCards);
@@ -255,4 +255,4 @@ public abstract class PlayerController {
public AnteResult getAnteResult() { public AnteResult getAnteResult() {
return game.getOutcome().anteResult.get(player); return game.getOutcome().anteResult.get(player);
} }
} }

View File

@@ -496,7 +496,7 @@ public class PlayerControllerForTests extends PlayerController {
} }
@Override @Override
public boolean confirmPayment(CostPart costPart, String string) { public boolean confirmPayment(CostPart costPart, String string, SpellAbility ability) {
return true; return true;
} }
@@ -564,7 +564,7 @@ public class PlayerControllerForTests extends PlayerController {
} }
@Override @Override
public Map<GameEntity, CounterType> chooseProliferation() { public Map<GameEntity, CounterType> chooseProliferation(final SpellAbility sa) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }

View File

@@ -18,6 +18,7 @@
package forge.match.input; package forge.match.input;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.spellability.SpellAbility;
import forge.player.PlayerControllerHuman; import forge.player.PlayerControllerHuman;
/** /**
@@ -36,22 +37,24 @@ public class InputConfirm extends InputSyncronizedBase {
private final String noButtonText; private final String noButtonText;
private final boolean defaultYes; private final boolean defaultYes;
private boolean result; private boolean result;
private SpellAbility sa;
public InputConfirm(final PlayerControllerHuman controller, String message0) { public InputConfirm(final PlayerControllerHuman controller, String message0, SpellAbility sa) {
this(controller, message0, "Yes", "No", true); this(controller, message0, "Yes", "No", true, sa);
} }
public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0) { public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0, SpellAbility sa) {
this(controller, message0, yesButtonText0, noButtonText0, true); this(controller, message0, yesButtonText0, noButtonText0, true, sa);
} }
public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0, boolean defaultYes0) { public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0, boolean defaultYes0, SpellAbility sa) {
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 ;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

View File

@@ -11,15 +11,18 @@ import forge.game.GameEntity;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.card.CounterType; import forge.game.card.CounterType;
import forge.game.player.Player; import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.player.PlayerControllerHuman; import forge.player.PlayerControllerHuman;
import forge.util.ITriggerEvent; import forge.util.ITriggerEvent;
public final class InputProliferate extends InputSelectManyBase<GameEntity> { public final class InputProliferate extends InputSelectManyBase<GameEntity> {
private static final long serialVersionUID = -1779224307654698954L; private static final long serialVersionUID = -1779224307654698954L;
private final Map<GameEntity, CounterType> chosenCounters = new HashMap<GameEntity, CounterType>(); private final Map<GameEntity, CounterType> chosenCounters = new HashMap<GameEntity, CounterType>();
private SpellAbility sa;
public InputProliferate(final PlayerControllerHuman controller) { public InputProliferate(final PlayerControllerHuman controller, final SpellAbility sa) {
super(controller, 1, Integer.MAX_VALUE); super(controller, 1, Integer.MAX_VALUE);
this.sa = sa;
} }
@Override @Override
@@ -118,4 +121,4 @@ public final class InputProliferate extends InputSelectManyBase<GameEntity> {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return chosenCounters.keySet(); return chosenCounters.keySet();
} }
} }

View File

@@ -16,6 +16,7 @@ import forge.game.card.CardCollectionView;
import forge.game.card.CardUtil; import forge.game.card.CardUtil;
import forge.game.mana.ManaCostBeingPaid; import forge.game.mana.ManaCostBeingPaid;
import forge.game.player.Player; import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.player.PlayerControllerHuman; import forge.player.PlayerControllerHuman;
import forge.util.ITriggerEvent; import forge.util.ITriggerEvent;
@@ -29,8 +30,9 @@ public final class InputSelectCardsForConvokeOrImprovise extends InputSelectMany
private final boolean improvise; private final boolean improvise;
private final String cardType; private final String cardType;
private final String description; private final String description;
private SpellAbility sa;
public InputSelectCardsForConvokeOrImprovise(final PlayerControllerHuman controller, final Player p, final ManaCost cost, final CardCollectionView untapped, boolean impr) { public InputSelectCardsForConvokeOrImprovise(final PlayerControllerHuman controller, final Player p, final ManaCost cost, final CardCollectionView untapped, boolean impr, final SpellAbility sa) {
super(controller, 0, Math.min(cost.getCMC(), untapped.size())); super(controller, 0, Math.min(cost.getCMC(), untapped.size()));
remainingCost = new ManaCostBeingPaid(cost); remainingCost = new ManaCostBeingPaid(cost);
player = p; player = p;
@@ -38,11 +40,15 @@ public final class InputSelectCardsForConvokeOrImprovise extends InputSelectMany
improvise = impr; improvise = impr;
cardType = impr ? "artifact" : "creature"; cardType = impr ? "artifact" : "creature";
description = impr ? "Improvise" : "Convoke"; description = impr ? "Improvise" : "Convoke";
this.sa = sa;
} }
@Override @Override
protected String getMessage() { protected String getMessage() {
return String.format("Choose %s to tap for %s .\nRemaining mana cost is %s", cardType, description, remainingCost.toString()); StringBuilder sb = new StringBuilder();
if (sa != null) sb.append(sa.getStackDescription());
sb.append(String.format("Choose %s to tap for %s .\nRemaining mana cost is %s", cardType, description, remainingCost.toString()));
return sb.toString();
} }
@Override @Override
@@ -124,4 +130,4 @@ public final class InputSelectCardsForConvokeOrImprovise extends InputSelectMany
// TODO Auto-generated method stub // TODO Auto-generated method stub
return chosenCards.keySet(); return chosenCards.keySet();
} }
} }

View File

@@ -1,6 +1,7 @@
package forge.match.input; package forge.match.input;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.spellability.SpellAbility;
import forge.player.PlayerControllerHuman; import forge.player.PlayerControllerHuman;
import forge.util.collect.FCollectionView; import forge.util.collect.FCollectionView;
@@ -10,9 +11,19 @@ public class InputSelectCardsFromList extends InputSelectEntitiesFromList<Card>
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 super(controller, cnt, cnt, validCards); // to avoid hangs
} }
public InputSelectCardsFromList(final PlayerControllerHuman controller, final int cnt, final FCollectionView<Card> validCards, final SpellAbility sa) {
this(controller,cnt,validCards);
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); // to avoid hangs
} }
} public InputSelectCardsFromList(final PlayerControllerHuman controller, final int min, final int max, final FCollectionView<Card> validCards, final SpellAbility sa) {
this(controller,min,max,validCards);
this.sa = sa;
}
}

View File

@@ -6,6 +6,7 @@ import java.util.List;
import forge.game.GameEntity; import forge.game.GameEntity;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.player.Player; import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.player.PlayerControllerHuman; import forge.player.PlayerControllerHuman;
import forge.util.collect.FCollection; import forge.util.collect.FCollection;
import forge.util.collect.FCollectionView; import forge.util.collect.FCollectionView;
@@ -26,6 +27,11 @@ public class InputSelectEntitiesFromList<T extends GameEntity> extends InputSele
} }
} }
public InputSelectEntitiesFromList(final PlayerControllerHuman controller, final int min, final int max, final FCollectionView<T> validChoices0, final SpellAbility sa) {
this(controller,min,max,validChoices0);
this.sa = sa;
}
@Override @Override
protected boolean onCardSelected(final Card c, final List<Card> otherCardsToSelect, final ITriggerEvent triggerEvent) { protected boolean onCardSelected(final Card c, final List<Card> otherCardsToSelect, final ITriggerEvent triggerEvent) {
if (!selectEntity(c)) { if (!selectEntity(c)) {

View File

@@ -7,6 +7,7 @@ import com.google.common.collect.Iterables;
import forge.game.GameEntity; import forge.game.GameEntity;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.card.CardView; import forge.game.card.CardView;
import forge.game.spellability.SpellAbility;
import forge.player.PlayerControllerHuman; import forge.player.PlayerControllerHuman;
public abstract class InputSelectManyBase<T extends GameEntity> extends InputSyncronizedBase { public abstract class InputSelectManyBase<T extends GameEntity> extends InputSyncronizedBase {
@@ -16,6 +17,7 @@ public abstract class InputSelectManyBase<T extends GameEntity> extends InputSyn
protected final int min; protected final int min;
protected final int max; protected final int max;
protected boolean allowCancel = false; protected boolean allowCancel = false;
protected SpellAbility sa = null;
protected String message = "Source-Card-Name - Select %d more card(s)"; protected String message = "Source-Card-Name - Select %d more card(s)";
@@ -27,6 +29,11 @@ public abstract class InputSelectManyBase<T extends GameEntity> extends InputSyn
this.min = min; this.min = min;
this.max = max; this.max = max;
} }
protected InputSelectManyBase(final PlayerControllerHuman controller, final int min, final int max, final SpellAbility sa) {
this(controller,min,max);
this.sa = sa;
}
protected void refresh() { protected void refresh() {
if (hasAllTargets()) { if (hasAllTargets()) {

View File

@@ -134,7 +134,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
final CardCollection discarded = new CardCollection(); final CardCollection discarded = new CardCollection();
while (c > 0) { while (c > 0) {
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, hand); final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, hand, ability);
inp.setMessage("Select one of the cards with the same name to discard. Already chosen: " + discarded); inp.setMessage("Select one of the cards with the same name to discard. Already chosen: " + discarded);
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.showAndWait(); inp.showAndWait();
@@ -166,7 +166,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
} }
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, hand); final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, hand, ability);
inp.setMessage("Select %d more " + cost.getDescriptiveType() + " to discard."); inp.setMessage("Select %d more " + cost.getDescriptiveType() + " to discard.");
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.showAndWait(); inp.showAndWait();
@@ -193,7 +193,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
} }
if (player.canPayLife(c) && player.getController().confirmPayment(cost, "Pay " + c + " Life?")) { if (player.canPayLife(c) && player.getController().confirmPayment(cost, "Pay " + c + " Life?", ability)) {
return PaymentDecision.number(c); return PaymentDecision.number(c);
} }
return null; return null;
@@ -208,7 +208,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
c = AbilityUtils.calculateAmount(source, amount, ability); c = AbilityUtils.calculateAmount(source, amount, ability);
} }
if (!player.getController().confirmPayment(cost, "Draw " + c + " Card" + (c == 1 ? "" : "s"))) { if (!player.getController().confirmPayment(cost, "Draw " + c + " Card" + (c == 1 ? "" : "s"), ability)) {
return null; return null;
} }
@@ -243,7 +243,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
if (cost.payCostFromSource()) { if (cost.payCostFromSource()) {
return source.getZone() == player.getZone(cost.from) && player.getController().confirmPayment(cost, "Exile " + source.getName() + "?") ? PaymentDecision.card(source) : null; return source.getZone() == player.getZone(cost.from) && player.getController().confirmPayment(cost, "Exile " + source.getName() + "?", ability) ? PaymentDecision.card(source) : null;
} }
if (type.equals("All")) { if (type.equals("All")) {
@@ -262,7 +262,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
if (cost.from == ZoneType.Battlefield || cost.from == ZoneType.Hand) { if (cost.from == ZoneType.Battlefield || cost.from == ZoneType.Hand) {
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, list); final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, list, ability);
inp.setMessage("Exile %d card(s) from your" + cost.from); inp.setMessage("Exile %d card(s) from your" + cost.from);
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.showAndWait(); inp.showAndWait();
@@ -382,7 +382,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
sb.append("Exile ").append(nNeeded).append(" cards from the top of your library?"); sb.append("Exile ").append(nNeeded).append(" cards from the top of your library?");
final CardCollectionView list = player.getCardsIn(ZoneType.Library, nNeeded); final CardCollectionView list = player.getCardsIn(ZoneType.Library, nNeeded);
if (list.size() > nNeeded || !player.getController().confirmPayment(cost, "Exile " + Lang.nounWithAmount(nNeeded, "card") + " from the top of your library?")) { if (list.size() > nNeeded || !player.getController().confirmPayment(cost, "Exile " + Lang.nounWithAmount(nNeeded, "card") + " from the top of your library?",ability)) {
return null; return null;
} }
return PaymentDecision.card(list); return PaymentDecision.card(list);
@@ -467,7 +467,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
final CardCollectionView list = player.getCardsIn(ZoneType.Battlefield); final CardCollectionView list = player.getCardsIn(ZoneType.Battlefield);
final CardCollectionView validCards = CardLists.getValidCards(list, cost.getType().split(";"), player, source, ability); final CardCollectionView validCards = CardLists.getValidCards(list, cost.getType().split(";"), player, source, ability);
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, validCards); final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, validCards, ability);
final String desc = cost.getTypeDescription() == null ? cost.getType() : cost.getTypeDescription(); final String desc = cost.getTypeDescription() == null ? cost.getType() : cost.getTypeDescription();
inp.setMessage("Gain control of %d " + desc); inp.setMessage("Gain control of %d " + desc);
inp.showAndWait(); inp.showAndWait();
@@ -530,7 +530,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
} }
if (!player.getController().confirmPayment(cost, String.format("Mill %d card%s from your library?", c, c == 1 ? "" : "s"))) { if (!player.getController().confirmPayment(cost, String.format("Mill %d card%s from your library?", c, c == 1 ? "" : "s"),ability)) {
return null; return null;
} }
return PaymentDecision.card(player.getCardsIn(ZoneType.Library, c)); return PaymentDecision.card(player.getCardsIn(ZoneType.Library, c));
@@ -557,7 +557,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
} }
if (player.canPayLife(c) && player.getController().confirmPayment(cost, "Pay " + c + " Life?")) { if (player.canPayLife(c) && player.getController().confirmPayment(cost, "Pay " + c + " Life?",ability)) {
return PaymentDecision.number(c); return PaymentDecision.number(c);
} }
return null; return null;
@@ -582,7 +582,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
if (player.canPayEnergy(c) && if (player.canPayEnergy(c) &&
player.getController().confirmPayment(cost, cost.toString() + "?\n(You have " + player.getCounters(CounterType.ENERGY) + "{E})")) { player.getController().confirmPayment(cost, cost.toString() + "?\n(You have " + player.getCounters(CounterType.ENERGY) + "{E})",ability)) {
return PaymentDecision.number(c); return PaymentDecision.number(c);
} }
return null; return null;
@@ -613,7 +613,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
player.getCardsIn(cost.getFrom()), cost.getType().split(";"), player, source, ability); player.getCardsIn(cost.getFrom()), cost.getType().split(";"), player, source, ability);
if (cost.from == ZoneType.Hand) { if (cost.from == ZoneType.Hand) {
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, list); final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, list, ability);
inp.setMessage("Put %d card(s) from your " + cost.from); inp.setMessage("Put %d card(s) from your " + cost.from);
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.showAndWait(); inp.showAndWait();
@@ -694,7 +694,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
final CardCollectionView typeList = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), final CardCollectionView typeList = CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield),
cost.getType().split(";"), player, ability.getHostCard(), ability); cost.getType().split(";"), player, ability.getHostCard(), ability);
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, typeList); final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, typeList, ability);
inp.setMessage("Put " + Lang.nounWithAmount(c, cost.getCounter().getName() + " counter") + " on " + cost.getDescriptiveType()); inp.setMessage("Put " + Lang.nounWithAmount(c, cost.getCounter().getName() + " counter") + " on " + cost.getDescriptiveType());
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.showAndWait(); inp.showAndWait();
@@ -724,14 +724,14 @@ public class HumanCostDecision extends CostDecisionMakerBase {
final Card card = ability.getHostCard(); final Card card = ability.getHostCard();
if (card.getController() == player && card.isInPlay()) { if (card.getController() == player && card.isInPlay()) {
final CardView view = CardView.get(card); final CardView view = CardView.get(card);
return player.getController().confirmPayment(cost, "Return " + view + " to hand?") ? PaymentDecision.card(card) : null; return player.getController().confirmPayment(cost, "Return " + view + " to hand?",ability) ? PaymentDecision.card(card) : null;
} }
} }
else { else {
final CardCollectionView validCards = CardLists.getValidCards(ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield), final CardCollectionView validCards = CardLists.getValidCards(ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield),
cost.getType().split(";"), player, source, ability); cost.getType().split(";"), player, source, ability);
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, validCards); final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, validCards, ability);
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.setMessage("Return %d " + cost.getDescriptiveType() + " card(s) to hand"); inp.setMessage("Return %d " + cost.getDescriptiveType() + " card(s) to hand");
inp.showAndWait(); inp.showAndWait();
@@ -772,7 +772,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
if (num == 0) { if (num == 0) {
return PaymentDecision.number(0); return PaymentDecision.number(0);
} }
inp = new InputSelectCardsFromList(controller, num, hand) { inp = new InputSelectCardsFromList(controller, num, hand, ability) {
private static final long serialVersionUID = 8338626212893374798L; private static final long serialVersionUID = 8338626212893374798L;
@Override @Override
@@ -804,7 +804,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
return PaymentDecision.number(0); return PaymentDecision.number(0);
}; };
inp = new InputSelectCardsFromList(controller, num, num, hand); inp = new InputSelectCardsFromList(controller, num, num, hand, ability);
inp.setMessage("Select %d more " + cost.getDescriptiveType() + " card(s) to reveal."); inp.setMessage("Select %d more " + cost.getDescriptiveType() + " card(s) to reveal.");
} }
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
@@ -834,7 +834,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
return card.hasCounters(); return card.hasCounters();
} }
}); });
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, list); final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, list, ability);
inp.setMessage("Select " + cost.getDescriptiveType() + " to remove a counter"); inp.setMessage("Select " + cost.getDescriptiveType() + " to remove a counter");
inp.setCancelAllowed(false); inp.setCancelAllowed(false);
inp.showAndWait(); inp.showAndWait();
@@ -860,11 +860,12 @@ public class HumanCostDecision extends CostDecisionMakerBase {
private final CounterType counterType; private final CounterType counterType;
private final CardCollectionView validChoices; private final CardCollectionView validChoices;
public InputSelectCardToRemoveCounter(final PlayerControllerHuman controller, final int cntCounters, final CounterType cType, final CardCollectionView validCards) { public InputSelectCardToRemoveCounter(final PlayerControllerHuman controller, final int cntCounters, final CounterType cType, final CardCollectionView validCards, final SpellAbility sa) {
super(controller, cntCounters, cntCounters); super(controller, cntCounters, cntCounters);
this.validChoices = validCards; this.validChoices = validCards;
counterType = cType; counterType = cType;
cardsChosen = cntCounters > 0 ? new HashMap<Card, Integer>() : null; cardsChosen = cntCounters > 0 ? new HashMap<Card, Integer>() : null;
this.sa = sa;
} }
@Override @Override
@@ -959,13 +960,12 @@ public class HumanCostDecision extends CostDecisionMakerBase {
if (maxCounters < cntRemoved) { if (maxCounters < cntRemoved) {
return null; return null;
} }
final StringBuilder sb = new StringBuilder("Pay Cost: Remove ");
final StringBuilder sb = new StringBuilder("Remove ");
sb.append(Lang.nounWithNumeral(amount, cost.counter.getName() + " counter")); sb.append(Lang.nounWithNumeral(amount, cost.counter.getName() + " counter"));
sb.append(" from "); sb.append(" from ");
sb.append(source.getName()); sb.append(source.getName());
sb.append("?"); sb.append("?");
if (!player.getController().confirmPayment(cost, sb.toString())) { if (!player.getController().confirmPayment(cost, sb.toString(),ability)) {
return null; return null;
} }
} }
@@ -993,8 +993,8 @@ public class HumanCostDecision extends CostDecisionMakerBase {
return PaymentDecision.card(source, 0); return PaymentDecision.card(source, 0);
} }
final InputSelectCardToRemoveCounter inp = new InputSelectCardToRemoveCounter(controller, cntRemoved, cost.counter, validCards); final InputSelectCardToRemoveCounter inp = new InputSelectCardToRemoveCounter(controller, cntRemoved, cost.counter, validCards, ability);
inp.setMessage("Remove %d " + cost.counter.getName() + " counters from " + cost.getDescriptiveType()); inp.setMessage("Pay Cost: Remove %d " + cost.counter.getName() + " counters from " + cost.getDescriptiveType());
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.showAndWait(); inp.showAndWait();
if (inp.hasCancelled()) { if (inp.hasCancelled()) {
@@ -1039,7 +1039,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
if (cost.payCostFromSource()) { if (cost.payCostFromSource()) {
if (source.getController() == ability.getActivatingPlayer() && source.isInPlay()) { if (source.getController() == ability.getActivatingPlayer() && source.isInPlay()) {
return player.getController().confirmPayment(cost, "Sacrifice " + source.getName() + "?") ? PaymentDecision.card(source) : null; return player.getController().confirmPayment(cost, "Sacrifice " + source.getName() + "?",ability) ? PaymentDecision.card(source) : null;
} }
else { else {
return null; return null;
@@ -1065,7 +1065,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
if (list.size() < c) { if (list.size() < c) {
return null; return null;
} }
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, list); final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, list, ability);
inp.setMessage("Select a " + cost.getDescriptiveType() + " to sacrifice (%d left)"); inp.setMessage("Select a " + cost.getDescriptiveType() + " to sacrifice (%d left)");
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.showAndWait(); inp.showAndWait();
@@ -1141,7 +1141,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
final CardCollection tapped = new CardCollection(); final CardCollection tapped = new CardCollection();
while (c > 0) { while (c > 0) {
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, typeList); final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, typeList, ability);
inp.setMessage("Select one of the cards to tap. Already chosen: " + tapped); inp.setMessage("Select one of the cards to tap. Already chosen: " + tapped);
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.showAndWait(); inp.showAndWait();
@@ -1164,7 +1164,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
if (totalPower) { if (totalPower) {
final int i = Integer.parseInt(totalP); final int i = Integer.parseInt(totalP);
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 0, typeList.size(), typeList); final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 0, typeList.size(), typeList, ability);
inp.setMessage("Select a creature to tap."); inp.setMessage("Select a creature to tap.");
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.showAndWait(); inp.showAndWait();
@@ -1180,7 +1180,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
return null; // not enough targets anymore (e.g. Crackleburr + Smokebraider tapped to get mana) return null; // not enough targets anymore (e.g. Crackleburr + Smokebraider tapped to get mana)
} }
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, typeList); final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, typeList, ability);
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.setMessage("Select a " + cost.getDescriptiveType() + " to tap (%d left)"); inp.setMessage("Select a " + cost.getDescriptiveType() + " to tap (%d left)");
inp.showAndWait(); inp.showAndWait();
@@ -1209,7 +1209,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
c = AbilityUtils.calculateAmount(source, amount, ability); c = AbilityUtils.calculateAmount(source, amount, ability);
} }
} }
final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, typeList); final InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, c, c, typeList, ability);
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.setMessage("Select a " + cost.getDescriptiveType() + " to untap (%d left)"); inp.setMessage("Select a " + cost.getDescriptiveType() + " to untap (%d left)");
inp.showAndWait(); inp.showAndWait();
@@ -1229,7 +1229,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
final Card source = ability.getHostCard(); final Card source = ability.getHostCard();
final Card cardToUnattach = cost.findCardToUnattach(source, player, ability); final Card cardToUnattach = cost.findCardToUnattach(source, player, ability);
if (cardToUnattach != null && player.getController().confirmPayment(cost, "Unattach " + cardToUnattach.getName() + "?")) { if (cardToUnattach != null && player.getController().confirmPayment(cost, "Unattach " + cardToUnattach.getName() + "?",ability)) {
return PaymentDecision.card(cardToUnattach); return PaymentDecision.card(cardToUnattach);
} }
return null; return null;

View File

@@ -282,12 +282,12 @@ public class HumanPlay {
} }
if (parts.isEmpty() || (costPart.getAmount().equals("0") && parts.size() < 2)) { if (parts.isEmpty() || (costPart.getAmount().equals("0") && parts.size() < 2)) {
return p.getController().confirmPayment(costPart, "Do you want to pay {0}?" + orString); return p.getController().confirmPayment(costPart, "Do you want to pay {0}?" + orString, sourceAbility);
} }
// 0 mana costs were slipping through because CostPart.getAmount returns 1 // 0 mana costs were slipping through because CostPart.getAmount returns 1
else if (costPart instanceof CostPartMana && parts.size() < 2) { else if (costPart instanceof CostPartMana && parts.size() < 2) {
if (((CostPartMana) costPart).getManaToPay().isZero()) { if (((CostPartMana) costPart).getManaToPay().isZero()) {
return p.getController().confirmPayment(costPart, "Do you want to pay {0}?" + orString); return p.getController().confirmPayment(costPart, "Do you want to pay {0}?" + orString, sourceAbility);
} }
} }
@@ -304,7 +304,7 @@ public class HumanPlay {
return false; return false;
} }
if (!p.getController().confirmPayment(part, "Do you want to pay " + amount + " life?" + orString)) { if (!p.getController().confirmPayment(part, "Do you want to pay " + amount + " life?" + orString, sourceAbility)) {
return false; return false;
} }
@@ -328,7 +328,7 @@ public class HumanPlay {
sb.append(res.contains(p) ? "" : "let that player "); sb.append(res.contains(p) ? "" : "let that player ");
sb.append("draw " + Lang.nounWithAmount(amount, " card") + "?" + orString); sb.append("draw " + Lang.nounWithAmount(amount, " card") + "?" + orString);
if (!p.getController().confirmPayment(part, sb.toString())) { if (!p.getController().confirmPayment(part, sb.toString(), sourceAbility)) {
return false; return false;
} }
@@ -348,7 +348,7 @@ public class HumanPlay {
String desc = part.toString(); String desc = part.toString();
desc = desc.substring(0, 1).toLowerCase() + desc.substring(1); desc = desc.substring(0, 1).toLowerCase() + desc.substring(1);
if (!p.getController().confirmPayment(part, "Do you want to "+ desc + "?" + orString)) { if (!p.getController().confirmPayment(part, "Do you want to "+ desc + "?" + orString, sourceAbility)) {
return false; return false;
} }
PaymentDecision pd = part.accept(hcd); PaymentDecision pd = part.accept(hcd);
@@ -362,7 +362,7 @@ public class HumanPlay {
final int amount = getAmountFromPart(part, source, sourceAbility); final int amount = getAmountFromPart(part, source, sourceAbility);
final CardCollectionView list = p.getCardsIn(ZoneType.Library); final CardCollectionView list = p.getCardsIn(ZoneType.Library);
if (list.size() < amount) { return false; } if (list.size() < amount) { return false; }
if (!p.getController().confirmPayment(part, "Do you want to mill " + amount + " card" + (amount == 1 ? "" : "s") + "?" + orString)) { if (!p.getController().confirmPayment(part, "Do you want to mill " + amount + " card" + (amount == 1 ? "" : "s") + "?" + orString, sourceAbility)) {
return false; return false;
} }
CardCollectionView listmill = p.getCardsIn(ZoneType.Library, amount); CardCollectionView listmill = p.getCardsIn(ZoneType.Library, amount);
@@ -370,7 +370,7 @@ public class HumanPlay {
} }
else if (part instanceof CostFlipCoin) { else if (part instanceof CostFlipCoin) {
final int amount = getAmountFromPart(part, source, sourceAbility); final int amount = getAmountFromPart(part, source, sourceAbility);
if (!p.getController().confirmPayment(part, "Do you want to flip " + amount + " coin" + (amount == 1 ? "" : "s") + "?" + orString)) { if (!p.getController().confirmPayment(part, "Do you want to flip " + amount + " coin" + (amount == 1 ? "" : "s") + "?" + orString, sourceAbility)) {
return false; return false;
} }
final int n = FlipCoinEffect.getFilpMultiplier(p); final int n = FlipCoinEffect.getFilpMultiplier(p);
@@ -384,7 +384,7 @@ public class HumanPlay {
return false; return false;
} }
if (!p.getController().confirmPayment(part, "Do you want " + source + " to deal " + amount + " damage to you?")) { if (!p.getController().confirmPayment(part, "Do you want " + source + " to deal " + amount + " damage to you?", sourceAbility)) {
return false; return false;
} }
CardDamageMap damageMap = new CardDamageMap(); CardDamageMap damageMap = new CardDamageMap();
@@ -403,7 +403,7 @@ public class HumanPlay {
return false; return false;
} }
if (!p.getController().confirmPayment(part, "Do you want to put " + Lang.nounWithAmount(amount, counterType.getName() + " counter") + " on " + source + "?")) { if (!p.getController().confirmPayment(part, "Do you want to put " + Lang.nounWithAmount(amount, counterType.getName() + " counter") + " on " + source + "?", sourceAbility)) {
return false; return false;
} }
@@ -413,11 +413,11 @@ public class HumanPlay {
CardCollectionView list = p.getGame().getCardsIn(ZoneType.Battlefield); CardCollectionView list = p.getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, part.getType().split(";"), p, source, sourceAbility); list = CardLists.getValidCards(list, part.getType().split(";"), p, source, sourceAbility);
if (list.isEmpty()) { return false; } if (list.isEmpty()) { return false; }
if (!p.getController().confirmPayment(part, "Do you want to put " + Lang.nounWithAmount(amount, counterType.getName() + " counter") + " on " + part.getTypeDescription() + "?")) { if (!p.getController().confirmPayment(part, "Do you want to put " + Lang.nounWithAmount(amount, counterType.getName() + " counter") + " on " + part.getTypeDescription() + "?", sourceAbility)) {
return false; return false;
} }
while (amount > 0) { while (amount > 0) {
InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, list); InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, list, sourceAbility);
inp.setMessage("Select a card to add a counter to"); inp.setMessage("Select a card to add a counter to");
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.showAndWait(); inp.showAndWait();
@@ -474,7 +474,7 @@ public class HumanPlay {
} }
}); });
if (list.isEmpty()) { return false; } if (list.isEmpty()) { return false; }
InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, list); InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, list, sourceAbility);
inp.setMessage("Select a card to remove a counter"); inp.setMessage("Select a card to remove a counter");
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.showAndWait(); inp.showAndWait();
@@ -504,7 +504,7 @@ public class HumanPlay {
final CardCollection exiledList = new CardCollection(); final CardCollection exiledList = new CardCollection();
ZoneType from = ZoneType.Graveyard; ZoneType from = ZoneType.Graveyard;
if ("All".equals(part.getType())) { if ("All".equals(part.getType())) {
if (!p.getController().confirmPayment(part, "Do you want to exile all cards in your graveyard?")) { if (!p.getController().confirmPayment(part, "Do you want to exile all cards in your graveyard?", sourceAbility)) {
return false; return false;
} }
@@ -523,7 +523,7 @@ public class HumanPlay {
} }
if (from == ZoneType.Library) { if (from == ZoneType.Library) {
if (!p.getController().confirmPayment(part, "Do you want to exile " + nNeeded + if (!p.getController().confirmPayment(part, "Do you want to exile " + nNeeded +
" card" + (nNeeded == 1 ? "" : "s") + " from your library?")) { " card" + (nNeeded == 1 ? "" : "s") + " from your library?", sourceAbility)) {
return false; return false;
} }
list = list.subList(0, nNeeded); list = list.subList(0, nNeeded);
@@ -628,7 +628,7 @@ public class HumanPlay {
} }
else if (part instanceof CostDiscard) { else if (part instanceof CostDiscard) {
if ("Hand".equals(part.getType())) { if ("Hand".equals(part.getType())) {
if (!p.getController().confirmPayment(part, "Do you want to discard your hand?")) { if (!p.getController().confirmPayment(part, "Do you want to discard your hand?", sourceAbility)) {
return false; return false;
} }
@@ -715,7 +715,7 @@ public class HumanPlay {
private static boolean payCostPart(final PlayerControllerHuman controller, SpellAbility sourceAbility, CostPartWithList cpl, int amount, CardCollectionView list, String actionName) { private static boolean payCostPart(final PlayerControllerHuman controller, SpellAbility sourceAbility, CostPartWithList cpl, int amount, CardCollectionView list, String actionName) {
if (list.size() < amount) { return false; } // unable to pay (not enough cards) if (list.size() < amount) { return false; } // unable to pay (not enough cards)
InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, amount, amount, list); InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, amount, amount, list, sourceAbility);
inp.setMessage("Select %d " + cpl.getDescriptiveType() + " card(s) to " + actionName); inp.setMessage("Select %d " + cpl.getDescriptiveType() + " card(s) to " + actionName);
inp.setCancelAllowed(true); inp.setCancelAllowed(true);

View File

@@ -330,15 +330,15 @@ public class PlayerControllerHuman
@Override @Override
public CardCollectionView choosePermanentsToSacrifice(final SpellAbility sa, final int min, final int max, final CardCollectionView valid, final String message) { public CardCollectionView choosePermanentsToSacrifice(final SpellAbility sa, final int min, final int max, final CardCollectionView valid, final String message) {
return choosePermanentsTo(min, max, valid, message, "sacrifice"); return choosePermanentsTo(min, max, valid, message, "sacrifice", sa);
} }
@Override @Override
public CardCollectionView choosePermanentsToDestroy(final SpellAbility sa, final int min, final int max, final CardCollectionView valid, final String message) { public CardCollectionView choosePermanentsToDestroy(final SpellAbility sa, final int min, final int max, final CardCollectionView valid, final String message) {
return choosePermanentsTo(min, max, valid, message, "destroy"); return choosePermanentsTo(min, max, valid, message, "destroy", sa);
} }
private CardCollectionView choosePermanentsTo(final int min, int max, final CardCollectionView valid, final String message, final String action) { private CardCollectionView choosePermanentsTo(final int min, int max, final CardCollectionView valid, final String message, final String action, final SpellAbility sa) {
max = Math.min(max, valid.size()); max = Math.min(max, valid.size());
if (max <= 0) { if (max <= 0) {
return CardCollection.EMPTY; return CardCollection.EMPTY;
@@ -350,7 +350,7 @@ public class PlayerControllerHuman
} }
builder.append("%d " + message + "(s) to " + action + "."); builder.append("%d " + message + "(s) to " + action + ".");
final InputSelectCardsFromList inp = new InputSelectCardsFromList(this, min, max, valid); final InputSelectCardsFromList inp = new InputSelectCardsFromList(this, min, max, valid, sa);
inp.setMessage(builder.toString()); inp.setMessage(builder.toString());
inp.setCancelAllowed(min == 0); inp.setCancelAllowed(min == 0);
inp.showAndWait(); inp.showAndWait();
@@ -381,7 +381,7 @@ public class PlayerControllerHuman
} }
if (cardsAreInMyHandOrBattlefield) { if (cardsAreInMyHandOrBattlefield) {
final InputSelectCardsFromList sc = new InputSelectCardsFromList(this, min, max, sourceList); final InputSelectCardsFromList sc = new InputSelectCardsFromList(this, min, max, sourceList, sa);
sc.setMessage(title); sc.setMessage(title);
sc.setCancelAllowed(isOptional); sc.setCancelAllowed(isOptional);
sc.showAndWait(); sc.showAndWait();
@@ -430,7 +430,7 @@ public class PlayerControllerHuman
if (delayedReveal != null) { if (delayedReveal != null) {
reveal(delayedReveal.getCards(), delayedReveal.getZone(), delayedReveal.getOwner(), delayedReveal.getMessagePrefix()); reveal(delayedReveal.getCards(), delayedReveal.getZone(), delayedReveal.getOwner(), delayedReveal.getMessagePrefix());
} }
final InputSelectEntitiesFromList<T> input = new InputSelectEntitiesFromList<T>(this, isOptional ? 0 : 1, 1, optionList); final InputSelectEntitiesFromList<T> input = new InputSelectEntitiesFromList<T>(this, isOptional ? 0 : 1, 1, optionList, sa);
input.setCancelAllowed(isOptional); input.setCancelAllowed(isOptional);
input.setMessage(MessageUtil.formatMessage(title, player, targetedPlayer)); input.setMessage(MessageUtil.formatMessage(title, player, targetedPlayer));
input.showAndWait(); input.showAndWait();
@@ -516,8 +516,8 @@ public class PlayerControllerHuman
return true; return true;
} }
final StringBuilder buildQuestion = new StringBuilder("Use triggered ability of "); final StringBuilder buildQuestion = new StringBuilder("<b>Use triggered ability of ");
buildQuestion.append(regtrig.getHostCard().toString()).append("?"); buildQuestion.append(regtrig.getHostCard().toString()).append("?</b>");
if (!FModel.getPreferences().getPrefBoolean(FPref.UI_COMPACT_PROMPT)) { if (!FModel.getPreferences().getPrefBoolean(FPref.UI_COMPACT_PROMPT)) {
//append trigger description unless prompt is compact //append trigger description unless prompt is compact
buildQuestion.append("\n("); buildQuestion.append("\n(");
@@ -536,7 +536,8 @@ public class PlayerControllerHuman
} }
} }
final InputConfirm inp = new InputConfirm(this, buildQuestion.toString()); // 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(),sa);
inp.showAndWait(); inp.showAndWait();
return inp.getResult(); return inp.getResult();
} }
@@ -546,7 +547,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"); final InputConfirm inp = new InputConfirm(this, prompt, "Play", "Draw", null);
inp.showAndWait(); inp.showAndWait();
return inp.getResult() ? this.player : this.player.getOpponents().get(0); return inp.getResult() ? this.player : this.player.getOpponents().get(0);
} }
@@ -688,7 +689,7 @@ public class PlayerControllerHuman
return choices; return choices;
} }
final InputSelectCardsFromList inp = new InputSelectCardsFromList(this, min, max, valid); final InputSelectCardsFromList inp = new InputSelectCardsFromList(this, min, max, valid, sa);
inp.setMessage(sa.hasParam("AnyNumber") ? "Discard up to %d card(s)" : "Discard %d card(s)"); inp.setMessage(sa.hasParam("AnyNumber") ? "Discard up to %d card(s)" : "Discard %d card(s)");
inp.showAndWait(); inp.showAndWait();
return new CardCollection(inp.getSelected()); return new CardCollection(inp.getSelected());
@@ -749,7 +750,7 @@ public class PlayerControllerHuman
*/ */
@Override @Override
public CardCollectionView chooseCardsToDiscardUnlessType(final int num, final CardCollectionView hand, final String uType, final SpellAbility sa) { public CardCollectionView chooseCardsToDiscardUnlessType(final int num, final CardCollectionView hand, final String uType, final SpellAbility sa) {
final InputSelectEntitiesFromList<Card> target = new InputSelectEntitiesFromList<Card>(this, num, num, hand) { final InputSelectEntitiesFromList<Card> target = new InputSelectEntitiesFromList<Card>(this, num, num, hand, sa) {
private static final long serialVersionUID = -5774108410928795591L; private static final long serialVersionUID = -5774108410928795591L;
@Override @Override
@@ -1158,8 +1159,8 @@ public class PlayerControllerHuman
} }
@Override @Override
public boolean confirmPayment(final CostPart costPart, final String question) { public boolean confirmPayment(final CostPart costPart, final String question, SpellAbility sa) {
final InputConfirm inp = new InputConfirm(this, question); final InputConfirm inp = new InputConfirm(this, question, sa);
inp.showAndWait(); inp.showAndWait();
return inp.getResult(); return inp.getResult();
} }
@@ -1264,8 +1265,8 @@ public class PlayerControllerHuman
} }
@Override @Override
public Map<GameEntity, CounterType> chooseProliferation() { public Map<GameEntity, CounterType> chooseProliferation(final SpellAbility sa) {
final InputProliferate inp = new InputProliferate(this); final InputProliferate inp = new InputProliferate(this,sa);
inp.setCancelAllowed(true); inp.setCancelAllowed(true);
inp.showAndWait(); inp.showAndWait();
if (inp.hasCancelled()) { if (inp.hasCancelled()) {
@@ -1358,7 +1359,7 @@ public class PlayerControllerHuman
@Override @Override
public Map<Card, ManaCostShard> chooseCardsForConvokeOrImprovise(final SpellAbility sa, final ManaCost manaCost, final CardCollectionView untappedCards, boolean improvise) { public Map<Card, ManaCostShard> chooseCardsForConvokeOrImprovise(final SpellAbility sa, final ManaCost manaCost, final CardCollectionView untappedCards, boolean improvise) {
final InputSelectCardsForConvokeOrImprovise inp = new InputSelectCardsForConvokeOrImprovise(this, player, manaCost, untappedCards, improvise); final InputSelectCardsForConvokeOrImprovise inp = new InputSelectCardsForConvokeOrImprovise(this, player, manaCost, untappedCards, improvise, sa);
inp.showAndWait(); inp.showAndWait();
return inp.getConvokeMap(); return inp.getConvokeMap();
} }