diff --git a/dungeonsheets/character.py b/dungeonsheets/character.py index f0cf4c4..3a6f411 100644 --- a/dungeonsheets/character.py +++ b/dungeonsheets/character.py @@ -1000,7 +1000,7 @@ class Character(Creature): f"Companion '{beast}' not found. Please add it to" " ``monsters.py``" ) beast = self._resolve_mechanic(beast, monsters.Monster, msg) - self.Ranger.ranger_beast = (beast, self.proficiency_bonus) + self.Ranger.ranger_beast = (beast(), self.proficiency_bonus) @property def companions(self): @@ -1019,7 +1019,7 @@ class Character(Creature): f"Companion '{compa}' not found. Please add it to" " ``monsters.py``" ) new_compa = self._resolve_mechanic(compa, monsters.Monster, msg) - companions_list.append(new_compa) + companions_list.append(new_compa()) # Save the updated list for later self._companions = companions_list diff --git a/dungeonsheets/dice.py b/dungeonsheets/dice.py index 2a64a1c..340a905 100644 --- a/dungeonsheets/dice.py +++ b/dungeonsheets/dice.py @@ -21,7 +21,7 @@ def read_dice_str(dice_str): """ dice_str = dice_str.replace(" ", "").replace("\n", "") - match = dice_re.match(dice_str) + match = dice_re.search(dice_str) if match is None: raise DiceError(f"Cannot interpret dice string {dice_str}") num, faces = int(match.group(1)), int(match.group(2)) @@ -79,8 +79,3 @@ def dice_roll_mean(dice_text): dice = read_dice_str(dice_text) return round(_dice_mean(dice)) -if __name__ == "__main__": - ds = "10d12+10" - v = read_dice_str(ds) - print(v) - print(_dice_mean(v)) \ No newline at end of file diff --git a/dungeonsheets/make_sheets.py b/dungeonsheets/make_sheets.py index 3ebf558..d181605 100644 --- a/dungeonsheets/make_sheets.py +++ b/dungeonsheets/make_sheets.py @@ -92,7 +92,7 @@ def create_monsters_content( template = jinja_env.get_template(base_template+f".{suffix}") spell_list = [Spell() for monster in monsters for Spell in monster.spells] return template.render(monsters=monsters, - use_dnd_decorations=use_dnd_decorations, spell_list=spell_list) + use_dnd_decorations=use_dnd_decorations, spell_list=spell_list) def create_gm_spellbook(spell_list, suffix):