From e3726ba03d8d3a58b28094d5f055adc4ce979254 Mon Sep 17 00:00:00 2001 From: Maxie <79106345+MaximIce1@users.noreply.github.com> Date: Mon, 7 Sep 2026 02:03:48 +0300 Subject: [PATCH] module 1 --- game.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/game.py b/game.py index 1f2c116..f05e1cb 100644 --- a/game.py +++ b/game.py @@ -24,6 +24,13 @@ class Unit(ABC): class Monster(Unit): + def __init__(self, strength, dexterity, constitution, wisdom, intelligence, charisma): + super().__init__(strength, dexterity, constitution, wisdom, intelligence, charisma) + self.max_health = self.calculate_max_health() + self.defense = self.calculate_max_health() + self.damage = self.calculate_damage() + + @override def calculate_damage(self): return self.strength * 2 + self.constitution / 5 @@ -37,6 +44,13 @@ class Monster(Unit): return self.constitution * 1.2 + self.strength / 5 class Character(Unit): + def __init__(self, strength, dexterity, constitution, wisdom, intelligence, charisma): + super().__init__(strength, dexterity, constitution, wisdom, intelligence, charisma) + # self.character_class = char_class + self.max_health = self.calculate_max_health() + self.defense = self.calculate_max_health() + self.damage = self.calculate_damage() + @override def calculate_max_health(self): return self.constitution * 10 + self.strength / 2