module 1
This commit is contained in:
parent
aaf73e14c1
commit
e3726ba03d
1 changed files with 14 additions and 0 deletions
14
game.py
14
game.py
|
|
@ -24,6 +24,13 @@ class Unit(ABC):
|
||||||
|
|
||||||
|
|
||||||
class Monster(Unit):
|
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
|
@override
|
||||||
def calculate_damage(self):
|
def calculate_damage(self):
|
||||||
return self.strength * 2 + self.constitution / 5
|
return self.strength * 2 + self.constitution / 5
|
||||||
|
|
@ -37,6 +44,13 @@ class Monster(Unit):
|
||||||
return self.constitution * 1.2 + self.strength / 5
|
return self.constitution * 1.2 + self.strength / 5
|
||||||
|
|
||||||
class Character(Unit):
|
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
|
@override
|
||||||
def calculate_max_health(self):
|
def calculate_max_health(self):
|
||||||
return self.constitution * 10 + self.strength / 2
|
return self.constitution * 10 + self.strength / 2
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue