Jeu de rôle mini projet;
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.

59 lines
1.6 KiB

from random import randint
class Personnage:
def __init__ (self, nom, cat):
self.nom = nom
self.pdv = 20
self.exp = 1
self.cat = cat
self.inventaire = []
if self.cat == "guerrier":
self.inventaire = ["épée", "potion"]
self.coefatk = 10
self.coefdef = 8
elif self.cat == "magicien":
self.inventaire = ["bâton", "potion"]
self.coefatk = 10
self.coefdef = 7
elif self.cat == "voleur":
self.inventaire = ["dague", "potion"]
self.coefatk = 3
self.coefdef = 9
elif self.cat == "elfe":
self.inventaire = ["arc", "potion"]
self.coefatk = 8
self.coefdef = 10
else:
raise ValueError ("La classe selectionné n'est pas disponible.")
def jet_attaque(self):
atkdé = randint(1, 20)
return self.exp * self.coefatk + atkdé
def jet_defense(self):
defdé = randint(1, 20)
return self.exp * self.coefdef + defdé
def change_pdv(self):
nb_pdv = 10
if self.jet_defense() > 27 :
self.pdv = self.pdv + nb_pdv
return self.pdv
elif self.jet_defense() < 10 :
self.pdv = self.pdv - nb_pdv
return self.pdv
else:
return self.pdv
def change_exp(self):
nb_exp = 1
if self.jet_attaque() > 23 :
self.exp = self.exp + nb_exp
return self.exp
else :
return self.exp