Skip to content

Fix template compatibility checks to honor custom AbilityRandomizer (Ghost, Half-Celestial, Half-Fiend) - #69

Open
karl-speer-GGL wants to merge 19 commits into
DnDGen:mainfrom
karl-speer-GGL:patch-1
Open

Fix template compatibility checks to honor custom AbilityRandomizer (Ghost, Half-Celestial, Half-Fiend)#69
karl-speer-GGL wants to merge 19 commits into
DnDGen:mainfrom
karl-speer-GGL:patch-1

Conversation

@karl-speer-GGL

@karl-speer-GGL karl-speer-GGL commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes template validity checks so they correctly account for a caller-provided AbilityRandomizer when evaluating minimum ability requirements.

The issue affected templates with minimum ability gates:
• Ghost (minimum Charisma)
• Half-Celestial (minimum Intelligence)
• Half-Fiend (minimum Intelligence)

Root Cause

Compatibility checks for random generation could evaluate template eligibility using default ability-roll assumptions instead of the active AbilityRandomizer configuration (custom roll or set rolls). This caused incorrect valid/invalid outcomes and intermittent stress-test failures.

What Changed
• Updated compatibility filtering in:
GhostApplicator.GetCompatibleCreatures(...)
HalfCelestialApplicator.GetCompatibleCreatures(...)
HalfFiendApplicator.GetCompatibleCreatures(...)
• Minimum-ability validation now uses abilityRandomizer.Validate(...) with the active randomizer configuration and relevant ability adjustments.

Tests

Expanded unit coverage to validate compatibility behavior across randomizer modes:
• default randomizer behavior
• custom Roll
• custom SetRolls
• high-roll scenarios that should allow otherwise borderline creatures
Updated test suites include:
GhostApplicatorTests
HalfCelestialApplicatorTests
HalfFiendApplicatorTests

Additional

• Updated README.md build status badge branch reference from master to main.

@karl-speer-GGL karl-speer-GGL changed the title Update build status badge to main branch Fix template compatibility checks to honor custom AbilityRandomizer (Ghost, Half-Celestial, Half-Fiend) Aug 5, 2026
Gonna try a big template applicator validation logic shift to set theory, outlined in comments in the GhostApplicator. Also adding some self-validation to the AbilityRandomizer (helping ensure our max roll is positive, which is required for abilities) - need to actually CALL the method, but I'll get to that.
Once I get the table tests passing, I can run the profiler against the Ghost applicator and see if we improve over the old ability adjustment selection
Profiling showed massive performance improvment. Now spreading the change through atemplate applicators, then updating all the tests
Might wanna move the "GetCompatiblePrototypes" (from name) and nix it altogether. If someone wants the names, they cal lthe GetCompatibleCreatures method. If they want those in a prototype, then they

1. Get the names
2. Build the prototypes themselves with the factory
3. Pass that into the applicator and say ApplyToPrototypes

Then the applicators wouldn't need to reference the factory at all, and it just becomes "do I want to check compatibility against prototypes" (do it live) or "do I want to check compatibility against creature names" (hit table cache). Extra step for the caller, but drastically simplifies the templateapplicators...
Now to fix over 900 compilation errors! But the non-duplicated verification logic living in the creature verifier has made the template applicators much cleaner and leaner, and centralizes the chaining logic nicely as well.
Got all the unit tests updated, pattern looks pretty good. Fiendish creature next.
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