nommme
2 months ago
commit
1638656cd0
1 changed files with 56 additions and 0 deletions
@ -0,0 +1,56 @@ |
|||||
|
from random import randint |
||||
|
|
||||
|
class Personnage: |
||||
|
def __init__(self,nom,pdv,exp,cat,inventaire): |
||||
|
self.nom = nom |
||||
|
self.pdv = 20 |
||||
|
self.exp = 1 |
||||
|
self.cat = cat |
||||
|
self.inventaire = [] |
||||
|
|
||||
|
if self.cat == "guerrier" : |
||||
|
self.inventaire = ["epee", "potion"] |
||||
|
elif self.cat == "magicien" : |
||||
|
self.inventaire = ["baton", "potion"] |
||||
|
elif self.cat == "voleur" : |
||||
|
self.inventaire = ["dague", "potion"] |
||||
|
elif self.cat == "elfe" : |
||||
|
self.inventaire = ["arc", "potion"] |
||||
|
|
||||
|
def jet_attaque(self): |
||||
|
de = randint(1, 20) |
||||
|
if self.cat == "guerrier": |
||||
|
coeff = self.exp * 10 |
||||
|
if self.cat == "magicien": |
||||
|
coeff = self.exp * 10 |
||||
|
if self.cat == "voleur": |
||||
|
coeff = self.exp * 13 |
||||
|
if self.cat == "elfe": |
||||
|
coeff = self.exp * 8 |
||||
|
val_att = de + coeff |
||||
|
return val_att |
||||
|
|
||||
|
def jet_defense(self): |
||||
|
de = randint(1, 20) |
||||
|
if self.cat == "guerrier": |
||||
|
coeff_2 = self.exp * 8 |
||||
|
if self.cat == "magicien": |
||||
|
coeff_2 = self.exp * 7 |
||||
|
if self.cat == "voleur": |
||||
|
coeff_2 = self.exp * 9 |
||||
|
if self.cat == "elfe": |
||||
|
coeff_2 = self.exp * 10 |
||||
|
val_def = de + coeff_2 |
||||
|
return val_def |
||||
|
|
||||
|
#def affiche_inventaire(self,inventaire): |
||||
|
#def affiche_caracteristiques(self,nom,cat,pdv,exp): |
||||
|
#def change_pdv(self): |
||||
|
#def change_exp(self): |
||||
|
|
||||
|
nom1 = input("Bonjour,Quel est votre nom ?") |
||||
|
cat1 = input("Choisissez la catégorie du joueur 1 : ") |
||||
|
print("Le joueur 1 est un",cat1,) |
||||
|
|
||||
|
cat2 = input("Choisissez la catégorie du joueur 2 : ") |
||||
|
print("Le joueur 2 est un",cat2,) |
Loading…
Reference in new issue