diff --git a/Mini projet nb1.py b/Mini projet nb1.py index 6bafb67..e1834e2 100644 --- a/Mini projet nb1.py +++ b/Mini projet nb1.py @@ -1,6 +1,6 @@ from random import randint class Personnage: - def __init__(self, nom, pdv, exp, cat): + def __init__(self, nom, cat): pdv = 20 exp = 1 self.nom = nom @@ -8,36 +8,50 @@ class Personnage: self.exp = exp self.cat = cat - if self.cat == "guerrier" - self.inventaire = ["épée","potion"] - self.coef_at = 10 - self.coef_def = 8 + if self.cat == "guerrier": + self.inventaire = ["épée","potion"] + self.coef_at = 10 + self.coef_def = 8 - elif self.cat == "magicien" - self.inventaire = ["baton","potion"] - self.coef_at = 10 - self.coef_def = 7 + elif self.cat == "magicien": + self.inventaire = ["baton","potion"] + self.coef_at = 10 + self.coef_def = 7 - elif self.cat == "voleur" - self.inventaire = ["dague","potion"] - self.coef_at = 3 - self.coef_def = 9 + elif self.cat == "voleur": + self.inventaire = ["dague","potion"] + self.coef_at = 3 + self.coef_def = 9 - elif self.cat == "elfe" - self.inventaire = ["arc","potion"] - self.coef_at = 8 - self.coef_def = 10 + elif self.cat == "elfe": + self.inventaire = ["arc","potion"] + self.coef_at = 8 + self.coef_def = 10 def jet_attaque (self): - lancer_dés = random [1,20] + lancer_dés = randint (1,20) attaque = lancer_dés + self.coef_at * self.exp return attaque def jet_defence (self): - lancer_dés = random [1,20] - defence = lancer_dés + self.esp * self.coef_def + lancer_dés = randint (1,20) + defence = lancer_dés + self.exp * self.coef_def return defence def change_pdv (self): - nb_pdv - \ No newline at end of file + nb_pdv = int(x) + self.pdv = self.pdv + nb_pdv + return self.pdv + + def change_exp (self): + nb_exp = int(x) + self.exp = self.exp + nb_exp + return self.exp + + def affiche_caracteristiques (self): + print ("Je suis", self.nom, "je suis un", self.cat, self.pdv, self.exp) + + def affiche_inventaire (self): + print ("j'ai", self.inventaire) + +p=Personnage("piero","guerrier") \ No newline at end of file