mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +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
|
||||
public List<Card> chooseCardsToDiscardFrom(Player p, SpellAbility sa, List<Card> valid, int min, int max) {
|
||||
if (p != player) {
|
||||
int cntToKeepInHand = min == 0 ? -1 : valid.size() - min;
|
||||
return GuiChoose.order("Choose cards to Discard", "Discarded", cntToKeepInHand, valid, null, null);
|
||||
return GuiChoose.order("Choose " + min + " card" + (min != 1 ? "s" : "") + " to discard",
|
||||
"Discarded", valid.size() - min, valid, null, null);
|
||||
}
|
||||
|
||||
InputSelectCards inp = new InputSelectCardsFromList(min, max, valid);
|
||||
|
||||
@@ -84,6 +84,8 @@ public class DualListBox<T> extends FPanel {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void run() {
|
||||
if (!addButton.isEnabled()) { return; }
|
||||
|
||||
List<T> selected = new ArrayList<T>();
|
||||
for (Object item : sourceList.getSelectedValuesList()) {
|
||||
selected.add((T)item);
|
||||
@@ -99,6 +101,8 @@ public class DualListBox<T> extends FPanel {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void run() {
|
||||
if (!removeButton.isEnabled()) { return; }
|
||||
|
||||
List<T> selected = new ArrayList<T>();
|
||||
for (Object item : destList.getSelectedValuesList()) {
|
||||
selected.add((T)item);
|
||||
|
||||
Reference in New Issue
Block a user