mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
[Feature] 648 - Mark Defeated Actors (#914)
* Improved death marking styling * Added automation for defeated status * Fixed so the tracker recognises and sets the correct defeated statuses depending on type * Fixed so missing statuses doesn't cause crashes * Increased companion sheet width by 40 pixels * Added missing inheritDoc * Removed fas
This commit is contained in:
parent
c579b5f63c
commit
3489c9c2e8
21 changed files with 288 additions and 84 deletions
|
|
@ -118,7 +118,7 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
|||
|
||||
for (const statusId of this.statuses) {
|
||||
const status = CONFIG.statusEffects.find(s => s.id === statusId);
|
||||
tags.push(game.i18n.localize(status.name));
|
||||
if (status) tags.push(game.i18n.localize(status.name));
|
||||
}
|
||||
|
||||
return tags;
|
||||
|
|
|
|||
|
|
@ -718,4 +718,21 @@ export default class DhpActor extends Actor {
|
|||
value: 1
|
||||
});
|
||||
}
|
||||
|
||||
async toggleDefeated(defeatedState) {
|
||||
const settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).defeated;
|
||||
const { unconscious, defeated, dead } = CONFIG.DH.GENERAL.conditions;
|
||||
const defeatedConditions = new Set([unconscious.id, defeated.id, dead.id]);
|
||||
if (!defeatedState) {
|
||||
for (let defeatedId of defeatedConditions) {
|
||||
await this.toggleStatusEffect(defeatedId, { overlay: settings.overlay, active: defeatedState });
|
||||
}
|
||||
} else {
|
||||
const noDefeatedConditions = this.statuses.intersection(defeatedConditions).size === 0;
|
||||
if (noDefeatedConditions) {
|
||||
const condition = settings[`${this.type}Default`];
|
||||
await this.toggleStatusEffect(condition, { overlay: settings.overlay, active: defeatedState });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue