fix(rules): firing into melee exemption measured target-to-nearest-ally, not attacker-to-target (SRD Shooting into a Melee)

This commit is contained in:
2026-09-16 21:24:48 +02:00
parent e6f7b1988b
commit e0bf484394
3 changed files with 53 additions and 18 deletions
+22 -13
View File
@@ -3056,18 +3056,22 @@ class CombatEngine:
self, attacker: CombatantState, target: CombatantState
) -> int:
"""PF1e firing into melee: -4 on a ranged attack whose target is
engaged in melee, avoided entirely (0) when the target or every
threatening opponent stands 10+ ft from the attacker. Precise Shot
removes it.
engaged in melee, avoided entirely (0) when the target stands 10+ ft
from every friendly character of the attacker. Precise Shot removes
it.
PF1e (SRD "Attack" — Shooting or Throwing into a Melee): "If your
target (or the part of your target you're aiming at, if it's a big
target) is at least 10 feet away from the nearest friendly character,
you can avoid the -4 penalty" — the 10+ ft clause is therefore 0, not
-2. The -2 applies only when the target is two size categories larger
than the friendly characters it is engaged with (and 0 at three or
more): size-category reduction is NOT modeled (documented
simplification).
you can avoid the -4 penalty" — the exemption is measured from the
TARGET to the attacker's nearest friendly character (a creature on
the attacker's side other than the attacker), NOT from the attacker's
own position; an archer 30 ft away still takes the -4 when the target
is locked in melee with one of the archer's allies at 5 ft. The 10+
ft clause is therefore 0, not -2. The -2 applies only when the target
is two size categories larger than the friendly characters it is
engaged with (and 0 at three or more): size-category reduction is
NOT modeled (documented simplification).
The target is engaged when an active enemy of the target (not the
attacker itself) threatens the target's occupied cells with a melee
@@ -3085,12 +3089,17 @@ class CombatEngine:
]
if not threats:
return 0
if self.creature_distance(attacker, target) * _SQUARE_FT >= _FIRING_MELEE_SAFE_FT:
allies = [
s
for s in self._states
if s is not attacker and s.active and s.side == attacker.side
]
if all(
self.creature_distance(target, ally) * _SQUARE_FT
>= _FIRING_MELEE_SAFE_FT
for ally in allies
):
return 0
for threat in threats:
dist = self.creature_distance(attacker, threat) * _SQUARE_FT
if dist >= _FIRING_MELEE_SAFE_FT:
return 0
return _FIRING_MELEE_PENALTY
def _engaged_in_melee(self, state: CombatantState) -> bool: