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.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/game/combat_attack.go b/internal/game/combat_attack.go
index 80994e1..1e53510 100644
--- a/internal/game/combat_attack.go
+++ b/internal/game/combat_attack.go
@@ -194,6 +194,10 @@ func (g *Game) startCombat(sess *net.Session, p *player.Player, mob *world.MobIn
}
g.SubscribeTicks(1, func() bool {
+ if !g.sessionRegistered(sess, p.Name) {
+ g.Combat.Leave(p.Name)
+ return false
+ }
cs := g.Combat.Get(p.Name)
if cs == nil || !cs.Active {
return false
@@ -256,6 +260,10 @@ func (g *Game) startCombat(sess *net.Session, p *player.Player, mob *world.MobIn
if !isTask {
g.SubscribeTicks(engine.ToTicks(mob.Speed), func() bool {
+ if !g.sessionRegistered(sess, p.Name) {
+ g.Combat.Leave(p.Name)
+ return false
+ }
cs := g.Combat.Get(p.Name)
if cs == nil || !cs.Active {
return false
@@ -354,6 +362,15 @@ func (g *Game) playerAttackUnarmed(sess *net.Session, p *player.Player, mob *wor
return
}
+ // Unarmed is a melee crush attack, so it must leave cover exactly like
+ // every other melee attack: otherwise a safespotted player can punch a
+ // melee-only mob that cannot retaliate.
+ if g.isSafespotted(p.Name) {
+ if ss, ok := g.safespot.Get(p.Name); ok {
+ g.forceLeaveSafespot(sess, p, &ss, "You leave your cover to close in for melee!")
+ }
+ }
+
_, _, attRoll, defRoll, maxHit := g.calculateUnarmedAttackRoll(p, mob)
if combat.HitCheck(attRoll, defRoll) {