From e3e9a7c14235eb6ef26027a315d4d6d7067cccba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Brenckl=C3=A9?= Date: Fri, 6 Sep 2024 19:54:38 +0200 Subject: [PATCH] fix(items): Set talent cost when preparing Tree --- CHANGELOG.md | 1 + modules/items/item-ffg.js | 5 +++++ templates/items/ffg-specialization-sheet.html | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 863dfa84..6eb328b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ * Get embedded item data from `system` variable instead of root * Use correct type when importing a Force Boost mods ([#1687](https://github.com/StarWarsFoundryVTT/StarWarsFFG/issues/1687)) * Item attachments' mods use parent item mod type when present ([#1624](https://github.com/StarWarsFoundryVTT/StarWarsFFG/issues/1624)) + * Talent cost set when preparing tree instead of template ([#1704](https://github.com/StarWarsFoundryVTT/StarWarsFFG/issues/1704)) `1.903` * Features: diff --git a/modules/items/item-ffg.js b/modules/items/item-ffg.js index 17c4e56f..ce97d173 100644 --- a/modules/items/item-ffg.js +++ b/modules/items/item-ffg.js @@ -371,6 +371,11 @@ export class ItemFFG extends ItemBaseFFG { } } + if (itemType === "talent") { + const id = parseInt(upgrade.replace("talent", ""), 10); + talents[upgrade].cost = (Math.trunc(id / 4) + 1) * 5; + } + if (typeof talents[upgrade].visible === "undefined") { talents[upgrade].visible = true; } diff --git a/templates/items/ffg-specialization-sheet.html b/templates/items/ffg-specialization-sheet.html index ccb92e96..42e9dc90 100644 --- a/templates/items/ffg-specialization-sheet.html +++ b/templates/items/ffg-specialization-sheet.html @@ -71,7 +71,7 @@ - +