Skip to content

Commit

Permalink
Improved display of COMPOUNDPOWER costs. dmdorman#1434
Browse files Browse the repository at this point in the history
  • Loading branch information
aeauseth committed Nov 16, 2024
1 parent 25c4333 commit 567f975
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Initial support for Only in Alternate Identity (OIAID). There is a "Heroic Identity" checkbox in the OTHERS tab. [#1431](https://github.com/dmdorman/hero6e-foundryvtt/issues/1431) [#232](https://github.com/dmdorman/hero6e-foundryvtt/issues/232)
- Improved automatic spending of END during combat for continuous powers to prevent spending of resources when rewinding or re-doing a turn. [#1448](https://github.com/dmdorman/hero6e-foundryvtt/issues/1448)
- MAX characteristic is now color coded when different than CORE. [#1461](https://github.com/dmdorman/hero6e-foundryvtt/issues/1461)
- Improved display of COMPOUNDPOWER costs. [#1434](https://github.com/dmdorman/hero6e-foundryvtt/issues/1461)

## Version 4.0.5

Expand Down
9 changes: 9 additions & 0 deletions module/item/item.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4972,6 +4972,15 @@ export class HeroSystem6eItem extends Item {

return this.system.active;
}

get compoundCost() {
if (this.system.XMLID !== "COMPOUNDPOWER") return 0;
let cost = 0;
for (const child of this.childItems) {
cost += parseInt(child.system.realCost);
}
return cost;
}
}

export function getItem(id) {
Expand Down
11 changes: 10 additions & 1 deletion templates/actor/actor-sheet-partial-powers-item.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@
height="24" /></div>
{{/if}}
</td>
<td>{{this.system.realCost}}</td>
<td>{{#if (eq this.system.XMLID "COMPOUNDPOWER")}}
{{this.compoundCost}}
{{else}}
{{#if (eq this.parentItem.system.XMLID "COMPOUNDPOWER")}}
<span style="opacity: 0.5">{{this.system.realCost}}</span>
{{else}}
{{this.system.realCost}}
{{/if}}
{{/if}}
</td>
<td class="left{{#if this.parentItem.type}} item-framework-child-name{{/if}}{{#if this.parentItem.parentItem}}2{{/if}}">
{{#if (and this.childIdx this.parentItem)}}
{{this.childIdx}})
Expand Down

0 comments on commit 567f975

Please sign in to comment.