When beetroot is in inventory the player can heal

This commit is contained in:
jonathan
2025-12-11 17:13:28 +01:00
parent f42c2c86b1
commit fef8380a57
16 changed files with 161 additions and 70 deletions
+11 -10
View File
@@ -10,15 +10,16 @@ public static class FightUtils
{
return self.Where(e => e.IsAlive());
}
public static IEnumerable<FightWorld.Fighter> WhereIsNotInFormation(this IEnumerable<FightWorld.Fighter> self, FighterFormation formation)
public static IEnumerable<FightWorld.Fighter> WhereIsNotInFormation(this IEnumerable<FightWorld.Fighter> self,
FighterFormation formation)
{
return self.Where(e => !e.IsInFormation(formation));
}
public static bool IsAlive(this FightWorld.Fighter self)
{
return self.GetHealth() > 0;
return self.Health > 0;
}
public static bool IsDead(this FightWorld.Fighter self)
@@ -26,16 +27,16 @@ public static class FightUtils
return !self.IsAlive();
}
public static int GetHealth(this FightWorld.Fighter self)
/// <summary>
/// Changes the health of a fighter
/// </summary>
/// <param name="self">The fighter itself</param>
/// <param name="amount">The amount of health to add. Make negative to remove health</param>
public static void ChangeHealth(this FightWorld.Fighter self, int amount)
{
return Math.Max(self.health ?? self.maxHealth, 0);
self.Health += amount;
}
public static void AddHealth(this FightWorld.Fighter self, int addHealth)
{
self.health = self.GetHealth() + addHealth;
}
public static bool IsInFormation(this FightWorld.Fighter self, FighterFormation formation)
{
return formation.ContainsFighter(self);