From 50e66c5ae190665601ec6346bae417b02948ef17 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 24 Oct 2019 13:16:33 +0200 Subject: [PATCH] Fix some stuff --- royalnet/packs/rpg/__init__.py | 1 - royalnet/packs/rpg/commands/__init__.py | 2 ++ royalnet/packs/rpg/commands/dndnew.py | 3 ++- royalnet/packs/rpg/commands/dndroll.py | 9 +++++---- royalnet/packs/rpg/tables/dndcharacters.py | 4 ---- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/royalnet/packs/rpg/__init__.py b/royalnet/packs/rpg/__init__.py index 4d839b28..8cb183d1 100644 --- a/royalnet/packs/rpg/__init__.py +++ b/royalnet/packs/rpg/__init__.py @@ -4,4 +4,3 @@ from .commands import available_commands from .tables import available_tables __all__ = ["commands", "tables", "available_commands", "available_tables"] - diff --git a/royalnet/packs/rpg/commands/__init__.py b/royalnet/packs/rpg/commands/__init__.py index 4f481b9b..db8cc1ec 100644 --- a/royalnet/packs/rpg/commands/__init__.py +++ b/royalnet/packs/rpg/commands/__init__.py @@ -5,6 +5,7 @@ from .dndactive import DndactiveCommand from .dndinfo import DndinfoCommand from .dndnew import DndnewCommand from .dndedit import DndeditCommand +from .dndroll import DndrollCommand # Enter the commands of your Pack here! available_commands = [ @@ -14,6 +15,7 @@ available_commands = [ DndinfoCommand, DndnewCommand, DndeditCommand, + DndrollCommand, ] # Don't change this, it should automatically generate __all__ diff --git a/royalnet/packs/rpg/commands/dndnew.py b/royalnet/packs/rpg/commands/dndnew.py index 1f17d157..18a1b540 100644 --- a/royalnet/packs/rpg/commands/dndnew.py +++ b/royalnet/packs/rpg/commands/dndnew.py @@ -39,9 +39,10 @@ class DndnewCommand(Command): column_names = [column.name for column in columns if (not column.primary_key and not column.foreign_keys and column.name != "name")] - message = "ℹ️ [b]Character sheet format:[/b]" + message = "ℹ️ Character Sheet syntax:\n[p]\nName\n" for column_name in column_names: message += f"{column_name} _\n" + message += "[/p]" return message async def run(self, args: CommandArgs, data: CommandData) -> None: diff --git a/royalnet/packs/rpg/commands/dndroll.py b/royalnet/packs/rpg/commands/dndroll.py index c534b1b4..09fdc63a 100644 --- a/royalnet/packs/rpg/commands/dndroll.py +++ b/royalnet/packs/rpg/commands/dndroll.py @@ -91,11 +91,11 @@ class DndrollCommand(Command): advantage = False disadvantage = False - modifier = 0 + extra_modifier = 0 if third: try: - modifier = int(second) + extra_modifier = int(third) except ValueError: raise InvalidInputError("Invalid modifier value (third parameter).") if second.startswith("a") or second.startswith("v"): @@ -107,7 +107,7 @@ class DndrollCommand(Command): elif second: try: - modifier = int(second) + extra_modifier = int(second) except ValueError: if second.startswith("a") or second.startswith("v"): advantage = True @@ -124,7 +124,8 @@ class DndrollCommand(Command): else: raise CommandError("Invalid skill name (first parameter).") - modifier = char.__getattribute__(skill_name) + skill_modifier = char.__getattribute__(skill_name) + modifier = skill_modifier + extra_modifier modifier_str = plusformat(modifier, empty_if_zero=True) if advantage: diff --git a/royalnet/packs/rpg/tables/dndcharacters.py b/royalnet/packs/rpg/tables/dndcharacters.py index 8de0562f..7699d1ef 100644 --- a/royalnet/packs/rpg/tables/dndcharacters.py +++ b/royalnet/packs/rpg/tables/dndcharacters.py @@ -187,10 +187,6 @@ class DndCharacter: def survival_proficiency(self): return Column(Enum(DndProficiencyType), nullable=False, default=DndProficiencyType.NONE) - @declared_attr - def sanity_proficiency(self): - return Column(Enum(DndProficiencyType), nullable=False, default=DndProficiencyType.NONE) - @property def strength_save(self): return self.strength + self.proficiency_bonus * self.strength_save_proficiency.value