97c0431479
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
64 lines
2.2 KiB
TOML
64 lines
2.2 KiB
TOML
[project]
|
||
name = "pf1e-simulator"
|
||
version = "0.1.0"
|
||
requires-python = ">=3.12"
|
||
dependencies = [
|
||
"pydantic>=2",
|
||
"pyyaml",
|
||
]
|
||
|
||
[project.scripts]
|
||
pf1e-sim = "pf1e_simulator.cli:main"
|
||
|
||
[build-system]
|
||
requires = ["hatchling"]
|
||
build-backend = "hatchling.build"
|
||
|
||
[tool.hatch.build.targets.wheel]
|
||
packages = ["src/pf1e_simulator"]
|
||
|
||
[dependency-groups]
|
||
dev = [
|
||
"pytest",
|
||
"ruff",
|
||
"basedpyright",
|
||
]
|
||
|
||
# ── Ruff ──────────────────────────────────────────────────────────────────────
|
||
[tool.ruff]
|
||
target-version = "py312"
|
||
line-length = 100
|
||
|
||
[tool.ruff.lint]
|
||
select = ["ALL"]
|
||
ignore = [
|
||
# D: docstring rules — we don't write docstrings everywhere in early scaffolding
|
||
"D",
|
||
# COM812: trailing-comma-in-missing — conflicts with ruff formatter
|
||
"COM812",
|
||
# ISC001: single-line-implicit-string-concatenation — conflicts with formatter
|
||
"ISC001",
|
||
# CPY001: missing copyright notice — we don't use copyright headers
|
||
"CPY001",
|
||
]
|
||
# RUF001: sigma in the CLI balance report is intentional, not a confusable
|
||
allowed-confusables = ["σ"]
|
||
|
||
[tool.ruff.lint.per-file-ignores]
|
||
# Tests: assert is expected, magic numbers are fine, annotations are noisy,
|
||
# parametrized golden tests legitimately take many arguments
|
||
"tests/**" = ["S101", "PLR2004", "ANN", "PLR0913", "PLR0917", "ARG001", "SLF001", "RUF059"]
|
||
# rng.py: `random.Random` is used for reproducible Monte Carlo streams, not cryptography
|
||
"src/pf1e_simulator/rng.py" = ["S311"]
|
||
# cli.py: stdout printing is the point of a CLI
|
||
"src/pf1e_simulator/cli.py" = ["T201"]
|
||
|
||
# ── Basedpyright ──────────────────────────────────────────────────────────────
|
||
[tool.basedpyright]
|
||
typeCheckingMode = "strict"
|
||
include = ["src", "tests"]
|
||
|
||
# ── Pytest ────────────────────────────────────────────────────────────────────
|
||
[tool.pytest.ini_options]
|
||
testpaths = ["tests"]
|