diff --git a/pyproject.toml b/pyproject.toml index 4280ce9..d97b20a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,8 @@ [tool.ruff] src = ["src"] target-version = "py311" + +[tool.ruff.lint] select = ["ALL"] unfixable = ["T20", "RUF001", "RUF002", "RUF003"] @@ -18,7 +20,7 @@ ignore = [ "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` ] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "**/tests/*" = [ "S101", # Use of assert detected. "S106", # Possible hardcoded password. @@ -36,10 +38,10 @@ ignore = [ "RUF001", # String contains ambiguous unicode character ] -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "pep257" -[tool.ruff.mccabe] +[tool.ruff.lint.mccabe] max-complexity = 10 [tool.pytest.ini_options] diff --git a/src/character/forms.py b/src/character/forms.py index cb46f7b..26c5727 100644 --- a/src/character/forms.py +++ b/src/character/forms.py @@ -79,6 +79,12 @@ class CharacterForm(forms.ModelForm): "value_intelligence", "value_wisdom", "value_charisma", + "bonus_strength", + "bonus_dexterity", + "bonus_constitution", + "bonus_intelligence", + "bonus_wisdom", + "bonus_charisma", "health_max", "racial_capability", "weapons", diff --git a/src/character/migrations/0044_character_bonus_charisma_and_more.py b/src/character/migrations/0044_character_bonus_charisma_and_more.py new file mode 100644 index 0000000..d22db0e --- /dev/null +++ b/src/character/migrations/0044_character_bonus_charisma_and_more.py @@ -0,0 +1,61 @@ +# Generated by Django 4.2.9 on 2024-02-11 10:29 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("character", "0043_character_paths"), + ] + + operations = [ + migrations.AddField( + model_name="character", + name="bonus_charisma", + field=models.PositiveSmallIntegerField( + default=0, + verbose_name="bonus charisme", + ), + ), + migrations.AddField( + model_name="character", + name="bonus_constitution", + field=models.PositiveSmallIntegerField( + default=0, + verbose_name="bonus constitution", + ), + ), + migrations.AddField( + model_name="character", + name="bonus_dexterity", + field=models.PositiveSmallIntegerField( + default=0, + verbose_name="bonus dextérité", + ), + ), + migrations.AddField( + model_name="character", + name="bonus_intelligence", + field=models.PositiveSmallIntegerField( + default=0, + verbose_name="bonus intelligence", + ), + ), + migrations.AddField( + model_name="character", + name="bonus_strength", + field=models.PositiveSmallIntegerField( + default=0, + verbose_name="bonus force", + ), + ), + migrations.AddField( + model_name="character", + name="bonus_wisdom", + field=models.PositiveSmallIntegerField( + default=0, + verbose_name="bonus sagesse", + ), + ), + ] diff --git a/src/character/migrations/max_migration.txt b/src/character/migrations/max_migration.txt index 4f3b0c5..31d326e 100644 --- a/src/character/migrations/max_migration.txt +++ b/src/character/migrations/max_migration.txt @@ -1 +1 @@ -0043_character_paths +0044_character_bonus_charisma_and_more diff --git a/src/character/models/character.py b/src/character/models/character.py index 21fa0e8..88e1b61 100644 --- a/src/character/models/character.py +++ b/src/character/models/character.py @@ -223,6 +223,31 @@ class Character(models.Model): value_wisdom = models.PositiveSmallIntegerField(verbose_name="valeur sagesse") value_charisma = models.PositiveSmallIntegerField(verbose_name="valeur charisme") + bonus_strength = models.PositiveSmallIntegerField( + default=0, + verbose_name="bonus force", + ) + bonus_dexterity = models.PositiveSmallIntegerField( + default=0, + verbose_name="bonus dextérité", + ) + bonus_constitution = models.PositiveSmallIntegerField( + default=0, + verbose_name="bonus constitution", + ) + bonus_intelligence = models.PositiveSmallIntegerField( + default=0, + verbose_name="bonus intelligence", + ) + bonus_wisdom = models.PositiveSmallIntegerField( + default=0, + verbose_name="bonus sagesse", + ) + bonus_charisma = models.PositiveSmallIntegerField( + default=0, + verbose_name="bonus charisme", + ) + health_max = models.PositiveSmallIntegerField(verbose_name="points de vie max") health_remaining = models.PositiveSmallIntegerField( verbose_name="points de vie restants", @@ -314,27 +339,27 @@ class Character(models.Model): @property def modifier_strength(self) -> int: - return modifier(self.value_strength) + return modifier(self.value_strength) + self.bonus_strength @property def modifier_dexterity(self) -> int: - return modifier(self.value_dexterity) + return modifier(self.value_dexterity) + self.bonus_dexterity @property def modifier_constitution(self) -> int: - return modifier(self.value_constitution) + return modifier(self.value_constitution) + self.bonus_constitution @property def modifier_intelligence(self) -> int: - return modifier(self.value_intelligence) + return modifier(self.value_intelligence) + self.bonus_intelligence @property def modifier_wisdom(self) -> int: - return modifier(self.value_wisdom) + return modifier(self.value_wisdom) + self.bonus_wisdom @property def modifier_charisma(self) -> int: - return modifier(self.value_charisma) + return modifier(self.value_charisma) + self.bonus_charisma @property def modifier_initiative(self) -> int: diff --git a/src/character/templates/character/character_form.html b/src/character/templates/character/character_form.html index d481927..e35fc2a 100644 --- a/src/character/templates/character/character_form.html +++ b/src/character/templates/character/character_form.html @@ -31,12 +31,18 @@

Compétences

-
{% bootstrap_field form.value_strength %}
-
{% bootstrap_field form.value_dexterity %}
-
{% bootstrap_field form.value_constitution %}
-
{% bootstrap_field form.value_intelligence %}
-
{% bootstrap_field form.value_wisdom %}
-
{% bootstrap_field form.value_charisma %}
+
{% bootstrap_field form.value_strength %}
+
{% bootstrap_field form.bonus_strength %}
+
{% bootstrap_field form.value_dexterity %}
+
{% bootstrap_field form.bonus_dexterity %}
+
{% bootstrap_field form.value_constitution %}
+
{% bootstrap_field form.bonus_constitution %}
+
{% bootstrap_field form.value_intelligence %}
+
{% bootstrap_field form.bonus_intelligence %}
+
{% bootstrap_field form.value_wisdom %}
+
{% bootstrap_field form.bonus_wisdom %}
+
{% bootstrap_field form.value_charisma %}
+
{% bootstrap_field form.bonus_charisma %}

Protection