Merge branch 'phase/51-warmth-lesson'

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-20 09:09:55 +03:00
co-authored by Cursor
11 changed files with 118 additions and 25 deletions
+5 -4
View File
@@ -3,9 +3,8 @@ using HSchool.Content;
namespace HSchool.Ai;
/// <summary>
/// How much a lesson adds to one skill this step. Hungry learns worse; trait offsets and the
/// teacher's subject skill scale the rate. The world stores the running total — this is just
/// the number.
/// How much a lesson adds to one skill this step. Hungry or cold learns worse; trait offsets and
/// the teacher's subject skill scale the rate. Missing warmth is treated as 1.
/// </summary>
public static class LessonLearning
{
@@ -54,13 +53,15 @@ public static class LessonLearning
float hours,
float hunger,
int traitOffset,
float teacherSkill)
float teacherSkill,
float warmth = 1f)
{
ArgumentNullException.ThrowIfNull(skill);
var delta = share
* lessonSkillPerHour
* hours
* NeedFactor(hunger)
* NeedFactor(warmth)
* TraitFactor(traitOffset)
* TeacherFactor(teacherSkill);
return Math.Clamp(current + delta, skill.Range.Min, skill.Range.Max);