Open chipperme opened 6 months ago
At this point in time, I don't have much to add to the proposal other than a potential simplification of the Ferocity item lookup/creation.
Items can be created with an arbitrary ID, rather than an automatically created random one. It only needs to be 16 characters [a-z, A-Z, 0-9], so using something like mcdmFerocity0000
gives us a known and static ID for which to look for. e.g: if (actor.items.get(feroID)) console.log('actor has ferocity resource')
Doing this completely avoids the issue of finding/linking/storing data related to which item resource to use for ferocity operations.
The latest versions of the dnd5e system are working toward deprecating the following actor-level attributes:
system.resources.primary.value
system.resources.primary.max
system.resources.secondary.value
system.resources.secondary.max
system.resources.tertiary.value
system.resources.tertiary.max
The Beastheart class implementation is dependent on these attributes for its Ferocity resource.
Impacted Areas
The following parts of the Beastheart functionality in
scripts/plugin/beastheart.mjs
are dependent on the deprecated Resource 1/2/3 attributes:feroPath
The module-level setting "Actor Resource for Ferocity". Sets which of the six deprecated attributes to reference for CRUD operations on Ferocity. It's added to the mcdm-core module settings via the static#settings()
in the mjs file, which itself is called by the static#addApi(helper)
method in the same file.getFerocityPath()
This method sources its path from the above module-level setting and is how all the other methods below know where to access an actor's Ferocity. It's a simpleget
against the module-level setting's enum, to get a string of the attribute any actor would keep its Ferocity. Returns a string used bygetProperty(actor, path)
aspath
, or used byactor.update()
.#ferocityLink(actor, update, options, user)
Reliant on the returned enum fromgetFerocityPath()
. Updates an actor's Ferocity to match a linked actor's Ferocity, to sync updates between a PC and their beast.rollFerocity()
Depends ongetFerocityPath()
's returned enum, to increase a beast's Ferocity.Solution Proposal
The dnd5e 3.0.0 release said that Items with Uses should be used instead of Resource 1/2/3 going forward.
Here's how I'm thinking this could be done here, for the Beastheart:
feroPath
module setting.linkCaregiver()
is called, and after the dialog for linking a PC actor and a beast actor is successfully closed, raise a new dialog to identify or create Ferocity items for both actors.feroPath
actor flag to each actor. TheferoPath
flag will store the actor's Ferocity item's UUID.linkCaregiver()
is used to break (not create) a PC actor and beast actor's link , remove anyferoPath
flags on both actors.getFerocityPath()
to require a new actor parameter, who will be checked for aferoPath
flag. The method should return a string usable bygetProperty(actor, path)
as itspath
parameter and byactor.update()
. (We could default to a user-associated actor, but this would break when the GM needs to act on an offline Beastheart's behalf.)getFerocityPath()
, to inform a user that they may need to update their macros. "Error: You haven't specified whose Ferocity you want to get. You may need to update your macros for the latest version of getFerocityPath(actor) with an actor."feroPath
flag exists on the specified actor. "Error: It looks like ${actor.name} doesn't have a Ferocity feature on them. You may need to re-link them with their Caregiver/Monstrous Companion."getFerocityPath()
, such that they work with thegetFerocityPath(actor)
updates.#ferocityLink(actor, update, options, user)
No logic flow changes necessary. Just updating references in CRUD operations to already-accessible actors and their attributes.rollFerocity(companionActor,die,hostileBonus)
As above—all concerned actors are already available in scope. Just need to update attribute references in CRUD operations to work with the updated getFerocityPath method.Pull Request notes
I've gone full corporate drone with this write-up. I haven't contributed to Foundry, or GitHub, like this before. I want to give as many chances as possible to call me out and update me on how things are done—"hang on, there's an existing solution" "that's not how we do things around here" etc.
Unless someone "No, thank you"s me or beats me to it, I figure I'll try and create a PR for this. I haven't worked on Foundry modules before—but I need it done, and I'll be happy to share my work once it's done.