aboutsummaryrefslogtreecommitdiff
path: root/internal/combat/state.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.go
parent90ad8c0c33b519d5830c69d4128bdc984b5e9de8 (diff)
downloadthehouseoficarus-e42952469dadfb3535633c66c881050ac128703c.tar.gz
fix: gather verbs, walk oom, admin path bypass, roulette refund
Diffstat (limited to 'internal/combat/state.go')
-rw-r--r--internal/combat/state.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/combat/state.go b/internal/combat/state.go
index 8e4c68d..e1ee8e7 100644
--- a/internal/combat/state.go
+++ b/internal/combat/state.go
@@ -27,10 +27,15 @@ func NewTracker() *Tracker {
}
}
-// Enter records that playerName is now fighting mobID.
+// Enter records that playerName is now fighting mobID. If the player was
+// already fighting, the previous mob is released so it does not stay marked
+// "in combat" forever (which would block every other player from attacking it).
func (t *Tracker) Enter(playerName, mobID string) {
t.mu.Lock()
defer t.mu.Unlock()
+ if prev, ok := t.combatants[playerName]; ok {
+ delete(t.mobTargets, prev.MobID)
+ }
t.combatants[playerName] = &State{
PlayerName: playerName,
MobID: mobID,