Fix protection and other maintained status effects

Protection and other system status effects still had a duration when
being maintained.

Fixes #44
This commit is contained in:
Mike Bloy 2024-08-11 13:40:19 -05:00
parent abfed3204b
commit 8e9827e5ae
2 changed files with 9 additions and 3 deletions

View File

@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Fixed
- #44: protection effect and other default system effects still had duration
when added by the power effect, instead of maintaining their own effect.
## [3.1.1] 2024-07-26
- Added: 'Shape Change Ability' power effect

View File

@ -134,13 +134,12 @@ export class PowerEffect {
static async getStatus(label, name, favorite = true) {
const effect = foundry.utils.deepClone(CONFIG.statusEffects.find((se) => se.label === label || se.name === label));
effect.name = 'name' in effect ? effect.name : effect.label;
effect.duration = {};
if (!('flags' in effect)) {
effect.flags = {};
}
effect.flags.swade = {};
if (favorite) {
if (!('swade' in effect.flags)) {
effect.flags.swade = {};
}
effect.flags.swade.favorite = true;
}
effect.statuses ??= [];