aboutsummaryrefslogtreecommitdiff
path: root/internal/combat/state_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-05 17:05:14 -0400
committerhistoria <[not public]>2026-10-05 17:05:14 -0400
commite42952469dadfb3535633c66c881050ac128703c (patch)
treea78f7396b72cdbd6fa4f6c454c830f40cf2ad0cb /internal/combat/state_test.go
parent90ad8c0c33b519d5830c69d4128bdc984b5e9de8 (diff)
downloadthehouseoficarus-e42952469dadfb3535633c66c881050ac128703c.tar.gz
fix: gather verbs, walk oom, admin path bypass, roulette refund
Diffstat (limited to 'internal/combat/state_test.go')
-rw-r--r--internal/combat/state_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/combat/state_test.go b/internal/combat/state_test.go
new file mode 100644
index 0000000..8005ba3
--- /dev/null
+++ b/internal/combat/state_test.go
@@ -0,0 +1,21 @@
+package combat
+
+import "testing"
+
+// Regression: re-entering combat must release the previous mob, or that mob
+// stays "in combat" forever and no other player can attack it.
+func TestTrackerEnterReleasesPreviousMob(t *testing.T) {
+ tr := NewTracker()
+ tr.Enter("alice", "mobA")
+ tr.Enter("alice", "mobB")
+ if tr.IsMobInCombat("mobA") {
+ t.Fatal("mobA still marked in combat after alice switched targets")
+ }
+ if !tr.IsMobInCombat("mobB") {
+ t.Fatal("mobB not marked in combat")
+ }
+ tr.Leave("alice")
+ if tr.IsMobInCombat("mobB") {
+ t.Fatal("mobB still marked in combat after leave")
+ }
+}