From 6435305d58063ffa6b5fe8b35bdfeb12238cce68 Mon Sep 17 00:00:00 2001 From: iisaev Date: Mon, 28 Sep 2026 10:48:06 +0300 Subject: [PATCH] new battle gui --- src/NutritionBehaviour.cs | 64 --------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 src/NutritionBehaviour.cs diff --git a/src/NutritionBehaviour.cs b/src/NutritionBehaviour.cs deleted file mode 100644 index a93dbce..0000000 --- a/src/NutritionBehaviour.cs +++ /dev/null @@ -1,64 +0,0 @@ -using Cthangover.Core.Relationship; -using Cthangover.Core.Settings; - -namespace Cthangover.Core.Relationship -{ - /// - /// Tracks nutrition and starvation for party recruits. - /// Works by recording the tick when a recruit last ate (FullnessTime), - /// then each tick computes the elapsed time as a percentage of a 24-hour window. - /// Once the fullness window expires (100%+), the recruit loses 1 HP per tick - /// until fed again via a ration or meal action. - /// Registered with the behaviour pipeline and called - /// by the time system on each global tick. - /// - public class NutritionBehaviour : IRecruitBehaviour - { - /// - /// Unique behaviour identifier used to look up and configure this - /// behaviour from 's behaviour collection. - /// - public string Id => "nutrition"; - - /// - /// Called when the behaviour is first attached to a recruit. - /// Seeds FullnessTime with the current global tick so that - /// starve-damage begins counting from this point. - /// - public void ConfigureRecruit(Recruit recruit, RuntimeData runtime) - { - recruit.Properties.SetLong("FullnessTime", runtime.Time.Tick); - } - - /// - /// Evaluates whether the recruit has gone beyond the fullness window - /// (24 in-game hours, represented as 24 * 4 * 60 ticks) since - /// FullnessTime. If the window is exceeded, reduces the - /// recruit's PROP_HEALTH by 1 per tick until they are fed. - /// Tick-driven starvation allows gradual death when rations run out. - /// - public void OnTick(Recruit recruit, RuntimeData runtime, long currentTick) - { - var fullnessTime = recruit.Properties.GetLong("FullnessTime"); - if (fullnessTime == 0) - return; - var windowSize = 24 * 4 * 60L; - var deltaTime = currentTick - fullnessTime; - var fullness = (float)deltaTime / windowSize * 100f; - if (fullness > 100) - { - var hp = recruit.Properties.GetInt(Recruit.PROP_HEALTH); - if (hp > 0) - recruit.Properties.SetInt(Recruit.PROP_HEALTH, hp - 1); - } - } - - /// - /// Cleanup hook invoked when the behaviour is detached from a recruit. - /// No persistent state requires teardown; exists for interface contract. - /// - public void OnRemove(Recruit recruit, RuntimeData runtime) - { - } - } -}