Skip to content

Commit

Permalink
fix: ignore null player levels when finding daily budget
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Jan 12, 2024
1 parent 434c0e6 commit 48dc637
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/utils/rpg-system/dnd5e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,16 @@ ${thresholdSummary}`;
return [
{
displayName: "Daily Budget",
minValue: playerLevels.reduce(
(acc, lv) =>
acc +
XP_THRESHOLDS_PER_LEVEL[Math.max(1, Math.min(lv, 20))]
.daily,
0
)
minValue: playerLevels
.filter((l) => l && l > 0)
.reduce(
(acc, lv) =>
acc +
XP_THRESHOLDS_PER_LEVEL[
Math.max(1, Math.min(lv, 20))
].daily,
0
)
}
];
}
Expand Down

0 comments on commit 48dc637

Please sign in to comment.