From fef1bcc3b6f896f289db57e3392e3baf54334f35 Mon Sep 17 00:00:00 2001 From: jonathan Date: Wed, 1 Oct 2025 13:16:41 +0200 Subject: [PATCH] cap health at minimum 0 --- scripts/CSharp/Common/Fight/FightUtils.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/CSharp/Common/Fight/FightUtils.cs b/scripts/CSharp/Common/Fight/FightUtils.cs index 5bf0966..823dcc7 100644 --- a/scripts/CSharp/Common/Fight/FightUtils.cs +++ b/scripts/CSharp/Common/Fight/FightUtils.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; namespace Babushka.scripts.CSharp.Common.Fight; @@ -25,7 +26,7 @@ public static class FightUtils public static bool IsAlive(this FightWorld.Fighter self) { - return self.GetHealth() >= 0; + return self.GetHealth() > 0; } public static bool IsDead(this FightWorld.Fighter self) @@ -35,7 +36,7 @@ public static class FightUtils public static int GetHealth(this FightWorld.Fighter self) { - return self.health ?? self.maxHealth; + return Math.Max(self.health ?? self.maxHealth, 0); } public static void AddHealth(this FightWorld.Fighter self, int addHealth)