fix(rules): use the attacker's best corner for cover bonus

SRD 'Cover': 'To determine whether your target has cover from your ranged attack, choose a corner of your square.' The ranged scorer in cover_bonus_cells took the MAX over all attacker corners (worst corner); the cover gate has_cover_cells and RAW use the attacker's best corner. Ranged cells are now scored min over attacker corners of (max over target-corner lines), then min over attacker cells - the bonus can no longer exceed what the gate admits. Melee keeps the worst-corner rule ('any line from ANY corner of your square'). Updated the two pins that locked the old worst-corner scores.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-09-12 14:57:56 +02:00
parent a989266747
commit 5bf2850e2f
3 changed files with 45 additions and 25 deletions
+16 -8
View File
@@ -293,10 +293,16 @@ def cover_bonus_cells(
)
# PF1e CRB "Cover", rule of corners: the attacker chooses the corner (and,
# for a multi-square creature, the occupied square) that gives it the best
# shot, so it suffers only the MINIMUM cover over its own cells. The
# target side follows the same choice rule: RAW checks ANY line to ANY
# corner of the (chosen) square, scored by the MAXIMUM over corner lines —
# union over all target cells for ranged, best single cell for melee.
# shot, so it suffers only the MINIMUM cover over its own cells. Ranged:
# "choose a corner of your square. If any line from this corner to any
# corner of the target's square passes through cover, the target has
# cover" — each attacker corner is scored by the MAXIMUM over the target's
# corner lines (union over all target cells), and the attacker picks its
# BEST corner: MIN over attacker corners. Melee: the attacker may also
# pick any single square of a multi-square target (CRB "Big Creatures and
# Cover"), so the target side is a MIN over cells; the attacker side
# stays the worst-corner rule ("any line from ANY corner of your
# square").
per_cell_best = (
min(
max(
@@ -307,11 +313,13 @@ def cover_bonus_cells(
for cell_t in target_cells
)
if not ranged
else max(
lines.bonus(corner_a, corner_t)
else min(
max(
lines.bonus(corner_a, corner_t)
for cell_t in target_cells
for corner_t in _corners(cell_t)
)
for corner_a in _corners(cell_a)
for cell_t in target_cells
for corner_t in _corners(cell_t)
)
for cell_a in attacker_cells
)