From a56e6bab3dd400db33bf36969658f1d79bbbbf44 Mon Sep 17 00:00:00 2001 From: Byroks Date: Wed, 13 Dec 2023 18:46:49 +0100 Subject: [PATCH] Automatically select skill for effects (#59) Changes: + when a mod gets added, check if it's a skill + if it's a skill, find appropiate ID in actors item list and apply it to the mod --- source/module/items/M5Item.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/module/items/M5Item.ts b/source/module/items/M5Item.ts index 7421e50..cc942ff 100644 --- a/source/module/items/M5Item.ts +++ b/source/module/items/M5Item.ts @@ -145,6 +145,11 @@ export class M5Item extends Item { } if (itemData?.mods) { calc.mods = {}; + for (let modKey in itemData.mods) { + if (itemData.mods[modKey].type === M5ModType.SKILL && itemData.mods[modKey].id?.includes("midgard5")) { + itemData.mods[modKey].id = actor?.items.find((x) => x.name === game["i18n"].localize(itemData.mods[modKey].id))?.id; + } + } Object.keys(itemData?.mods).forEach((key) => { const mod = itemData.mods[key];