Add DiseaseDef diseases with weather vectors and excused absence.

Vanilla ships several diseases whose stages drive lesson gain, stay-home
rolls, and illness attendance; cold/rain/snow raise onset via BehaviorDef scale.
This commit is contained in:
Leonid Pershin
2026-08-21 13:28:57 +03:00
parent 564776883a
commit 2d633411e4
27 changed files with 1188 additions and 38 deletions
+61
View File
@@ -0,0 +1,61 @@
namespace HSchool.Content;
/// <summary>Stable family ids for immunity grouping and realism labels.</summary>
public static class DiseaseFamilies
{
public const string Respiratory = "respiratory";
public const string Gastrointestinal = "gastrointestinal";
public const string Ent = "ent";
}
/// <summary>One severity band on a <see cref="DiseaseDef"/> curve.</summary>
public sealed class DiseaseStage
{
/// <summary>Inclusive lower bound of severity for this stage.</summary>
public float MinSeverity { get; init; }
public float SeverityPerDay { get; init; }
public float ProgressPerDay { get; init; }
/// <summary>Multiplies lesson skill gain while this stage is active (after incubation).</summary>
public float LessonLearningFactor { get; init; } = 1f;
/// <summary>Per-day chance the person stays off campus while in this stage (after incubation).</summary>
public float StayHomeChance { get; init; }
/// <summary>Multiplies Warmth decay. 1 = unchanged.</summary>
public float WarmthDecayFactor { get; init; } = 1f;
}
/// <summary>
/// A named disease: stages, weather vectors, lesson/attendance effects, temporary immunity.
/// Contagion between people is phase 79 — these defs may omit it.
/// </summary>
public sealed class DiseaseDef : Def
{
/// <summary><see cref="DiseaseFamilies"/> id. Required on concrete defs.</summary>
public string Family { get; init; } = "";
/// <summary>Game days after onset before stage effects (lesson / stay-home) apply.</summary>
public float IncubationDays { get; init; }
public IReadOnlyList<DiseaseStage> Stages { get; init; } = [];
/// <summary>Base daily onset chance before weather vectors and <see cref="BehaviorDef.DiseaseVectorScale"/>.</summary>
public float BaseChancePerDay { get; init; }
/// <summary>Street °C at or below this adds <see cref="ColdChancePerDay"/>. Null — no cold vector.</summary>
public float? ColdBelowC { get; init; }
public float ColdChancePerDay { get; init; }
public float RainChancePerDay { get; init; }
public float SnowChancePerDay { get; init; }
/// <summary>Days of immunity to this def after recovery.</summary>
public float ImmunityDays { get; init; }
}