Skip to content

Commit

Permalink
Merge pull request #1705 from obrenckle/fix_first_talent_cost
Browse files Browse the repository at this point in the history
fix(items): Set talent cost when preparing Tree
  • Loading branch information
wrycu authored Sep 6, 2024
2 parents 5ae1938 + 0907935 commit 4ab3b9c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
* Qualities are linked to parent item ([#1612](https://github.com/StarWarsFoundryVTT/StarWarsFFG/issues/1612))

`1.903`
Expand Down
5 changes: 5 additions & 0 deletions modules/items/item-ffg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion templates/items/ffg-specialization-sheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<input class="talent-hidden" type="text" name="data.talents.{{key}}.itemId" value="{{talent.itemId}}" />
<input class="talent-hidden" type="text" name="data.talents.{{key}}.isRanked" value="{{talent.isRanked}}" data-dtype="Boolean" />
<input class="talent-hidden" type="text" name="data.talents.{{key}}.pack" value="{{talent.pack}}" />
<input class="talent-hidden" type="text" name="data.talents.{{key}}.cost" value="{{calculateSpecializationTalentCost key}}" />
<input class="talent-hidden" type="text" name="data.talents.{{key}}.cost" value="{{talent.cost}}" />
<input class="talent-hidden" type="checkbox" name="data.talents.{{key}}.isForceTalent" data-dtype="Boolean" {{checked talent.isForceTalent}} />
</div>
</div>
Expand Down

0 comments on commit 4ab3b9c

Please sign in to comment.