Skip to content

fix: hit-die display desync + species natural armor AC#7

Merged
sligara7 merged 2 commits into
mainfrom
fix/adapters-bugs-1-2
Jun 14, 2026
Merged

fix: hit-die display desync + species natural armor AC#7
sligara7 merged 2 commits into
mainfrom
fix/adapters-bugs-1-2

Conversation

@sligara7

Copy link
Copy Markdown
Owner

What

Adds validate_power_budget(species_data, class_data, subclass_data, level) -> list[str] in dndwright/rules/homebrew_validator.py.

Problem

Today the only balance signal for homebrew characters is the LLM's self-graded balance_score, never enforced. A "Superman (species-heavy) + Batman (class-heavy)" concept can stack a full species' traits AND a full class's features.

Approach

Three checks against SRD baselines derived from dndwright's own content (not invented):

Check Baseline source Budget
Species traits 9 SRD 5.2.1 species in species.json 5 total, 3 high-impact
Class+subclass features 12 SRD classes in classes.json Max observed at level (interpolated)
Combined split Sum of species + class budgets Species budget + class budget per level

High-impact traits (flight, innate casting, resistance, breath weapon, darkvision/tremorsense) are weighted heavier.

Tests

17 new tests: balanced passes, species-over/fails, class-over/fails, combined-over (Superman+Batman)/fails, edge cases (empty data, missing traits, malformed lists, features below level).

1635 total (was 1618). No regressions.

Baseline derivation

Methodology documented in the source comments: counted traits per SRD species, cumulative features active at level per SRD class, set budgets slightly above SRD max to allow homebrew creativity while catching over-stacking.

sligara7 added 2 commits June 13, 2026 23:12
Bug 1 — Hit die compute/display desync (adapers.py:51-58 vs :230):
After archetype/class lookup overrides the hit die (e.g.
primal_martial -> d12), the sheet displayed the original LLM value
(d10). Fix: computed_values_to_sheet now resolves hit_die through
the same HIT_DIE_BY_CLASS/HIT_DIE_BY_ARCHETYPE lookup tables.

Bug 2 — Species natural armor not applied to AC (adapers.py:70-87):
AC inputs were built exclusively from equipment; species traits
like Carapace (natural armor AC 12) were ignored. Fix:
- Added natural_armor_ac INPUT node to the DAG (dnd_5e_2024.py)
- op_ac_with_armor now returns max(natural_armor_ac, armored_ac)
- character_data_to_inputs parses species traits for natural armor
  AC (keyword match + regex AC value extraction)
- assemble_character_inputs defaults natural_armor_ac to 0

11 new tests (4 hit-die display, 7 natural armor AC).
1646 total (was 1635). No regressions.
@sligara7
sligara7 merged commit 3ba6b98 into main Jun 14, 2026
0 of 4 checks passed
@sligara7
sligara7 deleted the fix/adapters-bugs-1-2 branch June 14, 2026 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant