|
|
|
from random import*
|
|
|
|
class Personnage:
|
|
|
|
def __init__(self, nom, cat):
|
|
|
|
self.nom = nom
|
|
|
|
self.cat = cat
|
|
|
|
self.pdv = 100
|
|
|
|
self.exp = 1
|
|
|
|
self.coef = 0
|
|
|
|
self.inventaire = []
|
|
|
|
if self.cat == "Géant":
|
|
|
|
self.inventaire = ["3 Rochers géants", "Grosse potion"]
|
|
|
|
self.coefAtk = 6
|
|
|
|
self.coefDef = 10
|
|
|
|
elif self.cat == "Fée":
|
|
|
|
self.inventaire = ["Arc féerique", "Potion"]
|
|
|
|
self.coefAtk = 9
|
|
|
|
self.coefDef = 7
|
|
|
|
elif self.cat == "Démon":
|
|
|
|
self.inventaire = ["épée malveillante", "Potion"]
|
|
|
|
self.coefAtk = 8
|
|
|
|
self.coefDef = 8
|
|
|
|
elif self.cat == "Déesee":
|
|
|
|
self.inventaire = ["Bâton miraculeux", "Potion"]
|
|
|
|
self.coefAtk = 7
|
|
|
|
self.coefDef = 9
|
|
|
|
|
|
|
|
def jet_attaque(self):
|
|
|
|
atkPoints = randint(1, 20)
|
|
|
|
return atkPoints + self.exp*self.coefAtk
|
|
|
|
|
|
|
|
def jet_defense(self):
|
|
|
|
defPoints = randint(1, 20)
|
|
|
|
return defPoints + self.exp*self.coefDef
|
|
|
|
|
|
|
|
def change_pdv(self, nb_pdv):
|
|
|
|
self.pdv = self.pdv + nb_pdv
|
|
|
|
|
|
|
|
PersoTEST = Personnage("Moi", "Fée")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|