diff --git a/src/entities/Statistics.py b/src/entities/Statistics.py index 18b4cc9..1b28c2b 100644 --- a/src/entities/Statistics.py +++ b/src/entities/Statistics.py @@ -1,6 +1,46 @@ class Statistics: def __init__(self): - self.hp - self.hunger - self.thirst - self.stamina + self.hp = 100 + self.hunger = 100 + self.thirst = 100 + self.stamina = 100 + + # methods that don't let the values pass below 0 and over 100 during change + def set_hp(self, hp_diff): + if 0 <= self.hp + hp_diff <= 100: + self.hp = self.hp + hp_diff + else: + if self.hp + hp_diff <= 0: + self.hp = 0 + else: + self.hp = 100 + + def set_hunger(self, hunger_diff): + if 0 <= self.hp + hunger_diff <= 100: + self.hp = self.hp + hunger_diff + else: + if self.hp + hunger_diff <= 0: + self.hp = 0 + else: + self.hp = 100 + + def set_thirst(self, thirst_diff): + if 0 <= self.hp + thirst_diff <= 100: + self.hp = self.hp + thirst_diff + else: + if self.hp + thirst_diff <= 0: + self.hp = 0 + else: + self.hp = 100 + + def set_stamina(self, stamina_diff): + if 0 <= self.hp + stamina_diff <= 100: + self.hp = self.hp + stamina_diff + else: + if self.hp + stamina_diff <= 0: + self.hp = 0 + else: + self.hp = 100 + + +