-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add ability to use Lazy GM's encounter difficulty system #192
Conversation
This doesn't currently do anything, but will be used for choosing different ways to calculate XP for encounters. Put it under "Encounters" in settings, but not in the builder part of the data, as this isn't specific to the encounter builder.
This is to prepare for more customizable encounter XP systems. - Move all XP-calculation related things to encounter-difficulty.ts - Remove duplicated logic between encounter builder and other encounters - Use DifficultyReport for XP-related calculations. In the future we can swap out the contents of this and how it's generated based on the current XP system. Incidentally, this fixes some a discrepency between the encounter builder and other encounters: - other encounters will now show 'Trivial' for encounters below the Easy XP threshold, same as the encounter builder
This alters the encounter builder, encounters, and encounter table to all use the Lazy GM's (https://slyflourish.com/the_lazy_encounter_benchmark.html) system for benchmarking encounters. - The encounter and encounter table now show CR for each creature rather than XP - The encounter builder will show total XP as well as the CR threshold for deadly, and the total CR BREAKING CHANGE: this changes the tracker difficulty result to not always populate `adjustedXp`. Now, non-DnD5e systems will use `totalXp` for the total, while DnD 5e will use `adjustedXp`.
This alters the encounter builder, encounters, and encounter table to all use the Lazy GM's (https://slyflourish.com/the_lazy_encounter_benchmark.html) system for benchmarking encounters. - The encounter and encounter table now show CR for each creature rather than XP - The encounter builder will show total XP as well as the CR threshold for deadly, and the total CR BREAKING CHANGE: this changes the tracker difficulty result to not always populate `adjustedXp`. Now, non-DnD5e systems will use `totalXp` for the total, while DnD 5e will use `adjustedXp`.
This alters the encounter builder, encounters, and encounter table to all use the Lazy GM's (https://slyflourish.com/the_lazy_encounter_benchmark.html) system for benchmarking encounters. - The encounter and encounter table now show CR for each creature rather than XP - The encounter builder will show total XP as well as the CR threshold for deadly, and the total CR BREAKING CHANGE: this changes the tracker difficulty result to not always populate `adjustedXp`. Now, non-DnD5e systems will use `totalXp` for the total, while DnD 5e will use `adjustedXp`.
@miscoined I think this is a great start and I really appreciate the effort put in here. I'm thinking about how to make it easier to add in new systems later.
I am also wondering if a difficulty service that the component interfaces with would be better, with standard methods. Then new systems would just need to hook into those. Thoughts? |
Hey, thanks for the fast review, and for the feedback! I'm very much in the 'enthusiastic learner' category when it comes to JS/Svelte/Typescript, so apologies if I struggle with terminology a bit.
Terminology strikes again; by a difficulty service, are you referring to eg a base class that has a bunch of defined methods, and then every new system would be a subclass? if so then I think that could work well, but that could just be my OOP bias talking. For now I'll have a look at at least separating out the different subsystems a bit. A question, also; do I need to be careful about breaking changes to the API? I've been trying to keep it as untouched as possible, but it'd be good to know the likelihood of changes in the APIs difficulty reports breaking anyone's integrations. |
Yes, essentially 2 / 3: By hard typing, I mean: enforce export function getThresholds(difficulty: Difficulty): Threshold {
switch (difficulty.system) ...
} That will help declutter the Svelte component, although if we implement a difficulty service then this can wrap into that anyway. |
Also rename the xpSystem setting to rpgSystem to allow for future extensions for other purposes eg initiative. Still keep it in labelled as "XP Tracker" in the UI though. Delete encounter-difficulty.ts and put difficulty-related functions under rpg-system instead. Also for now remove the lazy GM setting, to be re-added in a later commit.
Hey! Added an |
Also add calls to formatDifficultyValue() in several places that I initially forgot, and add an optional arg for whether the formatted value should include units or not.
Added back in the Lazy GM system. Apologies for the messy commits also; let me know if you'd like me to just squash em all into one, or leave adding in the new system as a separate PR. I'm fairly new to working with pull requests, sorry! |
@miscoined thanks! I glanced through the code on the web and it looks a lot more extensible, thanks. I'll try to pull this code and do some testing. |
- Add a getAdditionalCreatureDifficultyStats for what should be shown when a creature is added to the builder. This allows systems to show the stats that are relevant to their difficulty calculations. - Fix some null issues that I missed when refactoring to use getFromCreatureOrBestiary. And also a spelling mistake in that method name. - Move the method to convert CR num to string into utils so it can be used by both RPG systems - Minor formatting fixes
I’m going to try to review this today |
This adds a setting for XP system which currently has two options: DnD 5e (the default, current behavior), and DnD 5e Lazy GM, which uses a CR-based calculation.
Resolves #114 .
This also allows additional XP systems to be added in the future. I've gotten a Pathfinder 2E XP system working in the encounter builder which I'll be sending a PR along for when this one gets merged :)
I did my best to avoid any breaking API changes. Any existing integrations should still work provided the XP system is set to
dnd5e
, although this comes with the unfortunate effect oftotalXp
having a different meaning between XP systems. Any existing integrations which read the difficulty report will probably break if they're set to any other XP system.BEGIN_COMMIT_OVERRIDE
feat: Adds the Lazy GM additional difficulty calculation method + a scaffold for future difficulty methods.
END_COMMIT_OVERRIDE