Files
h-school/src/HSchool.Ai/LessonLearning.cs
T
Leonid Pershin 5cd5a6d258
ci / server (push) Failing after 3m40s
ci / client (push) Successful in 14s
Update decision-making phase and enhance localization for presence tracking
- Marked tasks as complete in the decision-making phase documentation, indicating readiness for implementation.
- Updated the README to reflect the completion status of the decision-making phase.
- Enhanced localization strings to include new presence tracking features, improving user experience.
- Revised the game screen logic to display real-time presence status, including walking states for individuals.
- Added tests to validate the new localization strings and presence functionalities, ensuring robust performance.
2026-08-19 21:00:12 +03:00

29 lines
921 B
C#

using HSchool.Content;
namespace HSchool.Ai;
/// <summary>
/// How much a lesson adds to one skill this step. Hungry learns worse; trait offsets scale the
/// rate. The world stores the running total — this is just the number.
/// </summary>
public static class LessonLearning
{
public static float NeedFactor(float hunger) => Math.Clamp(0.25f + (0.75f * hunger), 0.25f, 1f);
public static float TraitFactor(int offset) => Math.Max(0.1f, 1f + (offset / 100f));
public static float Gain(
float current,
SkillDef skill,
float share,
float lessonSkillPerHour,
float hours,
float hunger,
int traitOffset)
{
ArgumentNullException.ThrowIfNull(skill);
var delta = share * lessonSkillPerHour * hours * NeedFactor(hunger) * TraitFactor(traitOffset);
return Math.Clamp(current + delta, skill.Range.Min, skill.Range.Max);
}
}