feat(abilities): add Power Attack active feat (-X atk / +2X dmg, melee only)

Power Attack is the first active feat: a free-action toggle declared at
turn start. When state.power_attack is True and the combatant has the
POWER_ATTACK feature, melee attacks apply -X to the attack roll and
+2X to damage, where X = BAB//4 + 1 (min 1). Ranged attacks are
unaffected. The flag is cleared at the start of each turn via
_take_turn, like other per-turn state.

- abilities.py: POWER_ATTACK constant (AbilitySpec, no passive effects)
- combat.py: _has_feat helper, _power_attack_amt, resolve_attack
  applies penalty to attack total + crit confirm, bonus to damage
- tests/test_power_attack.py: 14 tests (amount at BAB 1/4/8/12, flag
  false, feat missing, attack penalty, damage bonus, ranged unaffected,
  flag cleared on turn)
- pyproject.toml: add SLF001 + RUF059 to test per-file-ignores (white-box
  testing accesses private helpers, partial tuple unpacking)
- README.md: document Power Attack in abilities.py section, 307 tests
This commit is contained in:
2026-08-17 22:49:50 +02:00
parent ba1c3c2117
commit 97c0431479
5 changed files with 266 additions and 8 deletions
+5 -3
View File
@@ -379,9 +379,11 @@ dans la résolution) :
à `resolve_attack` (attaque, dégâts, CA) et `resolve_save` (jets de
sauvegarde) via `_stat_modifiers` qui collecte effets + conditions.
- `abilities.py` — dons et capacités : `AbilitySpec` (dataclass avec
catégorie feat/class/racial/trait) et dons passifs prédéfinis (Weapon Focus,
catégorie feat/class/racial/trait), dons passifs prédéfinis (Weapon Focus,
Toughness, Iron Will, Great Fortitude, Lightning Reflexes, Alertness,
Point-Blank Shot, Dodge). Les modificateurs sont collectés par
Point-Blank Shot, Dodge) et don actif Power Attack (X attaque / +2X dégâts,
X = BAB//4 + 1, mêlée uniquement, declared as free action at turn start via
`state.power_attack`). Les modificateurs sont collectés par
`_stat_modifiers` avec filtrage par arme (`weapon_filter`). Le champ
`features` de `Combatant` contient les aptitudes permanentes.
- `metrics.py` — statistiques en forme fermée : `win_rate`, `win_rate_sigma`,
@@ -399,7 +401,7 @@ dans la résolution) :
La gate de validation complète (tests + lint + types) :
```bash
uv run pytest -q # 293 tests
uv run pytest -q # 307 tests
uv run ruff check src tests
uv run basedpyright src # mode strict
```