Files
h-school/src/HSchool.Content/DiseaseDefs.cs
T
Leonid PershinandCursor 4a52107bd2 Add person-to-person disease contagion with outbreak notices.
Node/class contact rolls use pair+day seeds; vanilla respiratory diseases spread, and a threshold raises an info toast instead of per-sneeze noise.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-21 13:55:24 +03:00

76 lines
2.8 KiB
C#

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,
/// and optional person-to-person contagion (node and/or class).
/// </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; }
/// <summary>
/// Daily chance to infect each other person sharing the same map node. 0 — no node contagion.
/// </summary>
public float NodeContagionChancePerDay { get; init; }
/// <summary>
/// Daily chance to infect each classmate (same <c>ClassId</c>) while both are on campus.
/// 0 — no class contagion.
/// </summary>
public float ClassContagionChancePerDay { get; init; }
/// <summary>When true, the carrier can infect during incubation before stage effects apply.</summary>
public bool ContagiousDuringIncubation { get; init; }
}