mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Don't add units with invalid health values
This commit is contained in:
parent
af778309bf
commit
c5a0f7ad7f
1 changed files with 7 additions and 1 deletions
|
@ -5,6 +5,7 @@ import royalnet.utils as ru
|
|||
from ..types import Faction
|
||||
from ..tables import DndBattleUnit
|
||||
from ..utils import get_active_battle
|
||||
from ..types import Health
|
||||
|
||||
|
||||
class DndaddunitCommand(rc.Command):
|
||||
|
@ -37,6 +38,11 @@ class DndaddunitCommand(rc.Command):
|
|||
if len(units_with_same_name) != 0:
|
||||
raise rc.InvalidInputError("A unit with the same name already exists.")
|
||||
|
||||
try:
|
||||
health = Health.from_text(health)
|
||||
except ValueError:
|
||||
raise rc.InvalidInputError("Invalid health string.")
|
||||
|
||||
dbu = DndBattleUnitT(
|
||||
linked_character_id=None,
|
||||
initiative=initiative,
|
||||
|
|
Loading…
Reference in a new issue