Add support for Pathfinder 2e YAML statblocks#497
Draft
miscoined wants to merge 25 commits intoebullient:mainfrom
Draft
Add support for Pathfinder 2e YAML statblocks#497miscoined wants to merge 25 commits intoebullient:mainfrom
miscoined wants to merge 25 commits intoebullient:mainfrom
Conversation
62c71e8 to
d89513d
Compare
835d730 to
d0bdd3d
Compare
a3675ad to
a2aac62
Compare
b310e06 to
d2a8755
Compare
- Move entries, traits, and tags into Json2QuteBase - Incidentally fix a few cases where tags aren't populated correctly
Fits better with the other methods defined in that class rather than the recursive parse methods in JsonSource
- 🚸 Allows template authors to access trait reference data directly rather than just the markdown doc. - 🚸 Incidentally fixes trait ordering so that it's alphabetically by trait name, rather than by whether or not there's a link. - 🔥 Remove alignment field handling for creature nodes - it was never used in the data
Replace with linkifyListFrom. It's unnecessary now that we're no longer using it for creatures (which have their alignments defined directly within the trait field anyway). This also means that alignment formatting is easier to understand as it's all centralized within the linkifier now.
The implementation was the same in both trees. This makes debugging easier.
- Add a QuteDataTraits - dedicated class to hold traits so we can have easier bare linking - Rename collectTraitsFrom to getTraits, and pull Tag adding into QuteDataTraits - Fix creature statblock so it doesn't generate traits property when we don't have any generic traits - Fix some items being incorrectly tagged with their source (e.g. tagged as "trait/preparation-sog2" rather than "trait/preparation") - Fix some incorrectly formatted markdown links when the trait is surrounded in square brackets (e.g. for classes and magical traditions)
- 💥 Rename some properties to better reflect their usage - 🚸 Expose integers rather than formatted strings to the template - Add some StringUtil helpers for printing modifiers - Make the default output match the printed book text better
- Add a method to unfold newlines for use with specific YAML multiline string syntax - Add a method to quote YAML strings only when necessary
I've opted to use ** rather than __ for bold formatting in PF2e statblocks. This is primarily for consistency - we can't reliably change all instances of asterisk formatting within embedded text without risking changing asterisks which aren't formatting related, so we may as well double down on using asterisks for formatting since they're only reserved in specific contexts.
- Strip dice roller syntax from embedded yaml templates
- 💥 Remove, rename, and change QuteAbility methods to better suit the data - 🚸 Add an asYamlStatblock section to the default template for YAML ability statblock rendering
- Change tests to be more specific about which asterisks are disallowed - Add some workarounds for specific statblocks
4bac1ab to
87885b0
Compare
9c98bab to
21e9c71
Compare
383888f to
e1794dd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is done using a new Pathfinder 2e Bestiary layout which currently has an open PR here. This is part of an overall plan to add this statblock layout natively to the Fantasy Statblocks plugin (javalent/fantasy-statblocks#436)
Opening this as a draft PR for now until the base layout PR is done. I haven't added any documentation for this yet either - I'm currently planning to leave that til I do a full check over the documentation after all the changes I've made to the PF2e side of things so I can also catch any other documentation errors, as well as hopefully add auto-generation of documentation for the template extension methods.
The main structural change here is the addition of a new template resource boolean:
asYamlStatblock, which is defined for embedded templates only and is used to determine whether it's being rendered within a YAML statblock. I specifically wanted a way for template authors to customize the YAML output themselves and this seemed like the best tradeoff between functionality and not totally reworking how parsing and rendering works.