diff --git a/module/applications/sheets/actors/character.mjs b/module/applications/sheets/actors/character.mjs index e3dad734..481c745e 100644 --- a/module/applications/sheets/actors/character.mjs +++ b/module/applications/sheets/actors/character.mjs @@ -638,15 +638,21 @@ export default class CharacterSheet extends DHBaseActorSheet { ability: abilityLabel }) }); - - // setTimeout(() => { - // this.consumeResource(result?.costs); - // }, 50); + + this.consumeResource(result?.costs); } + // Remove when Action Refactor part #2 done async consumeResource(costs) { if (!costs?.length) return; - const usefulResources = foundry.utils.deepClone(this.actor.system.resources); + const usefulResources = { + ...foundry.utils.deepClone(this.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, + reversed: false + } + }; const resources = game.system.api.fields.ActionFields.CostField.getRealCosts(costs).map(c => { const resource = usefulResources[c.key]; return { diff --git a/module/data/action/baseAction.mjs b/module/data/action/baseAction.mjs index 4f201283..a886bf49 100644 --- a/module/data/action/baseAction.mjs +++ b/module/data/action/baseAction.mjs @@ -208,7 +208,6 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel } async consume(config, successCost = false) { - console.log("Action consume", config) const usefulResources = { ...foundry.utils.deepClone(this.actor.system.resources), fear: { @@ -247,7 +246,6 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel } }, []); - console.log(resources) await (this.actor.system.partner ?? this.actor).modifyResource(resources); if ( config.uses?.enabled && diff --git a/module/dice/dhRoll.mjs b/module/dice/dhRoll.mjs index 8965b6c9..695c94a4 100644 --- a/module/dice/dhRoll.mjs +++ b/module/dice/dhRoll.mjs @@ -239,12 +239,10 @@ export const registerRollDiceHooks = () => { if (updates.length) { const target = actor.system.partner ?? actor; if (!['dead', 'unconscious'].some(x => actor.statuses.has(x))) { - console.log(config.costs, updates) - updates = [...(config.costs ?? []), ...updates]; - if(config.source.action) - config.costs = updates; - else + if(config.rerolledRoll) target.modifyResource(updates); + else + config.costs = [...(config.costs ?? []), ...updates]; } } diff --git a/templates/ui/chat/foundryRollTooltip.hbs b/templates/ui/chat/foundryRollTooltip.hbs index 158f5d47..8802c90b 100644 --- a/templates/ui/chat/foundryRollTooltip.hbs +++ b/templates/ui/chat/foundryRollTooltip.hbs @@ -5,7 +5,7 @@ -