Skip to content

Commit

Permalink
fix: fixes issue where levels other than 1-20 caused encounter calcul…
Browse files Browse the repository at this point in the history
…ation errors
  • Loading branch information
valentine195 committed May 8, 2023
1 parent 4b0139f commit 4599fc6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils/encounter-difficulty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ const tresholds: BudgetDict = {

function xpBudget(characterLevels: number[]): XpBudget {
const easy = characterLevels.reduce(
(acc, lvl) => acc + tresholds[lvl].easy,
(acc, lvl) => acc + (tresholds[lvl]?.easy ?? 0),
0
);
const medium = characterLevels.reduce(
(acc, lvl) => acc + tresholds[lvl].medium,
(acc, lvl) => acc + (tresholds[lvl]?.medium ?? 0),
0
);
const hard = characterLevels.reduce(
(acc, lvl) => acc + tresholds[lvl].hard,
(acc, lvl) => acc + (tresholds[lvl]?.hard ?? 0),
0
);
const deadly = characterLevels.reduce(
(acc, lvl) => acc + tresholds[lvl].deadly,
(acc, lvl) => acc + (tresholds[lvl]?.deadly ?? 0),
0
);
return { easy: easy, medium: medium, hard: hard, deadly: deadly };
Expand Down

0 comments on commit 4599fc6

Please sign in to comment.