1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Fix some stuff

This commit is contained in:
Steffo 2019-10-24 13:16:33 +02:00
parent a3b47cfc73
commit 50e66c5ae1
5 changed files with 9 additions and 10 deletions

View file

@ -4,4 +4,3 @@ from .commands import available_commands
from .tables import available_tables from .tables import available_tables
__all__ = ["commands", "tables", "available_commands", "available_tables"] __all__ = ["commands", "tables", "available_commands", "available_tables"]

View file

@ -5,6 +5,7 @@ from .dndactive import DndactiveCommand
from .dndinfo import DndinfoCommand from .dndinfo import DndinfoCommand
from .dndnew import DndnewCommand from .dndnew import DndnewCommand
from .dndedit import DndeditCommand from .dndedit import DndeditCommand
from .dndroll import DndrollCommand
# Enter the commands of your Pack here! # Enter the commands of your Pack here!
available_commands = [ available_commands = [
@ -14,6 +15,7 @@ available_commands = [
DndinfoCommand, DndinfoCommand,
DndnewCommand, DndnewCommand,
DndeditCommand, DndeditCommand,
DndrollCommand,
] ]
# Don't change this, it should automatically generate __all__ # Don't change this, it should automatically generate __all__

View file

@ -39,9 +39,10 @@ class DndnewCommand(Command):
column_names = [column.name for column in columns if (not column.primary_key and column_names = [column.name for column in columns if (not column.primary_key and
not column.foreign_keys and not column.foreign_keys and
column.name != "name")] column.name != "name")]
message = " [b]Character sheet format:[/b]" message = " Character Sheet syntax:\n[p]\nName\n"
for column_name in column_names: for column_name in column_names:
message += f"{column_name} _\n" message += f"{column_name} _\n"
message += "[/p]"
return message return message
async def run(self, args: CommandArgs, data: CommandData) -> None: async def run(self, args: CommandArgs, data: CommandData) -> None:

View file

@ -91,11 +91,11 @@ class DndrollCommand(Command):
advantage = False advantage = False
disadvantage = False disadvantage = False
modifier = 0 extra_modifier = 0
if third: if third:
try: try:
modifier = int(second) extra_modifier = int(third)
except ValueError: except ValueError:
raise InvalidInputError("Invalid modifier value (third parameter).") raise InvalidInputError("Invalid modifier value (third parameter).")
if second.startswith("a") or second.startswith("v"): if second.startswith("a") or second.startswith("v"):
@ -107,7 +107,7 @@ class DndrollCommand(Command):
elif second: elif second:
try: try:
modifier = int(second) extra_modifier = int(second)
except ValueError: except ValueError:
if second.startswith("a") or second.startswith("v"): if second.startswith("a") or second.startswith("v"):
advantage = True advantage = True
@ -124,7 +124,8 @@ class DndrollCommand(Command):
else: else:
raise CommandError("Invalid skill name (first parameter).") 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) modifier_str = plusformat(modifier, empty_if_zero=True)
if advantage: if advantage:

View file

@ -187,10 +187,6 @@ class DndCharacter:
def survival_proficiency(self): def survival_proficiency(self):
return Column(Enum(DndProficiencyType), nullable=False, default=DndProficiencyType.NONE) 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 @property
def strength_save(self): def strength_save(self):
return self.strength + self.proficiency_bonus * self.strength_save_proficiency.value return self.strength + self.proficiency_bonus * self.strength_save_proficiency.value