Skip to content

Commit

Permalink
fix: Check for hit_dice property in hp dice callback for the Basi…
Browse files Browse the repository at this point in the history
…c 5e Layout
  • Loading branch information
valentine195 committed Apr 30, 2024
1 parent 133c36e commit fb2bbe6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/layouts/basic 5e/basic5e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ export const Statblock5e: StatblockItem[] = [
display: "Hit Points",
dice: true,
diceProperty: "hit_dice",
diceCallback: `return [{ text: monster["hit_dice"] }]`,
diceCallback: `if ("hit_dice" in monster) {
return [{ text: monster["hit_dice"] }];
} else {
return property;
}`,
callback:
'let str = [monster.hp];\nif (monster.hit_dice?.length) {\n str.push(`(${monster.hit_dice})`);\n}\nreturn str.join(" ");',
conditioned: true
Expand Down

0 comments on commit fb2bbe6

Please sign in to comment.