Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(items): Set talent cost when preparing Tree #1705

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))

`1.903`
* Features:
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