diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-09-08 22:32:49 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-09-08 22:32:49 +0200 |
| commit | 2863f09e46ba923daea3761a8b0342dc38029530 (patch) | |
| tree | dfe96548974b5c581b8bb1a08bacf2026dcde6d6 | |
| parent | ddd9cc924977201f7d2bc162c0d5fe4f86841ef1 (diff) | |
| download | muhqs-game-2863f09e46ba923daea3761a8b0342dc38029530.tar.gz muhqs-game-2863f09e46ba923daea3761a8b0342dc38029530.zip | |
fix target options not considering declared actions
| -rw-r--r-- | go/game/targets.go | 4 | ||||
| -rw-r--r-- | go/game/targets_test.go | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/go/game/targets.go b/go/game/targets.go index 92fc6104..ba676677 100644 --- a/go/game/targets.go +++ b/go/game/targets.go @@ -948,5 +948,9 @@ func (t *Target) candidates() []any { c = append(c, utils.TypedSliceToInterfaceSlice(cards.Cards())...) } + if strings.Contains(t.desc, "declared") { + c = append(c, utils.TypedSliceToInterfaceSlice(t.s.stack.Actions)...) + } + return c } diff --git a/go/game/targets_test.go b/go/game/targets_test.go index 134eef5f..ea511cf8 100644 --- a/go/game/targets_test.go +++ b/go/game/targets_test.go @@ -286,6 +286,10 @@ func TestSpellConstraint(t *testing.T) { desc = newTargetDesc("declared spell") target = newTarget(s, desc, NewPassPriority(p)) + if !utils.InterfaceSliceContains(target.Options(), declaredSpell) { + t.Fatal("options does not contain the declared spell") + } + if err := target.AddSelection(declaredSpell); err != nil { t.Fatal("failed to target spell:", err) } |
