cap health at minimum 0

pull/22/head
jonathan 3 months ago
parent f4d8ed87e2
commit fef1bcc3b6

@ -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)

Loading…
Cancel
Save