Browse Source

classe finie

master
erika 2 weeks ago
parent
commit
4eca48a162
  1. 28
      mini projet.py

28
mini projet.py

@ -1,7 +1,7 @@
from random import randint
class Personnage :
def __init__(self, nom, cat) :
def __init__(self, nom, cat) :
self.nom = nom
self.pdv = 20
self.exp = 1
@ -65,7 +65,31 @@ class Personnage :
if self.cat == "voleur":
print("le personnage a : dague, potion ")
if self.cat == "elfe":
print("le personnage a : arc, potion")
print("le personnage a : arc, potion")
def jeu ():
joueur_1_nom = input("quel est le nom du joueur 1 ?")
joueur_1_cat = input("de quel categorie est le joueur 1 ? ; 1= guerrier 2= magicien 3= voleur 4= elfe")
if joueur_1_cat == "1":
joueur_1_cat = "guerrier"
if joueur_1_cat == "2":
joueur_1_cat = "magicien"
if joueur_1_cat == "3":
joueur_1_cat = "voleur"
if joueur_1_cat == "4":
joueur_1_cat = "elfe"
joueur_2_nom = input("quel est le nom du joueur 2 ?")
joueur_2_cat = input("de quel categorie est le joueur 2 ? ; 1= guerrier 2= magicien 3= voleur 4= elfe")
if joueur_2_cat == "1":
joueur_2_cat = "guerrier"
if joueur_2_cat == "2":
joueur_2_cat = "magicien"
if joueur_2_cat == "3":
joueur_2_cat = "voleur"
if joueur_2_cat == "4":
joueur_2_cat = "elfe"
perso1 = Personnage("toto", "guerrier")
return affiche_inventaire

Loading…
Cancel
Save