mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
Corrected companion resource change on duality
This commit is contained in:
parent
d65c0f91fc
commit
76f8da93ca
1 changed files with 5 additions and 11 deletions
|
|
@ -184,23 +184,17 @@ export const registerRollDiceHooks = () => {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const actor = await fromUuid(config.source.actor),
|
const actor = await fromUuid(config.source.actor),
|
||||||
updates = [],
|
updates = [];
|
||||||
hopeUpdates = [];
|
|
||||||
if (!actor) return;
|
if (!actor) return;
|
||||||
if (config.roll.isCritical || config.roll.result.duality === 1) hopeUpdates.push({ key: 'hope', value: 1 });
|
if (config.roll.isCritical || config.roll.result.duality === 1) updates.push({ key: 'hope', value: 1 });
|
||||||
if (config.roll.isCritical) updates.push({ key: 'stress', value: -1 });
|
if (config.roll.isCritical) updates.push({ key: 'stress', value: -1 });
|
||||||
if (config.roll.result.duality === -1) updates.push({ key: 'fear', value: 1 });
|
if (config.roll.result.duality === -1) updates.push({ key: 'fear', value: 1 });
|
||||||
|
|
||||||
if (hopeUpdates.length) {
|
if (updates.length) {
|
||||||
if (actor.system.partner) {
|
const target = actor.system.partner ? actor.system.partner : actor;
|
||||||
actor.system.partner.modifyResource(hopeUpdates);
|
target.modifyResource(updates);
|
||||||
} else {
|
|
||||||
updates.push(...hopeUpdates);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updates.length) actor.modifyResource(updates);
|
|
||||||
|
|
||||||
if (!config.roll.hasOwnProperty('success') && !config.targets?.length) return;
|
if (!config.roll.hasOwnProperty('success') && !config.targets?.length) return;
|
||||||
|
|
||||||
const rollResult = config.roll.success || config.targets.some(t => t.hit),
|
const rollResult = config.roll.success || config.targets.some(t => t.hit),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue