Corrected companion resource change on duality

This commit is contained in:
WBHarry 2025-07-16 01:02:19 +02:00
parent d65c0f91fc
commit 76f8da93ca

View file

@ -184,22 +184,16 @@ 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;