diff --git a/Release_Notes.txt b/Release_Notes.txt index fe1b342..d6db4e4 100644 --- a/Release_Notes.txt +++ b/Release_Notes.txt @@ -1,3 +1,7 @@ +Version 5.1 + +* Fix for #656 removeCondition errors when a condition does not exist in statusEffects + Version 5.0 * Updated for Foundry vtt version 12 diff --git a/script/common/actor.js b/script/common/actor.js index d7a1874..fb4d43a 100644 --- a/script/common/actor.js +++ b/script/common/actor.js @@ -773,14 +773,15 @@ export class SymbaroumActor extends Actor { async addCondition(effect, flagData) { if (typeof effect === "string") { - effect = foundry.utils.duplicate(CONFIG.statusEffects.find((e) => e.id == effect)); + effect = CONFIG.statusEffects.find((e) => e.id == effect); } if (!effect) return "No Effect Found"; if (!effect.id) return "Conditions require an id field"; let existing = this.hasCondition(effect.id); - if (!existing) { + if (!existing) { + effect = foundry.utils.duplicate(effect); effect.label = game.i18n.localize(effect.label)?.replace(/(^\w{1})|(\s+\w{1})/g, (letter) => letter.toUpperCase()); effect.name = game.i18n.localize(effect.name)?.replace(/(^\w{1})|(\s+\w{1})/g, (letter) => letter.toUpperCase()); if (foundry.utils.isNewerVersion('11', game.version) ) { @@ -796,7 +797,7 @@ export class SymbaroumActor extends Actor { } async removeCondition(effect) { - if (typeof effect === "string") effect = foundry.utils.duplicate(CONFIG.statusEffects.find((e) => e.id == effect)); + if (typeof effect === "string") effect = CONFIG.statusEffects.find((e) => e.id == effect); if (!effect) return "No Effect Found"; if (!effect.id) return "Conditions require an id field"; let existing = this.hasCondition(effect.id); diff --git a/system.json b/system.json index d720442..f78cc7f 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "symbaroum", "title": "Symbaroum", "description": "Twilight falls. Davokar darkens.", - "version": "5.0.0", + "version": "5.1.0", "compatibility": { "minimum": 12, "verified": 12,