aboutsummaryrefslogtreecommitdiff
path: root/internal/combat/state.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-06 12:57:23 -0400
committerhistoria <[not public]>2026-10-06 12:57:23 -0400
commit9666676766bf21364f4fc4d0d1d336e72f2a91b4 (patch)
tree0cade34091d7602790dc38cd44053f0b74bbadf2 /internal/combat/state.go
parent4bc1daaf259e0c19c5fe4a12ec8bc7f6e5a735c1 (diff)
downloadthehouseoficarus-9666676766bf21364f4fc4d0d1d336e72f2a91b4.tar.gz
refactor: split casino.go, dedup helpers, remove audit docs
Diffstat (limited to 'internal/combat/state.go')
-rw-r--r--internal/combat/state.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/combat/state.go b/internal/combat/state.go
index e1ee8e7..17a9c09 100644
--- a/internal/combat/state.go
+++ b/internal/combat/state.go
@@ -36,6 +36,13 @@ func (t *Tracker) Enter(playerName, mobID string) {
if prev, ok := t.combatants[playerName]; ok {
delete(t.mobTargets, prev.MobID)
}
+ // If another player already holds this mob, replacing the mobTargets
+ // entry would leave their combatants entry pointing at a mob this new
+ // player now owns. Clear it so their later Leave cannot delete this
+ // player's claim and unlock a mob that is still being fought.
+ if prevOwner, ok := t.mobTargets[mobID]; ok && prevOwner != playerName {
+ delete(t.combatants, prevOwner)
+ }
t.combatants[playerName] = &State{
PlayerName: playerName,
MobID: mobID,