aboutsummaryrefslogtreecommitdiff
path: root/engine/health/health.ts
blob: 4c69d34a22497e5a49ee413d6075160a8ed4825b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import type { GameTime } from '@hollowdark/time/gameTime'

export type EatingPattern = 'poor' | 'irregular' | 'moderate' | 'good' | 'athletic'

/** Alcohol, smoking, drugs, activity level — the background variables that
 *  compound into long-term health outcomes. */
export interface LifestyleProfile {
  readonly alcohol: number
  readonly smoking: number
  readonly drugs: number
  readonly activity: number
  readonly diet: number
  readonly compositeRisk: number
}

export interface SexualHealthState {
  readonly activeInfections: readonly string[]
  readonly pastInfections: readonly string[]
  readonly contraceptionInUse: string | null
  readonly fertility: number
}

/** A symptom visible to the character (or to those around them). */
export interface Symptom {
  readonly id: string
  readonly kind: string
  readonly severity: number
  readonly onsetAt: GameTime
  readonly isChronic: boolean
}

/** A condition the character knows about and has a name for. */
export interface Condition {
  readonly id: string
  readonly kind: string
  readonly diagnosedAt: GameTime | null
  readonly severity: number
  readonly isTerminal: boolean
  readonly mortalityMultiplier: number
  readonly managementInPlace: boolean
}

/**
 * A condition the simulation tracks but the character doesn't yet know
 * about. Surface paths include worsening symptoms, doctor visits, routine
 * screens, or incidental discovery.
 */
export interface UndiagnosedCondition {
  readonly id: string
  readonly kind: string
  readonly onsetAt: GameTime
  readonly visibleSymptomIds: readonly string[]
  readonly severity: number
  readonly discoveryTriggers: readonly string[]
}

/** A past medical event kept in the character's file. */
export interface MedicalEvent {
  readonly id: string
  readonly kind: string
  readonly occurredAt: GameTime
  readonly summary: string
}

export interface HealthState {
  readonly overallQuality: number
  readonly fitness: number
  readonly sleepQuality: number
  readonly eatingPattern: EatingPattern
  readonly energyBaseline: number
  readonly lifestyle: LifestyleProfile
  readonly sexualHealth: SexualHealthState
  readonly currentSymptoms: readonly Symptom[]
  readonly undiagnosed: readonly UndiagnosedCondition[]
  readonly medicalHistory: readonly MedicalEvent[]
}