aboutsummaryrefslogtreecommitdiff
path: root/internal/game/combat_attack.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/combat_attack.go')
-rw-r--r--internal/game/combat_attack.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/game/combat_attack.go b/internal/game/combat_attack.go
index 1e53510..180038b 100644
--- a/internal/game/combat_attack.go
+++ b/internal/game/combat_attack.go
@@ -135,6 +135,14 @@ func (g *Game) findMob(sess *net.Session, input string, roomID int) *world.MobIn
}
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
+ // guard a second pair of combat subscribers is registered and both the
+ // player and the mob attack twice per tick.
+ if g.Combat.Get(p.Name) != nil {
+ sess.WriteLine("You are already in combat!")
+ return
+ }
if mob.OwnerOnly && mob.Owner != "" && mob.Owner != p.Name {
sess.WriteLine("They don't seem interested in you.")
return