diff --git a/src/character/templates/character/view.html b/src/character/templates/character/view.html index 3d589bc..93a1b09 100644 --- a/src/character/templates/character/view.html +++ b/src/character/templates/character/view.html @@ -132,6 +132,38 @@ {{ character.attack_magic|modifier }} + + + Bouclier +
+ + + + +
+ + + {{ character.shield }} + + Divers défense diff --git a/src/character/urls.py b/src/character/urls.py index 73fb7d7..852bdd2 100644 --- a/src/character/urls.py +++ b/src/character/urls.py @@ -28,6 +28,11 @@ urlpatterns = [ views.character_defense_misc_change, name="defense_misc_change", ), + path( + "/shield_change/", + views.character_shield_change, + name="shield_change", + ), path( "/get_initiative/", views.character_get_initiative, diff --git a/src/character/views.py b/src/character/views.py index c600169..325d4cc 100644 --- a/src/character/views.py +++ b/src/character/views.py @@ -106,6 +106,18 @@ def character_defense_misc_change(request, pk: int): return trigger_client_event(response, "update_defense", {}) +@login_required +def character_shield_change(request, pk: int): + character = get_object_or_404( + Character.objects.filter(player=request.user).only("shield"), pk=pk + ) + value = get_updated_value(request, character.shield, float("inf")) + character.shield = value + character.save(update_fields=["shield"]) + response = HttpResponse(value) + return trigger_client_event(response, "update_defense", {}) + + @login_required def character_initiative_misc_change(request, pk: int): character = get_object_or_404(