New function to combine dice, and use this function for hit dice.

Fixes: https://github.com/canismarko/dungeon-sheets/issues/84
This commit is contained in:
Mark Wolfman
2021-08-08 13:23:15 -05:00
parent 339dd61bce
commit 700541a35d
3 changed files with 42 additions and 2 deletions
+5 -2
View File
@@ -24,6 +24,7 @@ from dungeonsheets import (
from dungeonsheets.content_registry import find_content
from dungeonsheets.weapons import Weapon
from dungeonsheets.content import Creature
from dungeonsheets.dice import combine_dice
dice_re = re.compile(r"(\d+)d(\d+)")
@@ -789,9 +790,11 @@ class Character(Creature):
@property
def hit_dice(self):
"""What type and how many dice to use for re-gaining hit points.
To change, set hit_dice_num and hit_dice_faces."""
return " + ".join([f"{c.level}d{c.hit_dice_faces}" for c in self.class_list])
dice_s = " + ".join([f"{c.level}d{c.hit_dice_faces}" for c in self.class_list])
dice_s = combine_dice(dice_s)
return dice_s
@property
def hit_dice_faces(self):