mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Always allow unselecting cards for InputSelectManyBase
This commit is contained in:
@@ -17,10 +17,8 @@ public final class InputProliferate extends InputSelectManyBase<GameEntity> {
|
|||||||
|
|
||||||
public InputProliferate() {
|
public InputProliferate() {
|
||||||
super(1, Integer.MAX_VALUE);
|
super(1, Integer.MAX_VALUE);
|
||||||
allowUnselect = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected String getMessage() {
|
protected String getMessage() {
|
||||||
StringBuilder sb = new StringBuilder("Choose permanents and/or players with counters on them to add one more counter of that type.");
|
StringBuilder sb = new StringBuilder("Choose permanents and/or players with counters on them to add one more counter of that type.");
|
||||||
sb.append("\n\nYou've selected so far:\n");
|
sb.append("\n\nYou've selected so far:\n");
|
||||||
|
|||||||
@@ -28,11 +28,9 @@ public final class InputSelectCardsForConvoke extends InputSelectManyBase<Card>
|
|||||||
super(0, Math.min(cost.getCMC(), untapped.size()));
|
super(0, Math.min(cost.getCMC(), untapped.size()));
|
||||||
remainingCost = new ManaCostBeingPaid(cost);
|
remainingCost = new ManaCostBeingPaid(cost);
|
||||||
player = p;
|
player = p;
|
||||||
allowUnselect = true;
|
|
||||||
availableCreatures = untapped;
|
availableCreatures = untapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected String getMessage() {
|
protected String getMessage() {
|
||||||
return "Choose creatures to tap for convoke.\nRemaining mana cost is " + remainingCost.toString();
|
return "Choose creatures to tap for convoke.\nRemaining mana cost is " + remainingCost.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,8 +53,6 @@ public class InputSelectEntitiesFromList<T extends GameEntity> extends InputSele
|
|||||||
|
|
||||||
boolean entityWasSelected = selected.contains(c);
|
boolean entityWasSelected = selected.contains(c);
|
||||||
if (entityWasSelected) {
|
if (entityWasSelected) {
|
||||||
if (!allowUnselect)
|
|
||||||
return false;
|
|
||||||
this.selected.remove(c);
|
this.selected.remove(c);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ public abstract class InputSelectManyBase<T extends GameEntity> extends InputSyn
|
|||||||
protected boolean bCancelled = false;
|
protected boolean bCancelled = false;
|
||||||
protected final int min;
|
protected final int min;
|
||||||
protected final int max;
|
protected final int max;
|
||||||
protected boolean allowUnselect = false;
|
|
||||||
protected boolean allowCancel = false;
|
protected boolean allowCancel = false;
|
||||||
|
|
||||||
protected String message = "Source-Card-Name - Select %d more card(s)";
|
protected String message = "Source-Card-Name - Select %d more card(s)";
|
||||||
@@ -86,8 +85,5 @@ public abstract class InputSelectManyBase<T extends GameEntity> extends InputSyn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isUnselectAllowed() { return allowUnselect; }
|
|
||||||
public final void setUnselectAllowed(boolean allow) { this.allowUnselect = allow; }
|
|
||||||
|
|
||||||
public final void setCancelAllowed(boolean allow) { this.allowCancel = allow ; }
|
public final void setCancelAllowed(boolean allow) { this.allowCancel = allow ; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -824,7 +824,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int tc = getTimesSelected(c);
|
int tc = getTimesSelected(c);
|
||||||
cardsChosen.put(c, tc+1);
|
cardsChosen.put(c, tc + 1);
|
||||||
|
|
||||||
onSelectStateChanged(c, true);
|
onSelectStateChanged(c, true);
|
||||||
refresh();
|
refresh();
|
||||||
@@ -1074,7 +1074,6 @@ public class HumanCostDecision extends CostDecisionMakerBase {
|
|||||||
int i = Integer.parseInt(totalP);
|
int i = Integer.parseInt(totalP);
|
||||||
InputSelectCardsFromList inp = new InputSelectCardsFromList(0, typeList.size(), typeList);
|
InputSelectCardsFromList inp = new InputSelectCardsFromList(0, typeList.size(), typeList);
|
||||||
inp.setMessage("Select a card to tap.");
|
inp.setMessage("Select a card to tap.");
|
||||||
inp.setUnselectAllowed(true);
|
|
||||||
inp.setCancelAllowed(true);
|
inp.setCancelAllowed(true);
|
||||||
inp.showAndWait();
|
inp.showAndWait();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user