You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB

import random as rd
class Personnage:
def __init__(self, nom='Aucun'):
self.nom = nom
self.habilite = 5 + rd.randint(1,4)
self.endurance_max = 7 + rd.randint(1,8)
self.endurance = self.endurance_max
self.force = 2
self.charisme = rd.randint(1,10)
self.vigilance = rd.randint(1,10)
self.discretion = False
self.lieu = None
self.lieu_precedents = []
self.objet = None
def modifier_endurance(self:'Personnage', modificateur):
endurance_modifie = self.endurance + modificateur
if endurance_modifie < 0:
self.endurance = 0
elif endurance_modifie > self.endurance_max:
self.endurance = self.endurance_max
else:
self.endurance = endurance_modifie
def subir_degats(self:'Personnage', degats:int) -> None:
if degats > 0:
self.modifier_endurance(-degats)
def est_hs(self:'Personnage') -> bool :
if self.endurance == 0:
return False
else:
return True
def get_carac(self:'Personnage') -> str:
h = Personnage("Alice")