Browse Source

Nouvelle sauvegarde

master
eleve_nsi 3 months ago
parent
commit
6323a8a699
  1. 51
      mini_projet _jeux_de_role.py

51
mini_projet _jeux_de_role.py

@ -0,0 +1,51 @@
from random import randint
class Personnage:
def __init__ (self, nom,cat):
self.nom=nom
self.pdv=20
self.exp=1
self.cat=cat
self.inventaire =[]
if self.cat == "guerrier":
self.inventaire =["epée , potions"]
self.coefatk=10
self.coefdef=8
elif self.cat == "magicien":
self.inventaire= ["baton , potion"]
self.coefatk=10
self.coefdef=7
elif self.cat=="voleur":
self.iventaire=["dague, potions"]
self.coefatk=3
self.coefdef=8
elif self.cat== "elfe":
self.inventaire= ["arc , potions"]
self.coefatk=8
self.coefdef=10
def jet_attaque(self):
deatk = randint(0,20)
return self.exp*self.coefatk +deatk
def defense(self):
defense = randint(0,20)
return self.exp*self.coefatk
def change_pdv(self):
nb_pdv= 5
self.pdv=self.pdv+ nb_pdv
return self.pdv
def change_exp(self):
nb_exp=1
self.exp= self.exp+ nb_exp
return self.exp
Loading…
Cancel
Save