diff --git a/main.py b/main.py index f0bdb00..63627d0 100644 --- a/main.py +++ b/main.py @@ -2,19 +2,23 @@ from random import randint, choice from personnage import Personnage def combat(perso1, perso2): - """simule un combat jusqu'à ce que les joueurs n'aient plus de vies""" - attaquant = perso1 - defenseur = perso2 - while perso1.get_pdv() > 0 and perso1.get_pdv() > 0: - if attaquant.jet_attaque() > defenseur.jet_defense(): - defenseur.change_pdv(-randint(1,8)) - elif attaquant.jet_attaque() < defenseur.jet_defense(): - attaquant.change_pdv(-randint(1,4)) - perso1.affiche_caracteristiques() - perso2.affiche_caracteristiques() - attaquant, defenseur = defenseur , attaquant - #ajouter points d'exp au survivant + """simule un combat jusqu'à ce que les joueurs n'aient plus de vies""" + attaquant = perso1 + defenseur = perso2 + while perso1.get_pdv() > 0 and perso2.get_pdv() > 0: + if attaquant.jet_attaque() > defenseur.jet_defense(): + defenseur.change_pdv(-randint(1,8)) + elif attaquant.jet_attaque() < defenseur.jet_defense(): + attaquant.change_pdv(-randint(1,4)) + perso1.affiche_caracteristiques() + perso2.affiche_caracteristiques() + attaquant, defenseur = defenseur , attaquant + + if perso1.get_pdv() > 0: + perso1.change_exp(1) + else: + perso2.change_exp(1) def main(): - toto = Personnage("toto", choice(["guerrier","magicien","voleur","elfe"])) - baba = Personnage("baba", choice(["guerrier","magicien","voleur","elfe"])) - combat(toto, baba) \ No newline at end of file + toto = Personnage("toto", choice(["guerrier","magicien","voleur","elfe"])) + baba = Personnage("baba", choice(["guerrier","magicien","voleur","elfe"])) + combat(toto, baba) \ No newline at end of file