From 7b5639b95eb5088df99d2834460c33ed3399a287 Mon Sep 17 00:00:00 2001 From: enora <> Date: Mon, 22 Sep 2025 11:00:37 +0200 Subject: [PATCH] commit --- personnageEnora.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/personnageEnora.py b/personnageEnora.py index f47b86b..d09878c 100644 --- a/personnageEnora.py +++ b/personnageEnora.py @@ -1,4 +1,5 @@ from random import randint + class Personnage: def __init__(self, nom, cat): self.nom = nom @@ -87,6 +88,21 @@ def combat(j1, j2): j1.affiche_caracteristiques() j2.affiche_caracteristiques() + if defenseur.pdv - attaquant.pdv > 10 and attaquant.inventaire != []: + attaquant.affiche_inventaire() + print("Veux-tu utiliser quelque chose de ton inventaire? oui (1) non(2)") + bonus = int(input()) + if bonus == 1: + print("Utiliser arme (1) ou potion (2)") + objet = int(input()) + if objet == 1 : + defenseur.change_pdv(-7) + attaquant.inventaire.pop(0) + elif objet == 2: + attaquant.change_pdv(7) + attaquant.inventaire.pop() + + x = 1 while x == 1: while j1.pdv > 0 and j2.pdv > 0: @@ -101,4 +117,5 @@ while x == 1: attaquant.pdv = 20 defenseur.pdv = 20 print("rejouer? oui(1)/ non(0)") - x = int(input()) \ No newline at end of file + x = int(input()) + \ No newline at end of file