diff --git a/Mini projet nb1.py b/Mini projet nb1.py index cd70709..89ec661 100644 --- a/Mini projet nb1.py +++ b/Mini projet nb1.py @@ -39,12 +39,11 @@ class Personnage: defence = lancer_dés + self.exp * self.coef_def return defence - def change_pdv (self): - nb_pdv = int(x) + def change_pdv (self, nb_pdv): self.pdv = self.pdv + nb_pdv return self.pdv - def change_exp (self): + def change_exp (self, nb_exp): nb_exp = int(x) self.exp = self.exp + nb_exp return self.exp @@ -67,10 +66,18 @@ def jouer(): p2 = Personnage (nomP2, catP2) while p1.pdv > 0 and p2.pdv > 0: - p1.jet_attaque - p2.jet_defense + ja = p1.jet_attaque() + jd = p2.jet_defense() + if ja > jd : + p2.change_pdv(-randint(1,8)) #p2 perd des point de vie + elif jd > ja : + p1..change_pdv(-randint(1,4)) + if p1.pdv > 0 and p2.pdv > 0: - p2.jet_attaque - p1.jet_defense - else : - print ("you are dead") \ No newline at end of file + ja = p2.jet_attaque() + jd = p1.jet_defense() + if ja > jd : + p2.change_pdv(-randint(1,8)) #p2 perd des point de vie + elif jd > ja : + p1..change_pdv(-randint(1,4)) + \ No newline at end of file