aboutsummaryrefslogtreecommitdiff
path: root/internal/game/sys_safespot.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/sys_safespot.go')
-rw-r--r--internal/game/sys_safespot.go20
1 files changed, 13 insertions, 7 deletions
diff --git a/internal/game/sys_safespot.go b/internal/game/sys_safespot.go
index cdb954b..41fe19f 100644
--- a/internal/game/sys_safespot.go
+++ b/internal/game/sys_safespot.go
@@ -50,7 +50,11 @@ func (g *Game) safespotBlocksHazard(p *player.Player) bool {
return g.isSafespotted(p.Name)
}
-func (g *Game) safespotBlocksMob(p *player.Player, mob *world.MobInstance) bool {
+// safespotBlocksMelee reports whether the player's active safespot shields them
+// from this mob's melee attacks (based on cover size vs mob size). It does NOT
+// consider the mob's attack types — a mob whose melee is blocked may still be
+// able to attack with ranged/science (see effectiveMobAttackType).
+func (g *Game) safespotBlocksMelee(p *player.Player, mob *world.MobInstance) bool {
ss, ok := g.safespot.Get(p.Name)
if !ok || !ss.Active || ss.HideCountdown > 0 {
return false
@@ -61,15 +65,17 @@ func (g *Game) safespotBlocksMob(p *player.Player, mob *world.MobInstance) bool
return false
}
- if !blocksMob(objDef.Safespot.MaxBlockSize, mob.Size) {
- return false
- }
+ return blocksMob(objDef.Safespot.MaxBlockSize, mob.Size)
+}
- if mob.AttackType == "ranged" || mob.AttackType == "science" {
+// safespotBlocksMob reports whether the player's active safespot fully prevents
+// this mob from attacking at all. This is true only when the safespot blocks the
+// mob's melee AND the mob has no ranged/science attack type to switch to.
+func (g *Game) safespotBlocksMob(p *player.Player, mob *world.MobInstance) bool {
+ if !g.safespotBlocksMelee(p, mob) {
return false
}
-
- return true
+ return mobStrongestRangedScience(mob) == ""
}
func (g *Game) sessionInRoom(name string, roomSessions []*net.Session) *net.Session {