Skip to content

Commit

Permalink
fix: Creature difficulty now won't display if CR is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed May 9, 2023
1 parent dca66ab commit a1079c4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
10 changes: 8 additions & 2 deletions src/builder/view/creatures/Creature.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@
return stringify(source, 0, ", ", false);
}
$: insignificant = convertFraction(creature.cr) < $average - 3;
$: challenge = convertFraction(creature.cr) > $average + 3;
$: insignificant =
"cr" in creature &&
creature.cr &&
convertFraction(creature.cr) < $average - 3;
$: challenge =
"cr" in creature &&
creature.cr &&
convertFraction(creature.cr) > $average + 3;
const baby = (node: HTMLElement) => setIcon(node, "baby");
const skull = (node: HTMLElement) => setIcon(node, "skull");
Expand Down
13 changes: 8 additions & 5 deletions src/builder/view/encounter/Creature.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
new ExtraButtonComponent(node).setIcon("trash-2");
};
export let count: number;
export let creature: SRDMonster;
const convertedCR = (cr: string | number) => {
Expand All @@ -38,11 +36,16 @@
}
return cr;
};
const insignificant = convertFraction(creature.cr) < $average - 3;
$: insignificant =
"cr" in creature &&
creature.cr &&
convertFraction(creature.cr) < $average - 3;
$: challenge =
"cr" in creature &&
creature.cr &&
convertFraction(creature.cr) > $average + 3;
const baby = (node: HTMLElement) => setIcon(node, "baby");
const challenge = convertFraction(creature.cr) > $average + 3;
const skull = (node: HTMLElement) => setIcon(node, "skull");
Expand Down

0 comments on commit a1079c4

Please sign in to comment.