You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.2 KiB

from random import randint
class Personnage:
def __init__(self, nom, cat):
self.nom = nom
self.hp = 20
self.xp = 1
self.cat = cat
if self.cat == 'Guerrier':
self.inv = ['Épée', 'Potion']
if self.cat == 'Magicien':
self.inv = ['Bâton', 'Potion']
if self.cat == 'Voleur':
self.inv = ['Dague', 'Potion']
if self.cat == 'Elfe':
self.inv = ['Arc', 'Potion']
def jet_attaque(self):
= randint(1,20)
print("Votre lancer a fait le nombre :", )
if self.cat == 'Guerrier' or self.cat == 'Magicien':
return + self.xp * 10
if self.cat == 'Voleur':
return + self.xp * 3
if self.cat == 'Elfe':
return + self.xp * 8
def jet_defense(self):
pass
= randint(1,20)
print("Votre lancer a fait le nombre :", )
if self.cat == 'Guerrier':
return + self.xp * 8
if self.cat == 'Magicien':
return + self.xp * 7
if self.cat == 'Voleur':
return + self.xp * 9
if self.cat == 'Elfe':
return + self.xp * 10
def change_hp(self, nb_hp):
self.hp = nb_hp + self.hp
def change_xp(self, nb_xp):
self.xp = nb_xp + self.xp
def affiche_caracteristiques(self):
# print("Votre personnage s'apelle :", self.nom ,".Il appartient a la categorie des:", self.cat ,".Il a acctuellement", self.hp ," points de vie et ", self.xp ,"d'experience.")
print(f"Votre nom : {self.nom}\n"
f"Votre categorie : {self.cat}\n"
f"Vos points de vie : {self.hp}\n"
f"Votre experience : {self.xp}\n")
def affiche_inventaire(self):
if self.cat == 'Guerrier':
print("Votre personnage a : Épée, Potion")
if self.cat == 'Magicien':
print("Votre personnage a : Bâton, Potion")
if self.cat == 'Voleur':
print("Votre personnage a : Dague, Potion")
if self.cat == 'Elfe':
print("Votre personnage a : Arc, Potion")