From f4cd8bdc5ec1edf061eeaa165a78ccfbe5c6ab97 Mon Sep 17 00:00:00 2001 From: julien <> Date: Thu, 10 Sep 2026 13:32:34 +0200 Subject: [PATCH] initialisation + jets --- projet poo.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/projet poo.py b/projet poo.py index e65e3ff..29d50c1 100644 --- a/projet poo.py +++ b/projet poo.py @@ -1 +1,41 @@ from random import randint + +class Personnage : + def __init__(self, nom, cat) : + self.nom = nom + self.cat = cat.lower() + self.pv = 20 + self.exp = 1 + if self.cat == "guerrier" : + self.inv = ["épée", "potion"] + elif self.cat == "magicien" : + self.inv = ["bâton", "potion"] + elif self.cat == "voleur" : + self.inv = ["dague","potion"] + elif self.cat == "elfe" : + self.inv = ["arc","potion"] + + def jet_attaque(self) : + resultat_de = randint(1, 20) + if self.cat == "guerrier" or self.cat == "magicien" : + return resultat_de+self.exp*10 + elif self.cat == "voleur" : + 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" : + return resultat_de+self.exp*8 + elif self.cat == "voleur" : + return resultat_de+self.exp*7 + elif self.cat == "voleur" : + return resultat_de+self.exp*9 + elif self.cat == "elfe" : + return resultat_de+self.exp*10 + + + + +Corentin = Personnage("Corentin", "guerrier") +Xuan = Personnage("Xuan", "Elfe") \ No newline at end of file