Browse Source

nouvelle sauvegarde

master
jordan 2 months ago
parent
commit
dd9d62580b
  1. 34
      miniprojet.py

34
miniprojet.py

@ -5,25 +5,25 @@ class Personnage:
self.pdv = 20 self.pdv = 20
self.exp = 1 self.exp = 1
self.cat = cat self.cat = cat
self.inventaire = str() self.inventaire = []
if self.cat == "guerrier": if self.cat == "guerrier":
self.inventaire = str("épée et potion") self.inventaire = ["épée", "potion"]
self.coefatk = 10 self.coefatk = 10
self.coefdef = 8 self.coefdef = 8
elif self.cat == "magicien": elif self.cat == "magicien":
self.inventaire = str("bâton et potion") self.inventaire = ["bâton", "potion"]
self.coefatk = 10 self.coefatk = 10
self.coefdef = 7 self.coefdef = 7
elif self.cat == "voleur": elif self.cat == "voleur":
self.inventaire = str("dague et potion") self.inventaire = ["dague", "potion"]
self.coefatk = 3 self.coefatk = 3
self.coefdef = 9 self.coefdef = 9
elif self.cat == "elfe": elif self.cat == "elfe":
self.inventaire = str("arc et potion") self.inventaire = ["arc", "potion"]
self.coefatk = 8 self.coefatk = 8
self.coefdef = 10 self.coefdef = 10
@ -34,4 +34,26 @@ class Personnage:
atkdé = randint(1, 20) atkdé = randint(1, 20)
return self.exp * self.coefatk + atkdé return self.exp * self.coefatk + atkdé
# def jet_defense(self):
defdé = randint(1, 20)
return self.exp * self.coefdef + defdé
def change_pdv(self):
nb_pdv = 10
if self.jet_defense() > 27 :
self.pdv = self.pdv + nb_pdv
return self.pdv
elif self.jet_defense() < 10 :
self.pdv = self.pdv - nb_pdv
return self.pdv
else:
return self.pdv
def change_exp(self):
nb_exp = 1
if self.jet_attaque() > 23 :
self.exp = self.exp + nb_exp
return self.exp
else :
return self.exp
Loading…
Cancel
Save