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.
|
|
|
from random import randint
|
|
|
|
class Personnage:
|
|
|
|
def __init__(self, nom, cat):
|
|
|
|
self.nom = nom
|
|
|
|
self.pdv = 20
|
|
|
|
self.exp = 1
|
|
|
|
self.cat = cat
|
|
|
|
|
|
|
|
self.switcher_obj = {
|
|
|
|
"guerrier" : "épée",
|
|
|
|
"magicien" : "bâton",
|
|
|
|
"voleur" : "dague",
|
|
|
|
"elfe" : "arc",
|
|
|
|
}
|
|
|
|
self.inventaire = [self.switcher_obj.get(self.cat)]
|
|
|
|
self.inventaire.append("potion")
|
|
|
|
|
|
|
|
def jet_attaque(self):
|
|
|
|
"""renvoie le jet d'attaque"""
|
|
|
|
dé = randint(1,20)
|
|
|
|
self.switcher_classe = {
|
|
|
|
"guerrier" : 10,
|
|
|
|
"magicien" : 10,
|
|
|
|
"voleur" : 3,
|
|
|
|
"elfe" : 8,
|
|
|
|
}
|
|
|
|
self.classe = self.switcher_classe.get(self.cat)
|
|
|
|
return dé + self.exp * self.classe
|
|
|
|
|
|
|
|
def jet_defense(self):
|
|
|
|
"""renvoie le jet de défense"""
|
|
|
|
dé = randint(1,20)
|
|
|
|
self.switcher_classe = {
|
|
|
|
"guerrier" : 8,
|
|
|
|
"magicien" : 7,
|
|
|
|
"voleur" : 3,
|
|
|
|
"elfe" : 8,
|
|
|
|
}
|
|
|
|
self.classe = self.switcher_classe.get(self.cat)
|
|
|
|
return dé + self.exp * self.classe
|
|
|
|
|
|
|
|
def change_pdv(self, nb_pdv):
|
|
|
|
self.pdv += nb_pdv
|
|
|
|
|
|
|
|
def change_exp(self, nb_exp):
|
|
|
|
self.exp += nb_exp
|
|
|
|
|
|
|
|
def affiche_caracteristiques(self):
|
|
|
|
"""affiche les caractéristiques du personnage"""
|
|
|
|
pass
|
|
|
|
def affiche_inventaire(self):
|
|
|
|
"""affiche l'inventaire du personnage"""
|
|
|
|
pass
|