diff --git a/models.py b/models.py index bf95edb..32d919b 100644 --- a/models.py +++ b/models.py @@ -4,17 +4,20 @@ from flask_restx import fields chartype_field = fields.String( required=True, default="human", - description='Character type. Allowed values: "human", "humanoid", "mutant", "cyborg"') + description='Character type. Allowed values: "human", "humanoid", "mutant", "cyborg"' +) -# Mutations Model -mutation_model = { - 'conscore': fields.Integer( +conscore_field = fields.Integer( required=True, - default=3, + default=10, min=3, max=18, description='The characters constitution score' - ), +) + +# Mutations Model +mutation_model = { + 'conscore': conscore_field, 'intscore': fields.Integer( required=True, default=3, @@ -36,13 +39,13 @@ ability_model = { 'ability': fields.String( required=False, default="all", - description='The ability to roll. Not required. Defaults "generic"'), + description='The ability to roll. Not required. Defaults to "all".'), } # Hp model hp_model = { 'chartype': chartype_field, - 'conscore': fields.Integer(required=True, description='Conscore') + 'conscore': conscore_field } ma_model = { diff --git a/schemas.py b/schemas.py index d92c817..eaad1e1 100644 --- a/schemas.py +++ b/schemas.py @@ -6,28 +6,26 @@ chartype_field = fields.String( description='The characters type of being' ) +conscore_field = fields.Integer( + required=True, + default=10, + validate=validate.Range(min=3, max=18), + description='The constitution score of the character' +) + class MutationSchema(Schema): - conscore = fields.Integer( - required=True, - validate=validate.Range(min=3, max=18), - description='The characters constitution score' - ) + conscore = conscore_field intscore = fields.Integer( required=True, - validate=validate.Range(min=3, max=21), + validate=validate.Range(min=3, max=18), description='The characters intelligence score' ) class HPSchema(Schema): chartype = chartype_field - conscore = fields.Integer( - required=True, - default=10, - validate=validate.Range(min=3, max=24), - description='The constitution score of the character' - ) + conscore = conscore_field class DiceSchema(Schema):