diff --git a/src/character/admin.py b/src/character/admin.py index ac4dc73..617f319 100644 --- a/src/character/admin.py +++ b/src/character/admin.py @@ -132,7 +132,14 @@ class CharacterAdmin(admin.ModelAdmin): ), ( "Combat", - {"fields": ["initiative", "attack_melee", "attack_range", "attack_magic"]}, + { + "fields": [ + ("initiative_misc", "modifier_initiative"), + "attack_melee", + "attack_range", + "attack_magic", + ] + }, ), ("Vitalité", {"fields": [("health_max", "health_remaining")]}), ("Défense", {"fields": ["armor", "shield", "defense_misc", "defense"]}), @@ -163,7 +170,7 @@ class CharacterAdmin(admin.ModelAdmin): "modifier_intelligence", "modifier_wisdom", "modifier_charisma", - "initiative", + "modifier_initiative", "attack_melee", "attack_range", "attack_magic", diff --git a/src/character/migrations/0027_character_initiative_misc.py b/src/character/migrations/0027_character_initiative_misc.py new file mode 100644 index 0000000..91ef1a9 --- /dev/null +++ b/src/character/migrations/0027_character_initiative_misc.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.2 on 2022-11-02 12:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("character", "0026_alter_capability_name"), + ] + + operations = [ + migrations.AddField( + model_name="character", + name="initiative_misc", + field=models.SmallIntegerField(default=0, verbose_name="divers initiative"), + ), + ] diff --git a/src/character/migrations/max_migration.txt b/src/character/migrations/max_migration.txt index 12f5778..3642965 100644 --- a/src/character/migrations/max_migration.txt +++ b/src/character/migrations/max_migration.txt @@ -1 +1 @@ -0026_alter_capability_name +0027_character_initiative_misc diff --git a/src/character/models/character.py b/src/character/models/character.py index a805bad..ab68831 100644 --- a/src/character/models/character.py +++ b/src/character/models/character.py @@ -148,6 +148,10 @@ class Character(models.Model): shield = models.PositiveSmallIntegerField(verbose_name="bouclier", default=0) defense_misc = models.SmallIntegerField(verbose_name="divers défense", default=0) + initiative_misc = models.SmallIntegerField( + verbose_name="divers initiative", default=0 + ) + capabilities = models.ManyToManyField( "character.Capability", blank=True, verbose_name="capacités" ) @@ -218,8 +222,8 @@ class Character(models.Model): return modifier(self.value_charisma) @property - def initiative(self) -> int: - return self.value_dexterity + def modifier_initiative(self) -> int: + return self.modifier_dexterity + self.initiative_misc @property def attack_melee(self) -> int: diff --git a/src/character/templates/character/view.html b/src/character/templates/character/view.html index eb63d64..3d589bc 100644 --- a/src/character/templates/character/view.html +++ b/src/character/templates/character/view.html @@ -67,11 +67,45 @@