W
Wasp•788d ago
TLDR; I want to implement a way to override hit die rolls for item and feats such as Periapt of Wound Closure and Durable
C
ccjmk•788d ago
i understand what you want to change is on parts ?
W
Wasp•788d ago
Since Actor5e#rollHitDie uses the native damageRoll in the 5e system, there's no distinct way to easily change it
C
ccjmk•788d ago
would it make sense to return a new Parts ?
W
Wasp•788d ago
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`
}
}

});
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?
C
ccjmk•788d ago
i just started a dota match so my attenetion is a little limted xD brb
W
Wasp•788d ago
all good crush the opposition
C
ccjmk•788d ago
back! you closed it! xD also, I think you should not change the system version on your mr 😛
W
Wasp•788d ago
I saw in a different MR that it was recommended to make em for 1.6.x
C
ccjmk•788d ago
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
C
Calego•788d ago
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
Want results from more Discord servers?
Add your server
More Posts
advantage shennaneginsdevmode extension brainstormhttps://github.com/mdn/webextensions-examples/tree/master/devtools-panelsSaving Functions as module settings@wasp I remember you asked about saving functions as settings (which quickly turned into stringifyinnew consumable typesTried adding localization strings for some new consumable types, but keep getting this ("`DND5E.Consspell-compendium-5e alpha1Overriding onDropItem & onSortItemYou'd override them in your sheet class.getter & setter wrapper for settingsI'm trying to use a getter & setter pair as an interface for `game.settings.get` and `game.settings.scrollable tab contentsIt is possible, and you're firmly in the css and DOM structure side of development with this line ofJr devI'm cleaning out my bookmarks and accidentally came back to this article. Potentially useful startinHTCPackage: `hero-creation-tool`System Specific CSSI'm not 100% about this, but it is worth watching out that your solution doesn't actually end up beiadvancement-wipCommander register apitalking about permissions, im working on the registering api for the Commander, and I wanted to ask Azgaars Blurry MapHey all. I'm taking a look at my importer for Azgaar's Fantasy Map Generator and wondering how I canccjmk overlaybut for what I wanted I think I *needed* to append it there so that I can overlay the whole screencliits very very early alpha demoMonarch APIAlright, adventurous ones: I have a Beta version of Monarch with the new components API! Manifest: compacted chat cardsModules create problems to solve problems... Today's problem: "When I roll an attack, it eats the whdragdrop shenneneginsRight now, a user can drag a spell onto their character sheet. I store that in a 'spell' array and leffect mini modulesI've gotten to the point where I'm confident in releasing a slurry of tiny no-config Active Effect r