baptist.guillaume
1 year ago
1 changed files with 34 additions and 1 deletions
@ -1,2 +1,35 @@ |
|||||
|
from random import randint |
||||
|
|
||||
class Personnage: |
class Personnage: |
||||
|
def __init__(self, nom, cat): |
||||
|
self.nom = nom |
||||
|
self.pdv = 20 |
||||
|
self.exp = 1 |
||||
|
self.cat = cat |
||||
|
if self.cat == "guerrier": |
||||
|
inv = ["épée", "potion"] |
||||
|
elif self.cat == "magicien": |
||||
|
inv = ["bâton", "potion"] |
||||
|
elif self.cat == "voleur": |
||||
|
inv = ["dague", "potion"] |
||||
|
elif self.cat == "elfe": |
||||
|
inv = ["arc", "potion"] |
||||
|
|
||||
|
|
||||
|
def jet_attaque(self): |
||||
|
attaque = randint (1,20) |
||||
|
def jet_defense(self): |
||||
|
defense = randint (1,20) |
||||
|
|
||||
|
def change_pdv(self, nb_pdv): |
||||
|
pdv += nb_pdv |
||||
|
def change_exp(self, nb_exp): |
||||
|
exp += nb_exp |
||||
|
def affiche_caracteristiques(self): |
||||
|
print("Le nom de votre personnage est:", self.nom,".") |
||||
|
print("Votre personnage est un(e):", self.cat,".") |
||||
|
print("Votre personnage possède", self.pdv, "points de vie.") |
||||
|
print("Votre personnage possède", self.exp, "d'expérience.") |
||||
|
def affiche_inventaire(self): |
||||
|
print("Inventaire de votre personnage:", self.inv) |
||||
|
|
Loading…
Reference in new issue