Skip to content

Commit

Permalink
fix: Only set difficulty if the highest threshold is > 0 (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Aug 16, 2023
1 parent 4317e07 commit 11c3db7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/tracker/ui/Difficulty.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { tweened } from "svelte/motion";
import { cubicOut } from "svelte/easing";
import { getContext } from "svelte";
import { getRpgSystem } from "src/utils"
import { getRpgSystem } from "src/utils";
import type { RpgSystem } from "src/utils/rpg-system/rpgSystem";
import type InitiativeTracker from "src/main";
Expand All @@ -21,9 +21,13 @@
});
$: {
if ($dif.thresholds.last()) {
if ($dif.thresholds.last().minValue > 0) {
difficultyBar.set(
Math.min($dif.difficulty.value / $dif.thresholds.last().minValue, 1));
Math.min(
$dif.difficulty.value / $dif.thresholds.last().minValue,
1
)
);
}
}
$: summary = $dif.difficulty.summary;
Expand Down

0 comments on commit 11c3db7

Please sign in to comment.