Simplify/jsonify NPC generation from npc classes #70314
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Infrastructure "Simplify/jsonify NPC generation from npc classes"
Purpose of change
I look at npc::randomize and I see hardcoded modifiers defined per-class. I weep.
Describe the solution
c44cd1a Prep work, just explained our existing docs and replaced some of the unhelpful existing examples with the full range of what is possible. (We support several ways to define these values but only had one documented...)
08a56d2 Add support to read personality modifiers from the classes' json and modify appropriately. Update docs to explain this, document how it works, etc.
cf77958 Clamp personality scores to the previously-set-but-not-enforced range of -10, 10.
771bbce Migrate the hardcoded modifiers to json
6b9e752 Update the debug menu to display class IDs in addition to class names wherever possible.
Describe alternatives you've considered
Testing
Compiles, scores generate as expected. Confirmed that the modifiers apply by putting in some silly values (+200 aggression) before the clamping commit. Debug spawned NPCs until I got one of that class and confirmed their aggression was >200.
Additional context
This PR should probably not be squashed if merged.
Two hardcoded modifiers for increasing the characters'
cash
value were not maintained. As far as can be told, these were dead code so there is no loss of functionality.A comment for
TODO: give ninja his styles back
was also deleted but that appears to be referring to character-specific techniques detached from modern implementations of MAs. And well it's been sitting there for a decade, so... not too worried about anyone missing it.