Browse Source

nouvelle sauvegarde

master
jordan 3 months ago
parent
commit
98caf08b5b
  1. 35
      miniprojet.py

35
miniprojet.py

@ -1,12 +1,37 @@
from random import randint from random import randint
class Personnage: class Personnage:
def __init__ (self, nom, pdv, exp, cat): def __init__ (self, nom, cat):
self.nom = nom self.nom = nom
self.pdv = pdv self.pdv = 20
self.exp = exp self.exp = 1
self.cat = cat self.cat = cat
self.inventaire = self.inventaire = str()
if self.cat == "guerrier":
self.inventaire = str("épée et potion")
self.coefatk = 10
self.coefdef = 8
elif self.cat == "magicien":
self.inventaire = str("bâton et potion")
self.coefatk = 10
self.coefdef = 7
elif self.cat == "voleur":
self.inventaire = str("dague et potion")
self.coefatk = 3
self.coefdef = 9
elif self.cat == "elfe":
self.inventaire = str("arc et potion")
self.coefatk = 8
self.coefdef = 10
else:
raise ValueError ("La classe selectionné n'est pas disponible.")
def jet_attaque(self): def jet_attaque(self):
atkdé = randint(1, 20)
return self.exp * self.coefatk + atkdé
#
Loading…
Cancel
Save