LOEFD
Join ServerHitDice hooks MR
I just added my first merge request 😄 https://gitlab.com/foundrynet/dnd5e/-/merge_requests/495
TLDR; I want to implement a way to override hit die rolls for item and feats such as Periapt of Wound Closure and Durable
i understand what you want to change is on parts ?
Since
Actor5e#rollHitDie
uses the native damageRoll
in the 5e system, there's no distinct way to easily change itwould it make sense to return a new Parts ?
Hooks.on("preRollHitDie", (actor, parts) => {
let periapt = actor.items.getName(game.i18n.format("REST-RECOVERY.FeatureNames.Periapt"));
periapt = periapt && periapt.data.data.attunement === 2;
let durable = actor.items.getName(game.i18n.format("REST-RECOVERY.FeatureNames.Durable"));
durable = durable && durable.data.type === "feat";
const conMod = actor.data.data.abilities.con.mod;
if (periapt && durable) {
parts = [`{1${denomination}+${conMod},${Math.max(conMod,2)}}kh*2`]
} else {
if (periapt) {
parts[0] = "(" + parts[0];
parts[1] += ")*2";
}
if (durable) {
parts[0] = "{" + parts[0]
parts[1] += `,${conMod*2}}kh`
}
}
});
That could work, yeah
If multiple hooks are called, I don't think it will properly mutate though?
ie, if module A and B both use
preRollHitDie
, and they both return the parts data, only one will win out?i just started a dota match so my attenetion is a little limted xD
brb
all good
crush the opposition
back!
you closed it! xD
also, I think you should not change the system version on your mr 😛
I saw in a different MR that it was recommended to make em for 1.6.x
hmm no I mean, not change the version on the system.json
you just make the MR to the current next version, let them change the version & download link when ready for release
I do want to put in a bunch of hooks in various places (see the more-hooks-5e module for my proof of concept), so I'm definitely interested in what your use case is and hwo to accomodate.
I havne't fully caught up here but when I do I'll see about adding some hooks to the more-hooks module on this front