From bc52d3112a1cb42ed5fed76b95295f28b75e56df Mon Sep 17 00:00:00 2001 From: Shadow15510 Date: Sun, 17 Apr 2022 23:08:05 +0200 Subject: [PATCH] Add magic points on HUD --- idk/idk_lib.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/idk/idk_lib.py b/idk/idk_lib.py index e702cbe..eba2150 100644 --- a/idk/idk_lib.py +++ b/idk/idk_lib.py @@ -104,16 +104,24 @@ def launch_fight(data, stat, event, quest="main"): def routine(data, stat): stat[4] = (stat[4] + 1) % 1440 + # Health regeneration + if stat[0] < 100 and not (stat[4] % 60): + stat[0] += 1 + if stat[0] > 999: stat[0] = 999 + # Mana regeneration - if stat[2][4] < stat[0] // 2 and not (stat[4] % 60): + if stat[2][4] < stat[0] // 2 and not (stat[4] % 30): stat[2][4] += 1 + if stat[2][4] > 99: stat[2][4] = 99 + + def low_bar(data, stat): h = stat[4] // 60 m = stat[4] % 60 if m < 10: m = "0" + str(m) - return "{0}h{1} | {2}PV ".format(h, m, stat[0]) + return "{0}h|{2}PV|{3}PM ".format(h, m, stat[0], stat[2][4]) # Game mecanics @@ -332,13 +340,13 @@ def sleep(data, stat): stat[4] += sleep_hours * 60 if stat[0] < 100: stat[0] += sleep_hours // 2 - if stat[2][4] < 50: stat[2][4] += sleep_hours // 4 + if stat[2][4] < 50: stat[2][4] += sleep_hours # If the player is at home if data[1] == 27: - if stat[0] < 100: stat[0] += 2 * sleep_hours - if stat[2][4] < 50: stat[2][4] += sleep_hours // 2 + if stat[0] < 100: stat[0] += sleep_hours + if stat[2][4] < 50: stat[2][4] += sleep_hours * 2 print_text("Vous vous reposez {0} heure{1}.".format(sleep_hours, ("", "s")[sleep_hours > 1]))