Add player health

This commit is contained in:
Matyáš Caras 2022-05-16 17:51:17 +02:00
parent 01077b14bb
commit d39971b852
3 changed files with 8 additions and 0 deletions

View file

@ -44,9 +44,15 @@ class FightHandler:
system("cls||clear") system("cls||clear")
p = math.trunc(self.hp/self.max*10) p = math.trunc(self.hp/self.max*10)
h = "🟥"*p h = "🟥"*p
j = math.trunc(self.my/30*10)
a = "🟩"*j
if str(p).endswith(".5"): if str(p).endswith(".5"):
h += "" h += ""
if str(a).endswith(".5"):
a += ""
print(self.message) print(self.message)
print(f"{self.lang['you']} {a} {self.my}/30")
print(f"{self.name} {h} {self.hp}/{self.max}") print(f"{self.name} {h} {self.hp}/{self.max}")
if self.img != "": if self.img != "":
anim = AsciiAnimation() anim = AsciiAnimation()

View file

@ -33,6 +33,7 @@ playerdmg: "Nepřítel použil $name a poškodil tě za $atk bodů."
defended: "Rozhodneš se bránit a nedostal jsi tak žádný zásah." defended: "Rozhodneš se bránit a nedostal jsi tak žádný zásah."
defeated: "Porazil jsi $enemy." defeated: "Porazil jsi $enemy."
defeat: "$enemy tě zabil. Budeš to muset zkusit znovu." defeat: "$enemy tě zabil. Budeš to muset zkusit znovu."
you: "Ty"
error_loading: 'Při načítání YAML souboru nastala chyba:' error_loading: 'Při načítání YAML souboru nastala chyba:'
no_action: 'Chyba: žádná akce "$action" nenalezena v souboru hry' no_action: 'Chyba: žádná akce "$action" nenalezena v souboru hry'

View file

@ -33,6 +33,7 @@ playerdmg: "The enemy used $name to damage you by $atk"
defended: "You decide to defend yourself and take no damage." defended: "You decide to defend yourself and take no damage."
defeated: "You have defeated $enemy." defeated: "You have defeated $enemy."
defeat: "$enemy has slain you. You'll have to try again." defeat: "$enemy has slain you. You'll have to try again."
you: "You"
error_loading: 'An exception has occured while loading the game from the YAML file' error_loading: 'An exception has occured while loading the game from the YAML file'
no_action: 'Error: No action "$action" found in the game file.' no_action: 'Error: No action "$action" found in the game file.'