mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 23:49:02 +01:00
Fix Hope gain on Duality Roll
This commit is contained in:
parent
5d6eb4b145
commit
d2b0ed4947
4 changed files with 15 additions and 13 deletions
|
|
@ -639,14 +639,20 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
// setTimeout(() => {
|
this.consumeResource(result?.costs);
|
||||||
// this.consumeResource(result?.costs);
|
|
||||||
// }, 50);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove when Action Refactor part #2 done
|
||||||
async consumeResource(costs) {
|
async consumeResource(costs) {
|
||||||
if (!costs?.length) return;
|
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 resources = game.system.api.fields.ActionFields.CostField.getRealCosts(costs).map(c => {
|
||||||
const resource = usefulResources[c.key];
|
const resource = usefulResources[c.key];
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,6 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
}
|
}
|
||||||
|
|
||||||
async consume(config, successCost = false) {
|
async consume(config, successCost = false) {
|
||||||
console.log("Action consume", config)
|
|
||||||
const usefulResources = {
|
const usefulResources = {
|
||||||
...foundry.utils.deepClone(this.actor.system.resources),
|
...foundry.utils.deepClone(this.actor.system.resources),
|
||||||
fear: {
|
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);
|
await (this.actor.system.partner ?? this.actor).modifyResource(resources);
|
||||||
if (
|
if (
|
||||||
config.uses?.enabled &&
|
config.uses?.enabled &&
|
||||||
|
|
|
||||||
|
|
@ -239,12 +239,10 @@ export const registerRollDiceHooks = () => {
|
||||||
if (updates.length) {
|
if (updates.length) {
|
||||||
const target = actor.system.partner ?? actor;
|
const target = actor.system.partner ?? actor;
|
||||||
if (!['dead', 'unconscious'].some(x => actor.statuses.has(x))) {
|
if (!['dead', 'unconscious'].some(x => actor.statuses.has(x))) {
|
||||||
console.log(config.costs, updates)
|
if(config.rerolledRoll)
|
||||||
updates = [...(config.costs ?? []), ...updates];
|
|
||||||
if(config.source.action)
|
|
||||||
config.costs = updates;
|
|
||||||
else
|
|
||||||
target.modifyResource(updates);
|
target.modifyResource(updates);
|
||||||
|
else
|
||||||
|
config.costs = [...(config.costs ?? []), ...updates];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<legend>
|
<legend>
|
||||||
{{localize "DAGGERHEART.UI.Chat.dicePool.title"}}
|
{{localize "DAGGERHEART.UI.Chat.dicePool.title"}}
|
||||||
</legend>
|
</legend>
|
||||||
<div class="roll-dice">{{log @root}}
|
<div class="roll-dice">
|
||||||
{{#each parts}}
|
{{#each parts}}
|
||||||
{{#each rolls}}
|
{{#each rolls}}
|
||||||
<div class="roll-die">
|
<div class="roll-die">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue