Skip to content

Commit

Permalink
Merge pull request #880 from ben/Fix-highest-of-stat-selection
Browse files Browse the repository at this point in the history
Fix highest-of stat selection
  • Loading branch information
ben authored Sep 27, 2023
2 parents f3a4de4 + cf06821 commit 5046a88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Next Release

- Fix a bug with "highest-of" stat selection, as with _Endure Stress_ ([#880](https://github.com/ben/foundry-ironsworn/pull/880))

## 1.22.3

- Reinstated the template.json to fix installation errors
Expand Down
2 changes: 1 addition & 1 deletion src/module/rolls/preroll-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function chooseStatToRoll(
if (mode === 'Highest' || mode === 'Lowest') {
const statMap = {}
for (const x of normalizedStats) {
statMap[x] = actor.system[x]
statMap[x] = actor.system[x].value ?? actor.system[x]
}
const fn = mode === 'Highest' ? maxBy : minBy
stat = fn(Object.keys(statMap), (x) => statMap[x]) ?? stats[0]
Expand Down

0 comments on commit 5046a88

Please sign in to comment.