mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
[Feature] EffectsDisplay (#1340)
* Merged with main * Added the display * . * Removed unused override function * Fixed layout for generic effects * feat: add basic style to effects tooltip * Corrected distancing * Use CSS based solution for shifting the countdowns * Centered tooltip header --------- Co-authored-by: moliloo <dev.murilobrito@gmail.com> Co-authored-by: Carlos Fernandez <cfern1990@gmail.com>
This commit is contained in:
parent
f41f0b20b7
commit
165068a9ee
25 changed files with 399 additions and 41 deletions
|
|
@ -844,4 +844,37 @@ export default class DhpActor extends Actor {
|
|||
if (this.system._getTags) tags.push(...this.system._getTags());
|
||||
return tags;
|
||||
}
|
||||
|
||||
/** Get active effects */
|
||||
getActiveEffects() {
|
||||
const statusMap = new Map(foundry.CONFIG.statusEffects.map(status => [status.id, status]));
|
||||
return this.effects
|
||||
.filter(x => !x.disabled)
|
||||
.reduce((acc, effect) => {
|
||||
acc.push(effect);
|
||||
|
||||
const currentStatusActiveEffects = acc.filter(
|
||||
x => x.statuses.size === 1 && x.name === game.i18n.localize(statusMap.get(x.statuses.first()).name)
|
||||
);
|
||||
|
||||
for (var status of effect.statuses) {
|
||||
if (!currentStatusActiveEffects.find(x => x.statuses.has(status))) {
|
||||
const statusData = statusMap.get(status);
|
||||
if (statusData) {
|
||||
acc.push({
|
||||
condition: status,
|
||||
appliedBy: game.i18n.localize(effect.name),
|
||||
name: game.i18n.localize(statusData.name),
|
||||
statuses: new Set([status]),
|
||||
img: statusData.icon ?? statusData.img,
|
||||
description: game.i18n.localize(statusData.description),
|
||||
tint: effect.tint
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue