diff --git a/src/character/migrations/0017_remove_character_luck_points_max.py b/src/character/migrations/0017_remove_character_luck_points_max.py new file mode 100644 index 0000000..6ad4119 --- /dev/null +++ b/src/character/migrations/0017_remove_character_luck_points_max.py @@ -0,0 +1,17 @@ +# Generated by Django 4.1.2 on 2022-10-30 21:43 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("character", "0016_profile_mana_max_compute"), + ] + + operations = [ + migrations.RemoveField( + model_name="character", + name="luck_points_max", + ), + ] diff --git a/src/character/migrations/max_migration.txt b/src/character/migrations/max_migration.txt index 5e040a1..88a85b5 100644 --- a/src/character/migrations/max_migration.txt +++ b/src/character/migrations/max_migration.txt @@ -1 +1 @@ -0016_profile_mana_max_compute +0017_remove_character_luck_points_max diff --git a/src/character/models/character.py b/src/character/models/character.py index 1ddee1d..c94e626 100644 --- a/src/character/models/character.py +++ b/src/character/models/character.py @@ -130,9 +130,6 @@ class Character(models.Model): ) equipment = models.TextField(blank=True, verbose_name="équipement") - luck_points_max = models.PositiveSmallIntegerField( - verbose_name="points de chance max" - ) luck_points_remaining = models.PositiveSmallIntegerField( verbose_name="points de chance restants" ) @@ -250,6 +247,10 @@ class Character(models.Model): def recovery_points_max(self) -> int: return 5 + @property + def luck_points_max(self) -> int: + return 3 + self.modifier_charisma + def get_capabilities_by_path(self) -> dict[Path, list[Capability]]: capabilities_by_path = collections.defaultdict(list) for capability in self.capabilities.all(): diff --git a/src/character/templates/character/view.html b/src/character/templates/character/view.html index c6a2630..d2990db 100644 --- a/src/character/templates/character/view.html +++ b/src/character/templates/character/view.html @@ -211,9 +211,7 @@ class="btn btn-outline-secondary"> - + {{ character.recovery_points_remaining }} / {{ character.recovery_points_max }} diff --git a/src/character/views.py b/src/character/views.py index c44ce61..983b666 100644 --- a/src/character/views.py +++ b/src/character/views.py @@ -56,7 +56,7 @@ def character_recovery_points_change(request: WSGIRequest, pk: int) -> HttpRespo @login_required def character_luck_points_change(request: WSGIRequest, pk: int) -> HttpResponse: character = get_object_or_404( - Character.objects.only("luck_points_remaining", "luck_points_max"), pk=pk + Character.objects.only("luck_points_remaining", "value_charisma"), pk=pk ) value = get_updated_value( request, character.luck_points_remaining, character.luck_points_max