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")