Fix health
This commit is contained in:
parent
17a444d0b5
commit
a98cc869dd
1 changed files with 9 additions and 2 deletions
11
lib/fight.py
11
lib/fight.py
|
@ -105,8 +105,15 @@ class FightHandler:
|
||||||
enemyDef = self.enemyDef
|
enemyDef = self.enemyDef
|
||||||
playerAtk = self.equipped["weapon"].attack
|
playerAtk = self.equipped["weapon"].attack
|
||||||
playerDef = self.equipped["armor"].defense
|
playerDef = self.equipped["armor"].defense
|
||||||
self.hp -= playerAtk - enemyDef # zásah nepříteli
|
|
||||||
self.my -= enemyAtk - playerDef # zásah hráči
|
c = enemyAtk - playerDef
|
||||||
|
e = playerAtk - enemyDef
|
||||||
|
if c < 0:
|
||||||
|
c = 0
|
||||||
|
if e < 0:
|
||||||
|
e = 0
|
||||||
|
self.hp -= e # zásah nepříteli
|
||||||
|
self.my -= c # zásah hráči
|
||||||
self.message = f"{self.lang['enemydmg'].replace('$atk',str(playerAtk - enemyDef)).replace('$name',self.name)}\n{self.lang['playerdmg'].replace('$atk',str(enemyAtk - playerDef)).replace('$name',self.attacks[p][name]['name'])}" # Změnit zprávu
|
self.message = f"{self.lang['enemydmg'].replace('$atk',str(playerAtk - enemyDef)).replace('$name',self.name)}\n{self.lang['playerdmg'].replace('$atk',str(enemyAtk - playerDef)).replace('$name',self.attacks[p][name]['name'])}" # Změnit zprávu
|
||||||
|
|
||||||
def defend(self):
|
def defend(self):
|
||||||
|
|
Reference in a new issue