This commit is contained in:
Maxie 2026-09-07 02:03:48 +03:00
parent aaf73e14c1
commit e3726ba03d

14
game.py
View file

@ -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