From 9c71e6106282e5376fec058a845a9d16e56ab32d Mon Sep 17 00:00:00 2001 From: Denis Leenaerts <> Date: Wed, 9 Sep 2026 20:44:48 +0200 Subject: [PATCH] creation des premieres methodes et du innit de Personnage --- projet.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/projet.py b/projet.py index e69de29..8e8c534 100644 --- a/projet.py +++ b/projet.py @@ -0,0 +1,24 @@ +from random import randint + +class Personnage: + def __init__(self,nom : str,cat : int) -> None: + self.nom = nom + self.pdv = 20 + self.exp = 1 + self.cat = cat - 1 + + if self.cat == "0": #0 = guerrier + self.inventaire = ["épée","potion"] + elif self.cat == "1":#1 = magicien + self.inventaire = ["bâton","potion"] + elif self.cat == "2":#2 = voleur + self.inventaire = ["dague","potion"] + elif self.cat == "3":#3 = elfe + self.inventaire = ["arc","potion"] + + def jet_attaque(self) -> int: + degatsAttaque = [10,10,3,8] #guerrier,magicien,voleur,elfe + return randint(1,20) + self.exp*degatsAttaque[self.cat] + def jet_defense(self) -> int: + degatsDefense = [8,7,9,10] + return randint(1,20) + self.exp*degatsDefense[self.cat] \ No newline at end of file