mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 16:09:03 +01:00
Added automation for defeated status
This commit is contained in:
parent
e2da9f8e99
commit
47403b4b39
12 changed files with 168 additions and 37 deletions
|
|
@ -225,7 +225,8 @@ export const registerRollDiceHooks = () => {
|
|||
const actor = await fromUuid(config.source.actor);
|
||||
let updates = [];
|
||||
if (!actor) return;
|
||||
if (config.roll.isCritical || config.roll.result.duality === 1) updates.push({ key: 'hope', value: 1, total: -1, enabled: true });
|
||||
if (config.roll.isCritical || config.roll.result.duality === 1)
|
||||
updates.push({ key: 'hope', value: 1, total: -1, enabled: true });
|
||||
if (config.roll.isCritical) updates.push({ key: 'stress', value: -1, total: 1, enabled: true });
|
||||
if (config.roll.result.duality === -1) updates.push({ key: 'fear', value: 1, total: -1, enabled: true });
|
||||
|
||||
|
|
@ -233,16 +234,15 @@ export const registerRollDiceHooks = () => {
|
|||
if (config.rerolledRoll.isCritical || config.rerolledRoll.result.duality === 1)
|
||||
updates.push({ key: 'hope', value: -1, total: 1, enabled: true });
|
||||
if (config.rerolledRoll.isCritical) updates.push({ key: 'stress', value: 1, total: -1, enabled: true });
|
||||
if (config.rerolledRoll.result.duality === -1) updates.push({ key: 'fear', value: -1, total: 1, enabled: true });
|
||||
if (config.rerolledRoll.result.duality === -1)
|
||||
updates.push({ key: 'fear', value: -1, total: 1, enabled: true });
|
||||
}
|
||||
|
||||
if (updates.length) {
|
||||
const target = actor.system.partner ?? actor;
|
||||
if (!['dead', 'unconscious'].some(x => actor.statuses.has(x))) {
|
||||
if(config.rerolledRoll)
|
||||
target.modifyResource(updates);
|
||||
else
|
||||
config.costs = [...(config.costs ?? []), ...updates];
|
||||
if (!['dead', 'defeated', 'unconscious'].some(x => actor.statuses.has(x))) {
|
||||
if (config.rerolledRoll) target.modifyResource(updates);
|
||||
else config.costs = [...(config.costs ?? []), ...updates];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue