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

This commit is contained in:
Bernhard Posselt
2025-09-06 11:14:13 +02:00
parent 2518ded84f
commit e2e533d481

View File

@@ -130,9 +130,14 @@ export class ActorL5r5e extends Actor {
if (this.isCharacterType) { if (this.isCharacterType) {
// apply compromised condition if strife goes beyond max // apply compromised condition if strife goes beyond max
const strife = changes.system?.strife?.value ?? this.system.strife.value; const strife = changes.system?.strife?.value ?? this.system.strife.value;
const maxStrife = changes.system?.strife?.max ?? this.system.strife.max; const isCompromised = strife > this.system.composure;
const isCompromised = strife > maxStrife; // apply incapacitated if fatigue goes beyond max endurance
await this.toggleStatusEffect('compromised', {active: isCompromised}); 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}),
]);
} }
} }