From 841819ee89c15a375c3cf4036895c4b72ad1bc3e Mon Sep 17 00:00:00 2001 From: Dapoulp <74197441+Dapoulp@users.noreply.github.com> Date: Fri, 15 Aug 2025 21:27:55 +0200 Subject: [PATCH] Fix/941 companion hope ranger (#950) * Temp ActionField attack type missing * Move missing attack type to getModel * Fix Companion not updating Partner resources --- module/data/action/baseAction.mjs | 7 ++++--- module/documents/actor.mjs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/module/data/action/baseAction.mjs b/module/data/action/baseAction.mjs index a886bf49..3666b6e7 100644 --- a/module/data/action/baseAction.mjs +++ b/module/data/action/baseAction.mjs @@ -208,8 +208,9 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel } async consume(config, successCost = false) { - const usefulResources = { - ...foundry.utils.deepClone(this.actor.system.resources), + const actor= this.actor.system.partner ?? this.actor, + usefulResources = { + ...foundry.utils.deepClone(actor.system.resources), fear: { value: game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Resources.Fear), max: game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxFear, @@ -246,7 +247,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel } }, []); - await (this.actor.system.partner ?? this.actor).modifyResource(resources); + await actor.modifyResource(resources); if ( config.uses?.enabled && ((!successCost && (!config.uses?.consumeOnSuccess || config.roll?.success)) || diff --git a/module/documents/actor.mjs b/module/documents/actor.mjs index 6b01c058..05c4cbaa 100644 --- a/module/documents/actor.mjs +++ b/module/documents/actor.mjs @@ -631,7 +631,7 @@ export default class DhpActor extends Actor { } async modifyResource(resources) { - if (!resources.length) return; + if (!resources?.length) return; if (resources.find(r => r.key === 'stress')) this.convertStressDamageToHP(resources); let updates = {