From c3a25a762b81746c9a36477e89b0ff8c2e3fb6c3 Mon Sep 17 00:00:00 2001 From: julien <> Date: Thu, 10 Sep 2026 13:58:17 +0200 Subject: [PATCH] fin de la classe --- projet poo.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/projet poo.py b/projet poo.py index e704fe4..9161875 100644 --- a/projet poo.py +++ b/projet poo.py @@ -23,6 +23,7 @@ class Personnage : return resultat_de+self.exp*3 elif self.cat == "elfe" : return resultat_de+self.exp*8 + def jet_defense(self) : resultat_de = randint(1,20) if self.cat == "guerrier" : @@ -33,13 +34,23 @@ class Personnage : return resultat_de+self.exp*9 elif self.cat == "elfe" : return resultat_de+self.exp*10 + def change_pv(self, nb_pv) : self.pv += nb_pv + def change_exp(self, nb_exp) : self.exp += nb_exp + + def affiche_caracteristiques(self) : + print(f"Bonjour {self.nom} le {self.cat}, voici tes caractéristiques actuelle :\n- {self.pv} PV \n- {self.exp} EXP") + + def affiche_inventaire(self) : + print(f"Bonjour {self.nom}, voici ton inventaire :") + for i in range(len(self.inv)) : + print(f"- {self.inv[i]}") -Corentin = Personnage("Corentin", "guerrier") -Xuan = Personnage("Xuan", "Elfe") \ No newline at end of file +corentin = Personnage("Corentin", "guerrier") +xuan = Personnage("Xuan", "Elfe") \ No newline at end of file