From 9666676766bf21364f4fc4d0d1d336e72f2a91b4 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 6 Oct 2026 12:57:23 -0400 Subject: refactor: split casino.go, dedup helpers, remove audit docs --- internal/game/combat_attack.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'internal/game/combat_attack.go') diff --git a/internal/game/combat_attack.go b/internal/game/combat_attack.go index 180038b..3cbb9c8 100644 --- a/internal/game/combat_attack.go +++ b/internal/game/combat_attack.go @@ -116,6 +116,7 @@ func (g *Game) findMob(sess *net.Session, input string, roomID int) *world.MobIn if idx-1 < len(candidates) { return candidates[idx-1] } + sess.WriteLine(fmt.Sprintf("There's no '%s' here.", input)) return nil } @@ -134,6 +135,14 @@ func (g *Game) findMob(sess *net.Session, input string, roomID int) *world.MobIn return candidates[0] } +// leaveCombat ends the player's combat and clears any stashed flee state. +// Combat.Leave alone leaves EscapeDir/Target/IsWalk set with no move in flight, +// so the next mob miss would start an unprompted escape in the stale direction. +func (g *Game) leaveCombat(p *player.Player) { + g.Combat.Leave(p.Name) + p.ClearEscape() +} + func (g *Game) startCombat(sess *net.Session, p *player.Player, mob *world.MobInstance) { // One player fights one mob at a time. doAttack and the aggro path already // check this, but act_steal/act_talk call startCombat directly; without the @@ -447,7 +456,7 @@ func (g *Game) applyPlayerHit(sess *net.Session, p *player.Player, mob *world.Mo if isRanged && p.AmmoQty <= 0 { sess.WriteLine("You've run out of ammo!") - g.Combat.Leave(p.Name) + g.leaveCombat(p) } } @@ -458,7 +467,7 @@ func (g *Game) applyPlayerMiss(sess *net.Session, p *player.Player, mob *world.M g.consumeAmmo(p) if p.AmmoQty <= 0 { sess.WriteLine("You've run out of ammo!") - g.Combat.Leave(p.Name) + g.leaveCombat(p) } } } -- cgit v1.2.3