Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Pf2e creature support #447

Merged
merged 14 commits into from
May 11, 2024
Merged

Conversation

miscoined
Copy link
Collaborator

@miscoined miscoined commented May 9, 2024

This adds support for the following info for Pf2e creatures:

  • HP
  • senses
  • ability modifiers
  • items
  • speeds

It also:

  • Fixes some bugs and changes some default output for Pf2e deities, as a side effect of using the same object for creature speeds. This also involves moving the existing deity avatar default rendering into the deity2md template file, and making a more compact inline rendering for template authors to use when the avatar is used directly
  • Fixes some bugs around the AC parsing and display for shields, armor, and hazards. This involves making some breaking changes due to adding some fields and removing others.
  • Restructures how HP works in QuteDefenses to make it easier to read for creatures. This is a breaking change.
  • Changes the defenses, AC, and deity avatar rendering to be closer to the book

This has a fair number of breaking changes around AC/HP as I've restructured the way the data is handled - it's fairly opinionated, so please let me know if there's anything you don't agree with :)

Am also happy to split this into multiple PRs. I originally had the breaking changes in a separate PR, but apparently having another PR which is rebased off this one results in the other PR duplicating these commits, which doesn't seem desirable.

This covers the majority of the low-hanging fruit for field support. The remaining fields are:

  • abilities
  • attacks
  • inflicts
  • spellcasting
  • rituals

miscoined added 3 commits May 10, 2024 00:37
- Move JsonTextReplacement.replaceText to JsonTextConverter. The
  implementation is the same between Pf2e and Dnd, so keep this as a
  default implementation to avoid repetition, and so that callers can
  use JsonTextConverter as the base type without casting to
  Pf2eTextConverter
- Add a streamPropsExcluding helper method which provides a stream of
  properties from a JsonObject, excluding the given keys
- 🎨 Add a new Pf2eStat helper class with a value and note(s) to help
  standardize some things
- 🐛 Shield alternate ACs are now read in correctly (previously the
  regular AC value was read in twice, so the tower shield etc would have
  incorrect entries)
- 🐛 Make some default rendering closer to the canonical PF2e book style
  for shields, armor, hazards, and creature AC

💥 Breaking changes
- ac.value now has the bare AC value
- ac.alternateValues has a map of descriptions to alternate AC values
- For armor, resource.dexCap now provides the max dex cap for armor,
  rather than it being represented as a generic named text entry within
  the AC
- ac.armorClass and ac.note have been removed
- ✨ Correctly read in and display the HP and defenses values for creatures
- Make QuteDataDefenses differentiate between the primary HP stats and the additional extra HP stats
- Make the default displays for defenses and HpHardnessBt closer to the
  Pf2e book equivalents

💥 Breaking changes
- Rename QuteDataHpHardness and friends to QuteDataHpHardnessBt
- Access primary HP/hardness/bt with
  `resources.defenses.hpHardnessBt.hp.value`,
  `resources.defenses.hpHardnessBt.hardness.value`,
  and `resources.defenses.hpHardnessBt.brokenThreshold`
- Access additional HP/hardness/bt values as a map of names to
  QuteDataHpHardnessBt
@miscoined miscoined requested a review from ebullient as a code owner May 9, 2024 14:43
miscoined added 10 commits May 10, 2024 02:09
Avoids a small amount of repetition and keeps the interface consistent
Mostly cosmetic, just rearranges things and adds a new helper method for JsonNodeReader.getTextFrom which behaves like JsonNodeReader.getIntFrom
…e authors

Currently, it has Integer.asBonus to format a number value as a bonus with a +/-, and String.capitalized.
Makes the method call more similar to other method calls
- 🧱 Move Pf2eTypeReader.Speed into a richer top-level class with more granular parsing options
- ✨ Add more granular access to speed-related properties so template authors can customize the output
- ✨ Add a more compact default representation for deity.avatar for template authors to use
- 🎨 Move the existing multiline deity avatar representation into the deity2md template instead
- 🐛 Fix a bug where shield value was incorrectly given regardless of whether the deity's avatar had a shield provided
- 🐛 Fix a bug where deity avatar actions would have broken display for traits and have empty parens or "(, " because of traits which were empty strings
- 🎨 Make default deity and speed representations closer to the book entries
@miscoined miscoined changed the title Improve HP and AC support for creatures Improve Pf2e creature support May 11, 2024
Also update the .editorconfig to correctly turn the automatic removal of trailing whitespace off for these files
@ebullient ebullient merged commit cec3874 into ebullient:main May 11, 2024
7 checks passed
@ebullient ebullient linked an issue May 11, 2024 that may be closed by this pull request
@miscoined miscoined mentioned this pull request May 27, 2024
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.

✨ Pf2e: Beasties
2 participants