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.

49 lines
1.6 KiB

from random import randint
class Presonnage:
def __init__ (self,nom,cat):
self.nom = nom
self.pdv = 20
self.exp = 1
self.cat = cat
if self.cat == "guerrier":
self.inventaire = ["épée","potion"]
if self.cat == "magicien":
self.inventaire = ["bâton","potion"]
if self.cat == "voleur":
self.inventaire = ["dague","potion"]
if self.cat == "elfe":
self.inventaire = ["arc","potion"]
def jet_attaque (self):
if self.cat == "guerrier":
return randint (1,20) + self.exp* 10
if self.cat == "magicien":
return randint (1,20) + self.exp* 10
if self.cat == "voleur":
return randint (1,20) + self.exp* 3
if self.cat == "elfe":
return randint (1,20) + self.exp* 8
def jet_defense (self):
if self.cat == "guerrier":
return randint(1,20) + self.exp* 8
if self.cat == "magicien":
return randint(1,20) + self.exp* 7
if self.cat == "voleur":
return randint(1,20) + self.exp* 9
if self.cat == "elfe":
return randint(1,20) + self.exp* 10
def change_pdv (self,nb_pdv):
return nb_pdv + self.pdv
def change_exp (self,nb_exp):
return nb_pdv + self.pdv
def affiche_caracteristiques (self):
print ("ton nom es",self.nom,"tu es un(e)",self.cat,"tu as",self.pdv,"pv","et",self.exp,"exp")
def affiche_inventaire (self):
print (self.inventaire)