mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Prevent adding cards in DualListBox using spacebar if add button disabled
Prevent selecting cards to discard with Abandon Hope if 0 cards should have been allowed
This commit is contained in:
@@ -491,8 +491,8 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
@Override
|
@Override
|
||||||
public List<Card> chooseCardsToDiscardFrom(Player p, SpellAbility sa, List<Card> valid, int min, int max) {
|
public List<Card> chooseCardsToDiscardFrom(Player p, SpellAbility sa, List<Card> valid, int min, int max) {
|
||||||
if (p != player) {
|
if (p != player) {
|
||||||
int cntToKeepInHand = min == 0 ? -1 : valid.size() - min;
|
return GuiChoose.order("Choose " + min + " card" + (min != 1 ? "s" : "") + " to discard",
|
||||||
return GuiChoose.order("Choose cards to Discard", "Discarded", cntToKeepInHand, valid, null, null);
|
"Discarded", valid.size() - min, valid, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
InputSelectCards inp = new InputSelectCardsFromList(min, max, valid);
|
InputSelectCards inp = new InputSelectCardsFromList(min, max, valid);
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ public class DualListBox<T> extends FPanel {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!addButton.isEnabled()) { return; }
|
||||||
|
|
||||||
List<T> selected = new ArrayList<T>();
|
List<T> selected = new ArrayList<T>();
|
||||||
for (Object item : sourceList.getSelectedValuesList()) {
|
for (Object item : sourceList.getSelectedValuesList()) {
|
||||||
selected.add((T)item);
|
selected.add((T)item);
|
||||||
@@ -99,6 +101,8 @@ public class DualListBox<T> extends FPanel {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (!removeButton.isEnabled()) { return; }
|
||||||
|
|
||||||
List<T> selected = new ArrayList<T>();
|
List<T> selected = new ArrayList<T>();
|
||||||
for (Object item : destList.getSelectedValuesList()) {
|
for (Object item : destList.getSelectedValuesList()) {
|
||||||
selected.add((T)item);
|
selected.add((T)item);
|
||||||
|
|||||||
Reference in New Issue
Block a user