from random import randint class Personnage: def __init__ (self, nom, cat): self.nom = nom self.pdv = 20 self.exp = 1 self.cat = cat self.inventaire = str() if self.cat == "guerrier": self.inventaire = str("épée et potion") self.coefatk = 10 self.coefdef = 8 elif self.cat == "magicien": self.inventaire = str("bâton et potion") self.coefatk = 10 self.coefdef = 7 elif self.cat == "voleur": self.inventaire = str("dague et potion") self.coefatk = 3 self.coefdef = 9 elif self.cat == "elfe": self.inventaire = str("arc et potion") self.coefatk = 8 self.coefdef = 10 else: raise ValueError ("La classe selectionné n'est pas disponible.") def jet_attaque(self): atkdé = randint(1, 20) return self.exp * self.coefatk + atkdé #