[Feature] ActiveEffect Improvements (#439)

* Fixed so genericStatuses aren't shown in activeEffectConfig if turned off. Fixed localization of genericStatuses in Inventory-ItemV2.

* Effects with statuses on them will now add them as full additional effects so they show up on the token.

* Revert "Effects with statuses on them will now add them as full additional effects so they show up on the token."

This reverts commit 5afd7ae686.

* Redid it a better way

* Fixed so multiple statuses on an effect are still treated as active
This commit is contained in:
WBHarry 2025-07-28 15:32:19 +02:00 committed by GitHub
parent 0a944eb3d4
commit 2fbbf98f88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 83 additions and 13 deletions

View file

@ -10,8 +10,28 @@ export default class DhTokenPlaceable extends foundry.canvas.placeables.Token {
this.effects.overlay = null;
// Categorize effects
const activeEffects = this.actor ? Array.from(this.actor.effects).filter(x => !x.disabled) : [];
const overlayEffect = activeEffects.findLast(e => e.img && e.getFlag('core', 'overlay'));
const statusMap = new Map(foundry.CONFIG.statusEffects.map(status => [status.id, status]));
const activeEffects = (this.actor ? this.actor.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.includes(status))) {
const statusData = statusMap.get(status);
acc.push({
name: game.i18n.localize(statusData.name),
statuses: [status],
img: statusData.icon,
tint: effect.tint
});
}
}
return acc;
}, []);
const overlayEffect = activeEffects.findLast(e => e.img && e.getFlag?.('core', 'overlay'));
// Draw effects
const promises = [];