aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--go/game/targets.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/go/game/targets.go b/go/game/targets.go
index 1be206e7..bcb47d50 100644
--- a/go/game/targets.go
+++ b/go/game/targets.go
@@ -202,9 +202,11 @@ func (t *Target) AddSelection(sel any) (err error) {
return
}
-func (t *Target) RequireSelection() bool { return len(t.sel) < t.requirement.min }
-func (t *Target) HasSelection() bool { return len(t.sel) > 0 }
-func (t *Target) AllowSelection() bool { return len(t.sel) < t.requirement.max }
+func (t *Target) RequireSelection() bool { return len(t.sel) < t.requirement.min }
+func (t *Target) HasSelection() bool { return len(t.sel) > 0 }
+func (t *Target) AllowSelection() bool {
+ return (t.requirement.max == -1 || len(t.sel) < t.requirement.max) && len(t.Options()) > 0
+}
func (t *Target) ClearSelection() { t.sel = []interface{}{} }
func (t *Target) NoSelection() bool { return len(t.sel) == 0 }
func (t *Target) Selection() []interface{} { return t.sel }