aboutsummaryrefslogtreecommitdiff
path: root/internal/game/sys_safespot.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-01 22:30:31 -0400
committerhistoria <[not public]>2026-07-01 22:30:31 -0400
commitc14c2e403c75a913e1a6d962fb6fe64f013adae5 (patch)
tree75070293fe2535b594ac72e501cbf08a3f1146e0 /internal/game/sys_safespot.go
parent8eec7b75ff9c8c368b252373db45fb891732d2ca (diff)
downloadthehouseoficarus-c14c2e403c75a913e1a6d962fb6fe64f013adae5.tar.gz
fix: combat formulas and mob attack types (mobs switch attack styles if safespotting)
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 {