Try to return creature's raw XP value if level is not available for PF2E difficulty calc - #334
Open
rocketgarden wants to merge 1 commit into
Open
Try to return creature's raw XP value if level is not available for PF2E difficulty calc#334rocketgarden wants to merge 1 commit into
rocketgarden wants to merge 1 commit into
Conversation
…F2E difficulty calc Using pf2e difficulty calculations doesn't work when using inline creatures that specify their XP value. There is no (documented) way to specify level in the inline encounter builder. Since the difficulty logic attempts to use the lvl field to re-derive the xp, an xp/difficulty of "0" is reported for inline-defined creatures. This change adds an intermediate fallback of returning `creature.xp` if the lvl is unavailable, but still falls back to `0` if `xp` is also undefined/null
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.
Pull Request Description
Using pf2e difficulty calculations doesn't work when using inline creatures that specify their XP value. There is no (documented) way to specify level in the inline encounter builder. Since the difficulty logic attempts to use the lvl field to re-derive the xp, an xp/difficulty of "0" is reported for inline-defined creatures.
This change adds an intermediate fallback of returning
creature.xpif the lvl is unavailable, but still falls back to0ifxpis also undefined/null.Tradeoff/Downside: These hard-coded XP values don't update against average party level. So e.g. if a user inputs inline XP values based on a party level of 3 and the party levels up to 4, the encounter difficulty & xp budget will be incorrect. This is arguably bad but no worse than the current behavior, which is incorrect or no difficulty ratings ever. The ideal fix for this would be allowing the user to specify a level/cr instead/in-addition to xp, but that's a bigger scope.
Changes Proposed
lvl == nullcase to returncreature.xpbefore returning0Checklist
Additional Notes
I am not familiar or invested enough in Obsidian plugin development (yet?) to be able to build and test my change locally. This just seemed like it might be more useful and expeditious than submitting an Issue.