From e2e533d4819157bff91a6a7b8e6c2ab2c4b8b3a9 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sat, 6 Sep 2025 11:14:13 +0200 Subject: [PATCH] apply incapacitated if character's fatigue goes beyond endurance, simplify update logic since composure and endurance are derived attributes which aren't persisted on the actor's data --- system/scripts/actor.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/system/scripts/actor.js b/system/scripts/actor.js index fe0cec0..74522ea 100644 --- a/system/scripts/actor.js +++ b/system/scripts/actor.js @@ -130,9 +130,14 @@ export class ActorL5r5e extends Actor { if (this.isCharacterType) { // apply compromised condition if strife goes beyond max const strife = changes.system?.strife?.value ?? this.system.strife.value; - const maxStrife = changes.system?.strife?.max ?? this.system.strife.max; - const isCompromised = strife > maxStrife; - await this.toggleStatusEffect('compromised', {active: isCompromised}); + const isCompromised = strife > this.system.composure; + // apply incapacitated if fatigue goes beyond max endurance + const fatigue = changes.system?.fatigue?.value ?? this.system.fatigue.value; + const isIncapacitated = fatigue > this.system.endurance; + await Promise.all([ + this.toggleStatusEffect('compromised', {active: isCompromised}), + this.toggleStatusEffect('incapacitated', {active: isIncapacitated}), + ]); } }