aboutsummaryrefslogtreecommitdiff
path: root/engine/entities/person.ts
blob: 1dc28a19014f03063c05f06c24e7d60e6bc277a7 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import type { GameTime } from '@hollowdark/time/gameTime'
import type { CareerState } from '@hollowdark/engine/career/career'
import type { EconomicState } from '@hollowdark/engine/economics/economic'
import type { Condition, HealthState } from '@hollowdark/engine/health/health'
import type { MentalHealthState } from '@hollowdark/engine/health/mental-health'
import type { Dependency } from '@hollowdark/engine/state/dependency'
import type { MoodState } from '@hollowdark/engine/state/mood'
import type { SatisfactionProfile } from '@hollowdark/engine/state/satisfaction'
import type { Scar } from '@hollowdark/engine/state/scar'
import type { AttachmentDistribution } from '@hollowdark/engine/traits/attachment'
import type { BigFiveProfile } from '@hollowdark/engine/traits/big-five'
import type { CoreBeliefs } from '@hollowdark/engine/traits/core-beliefs'
import type { DarkTriadProfile } from '@hollowdark/engine/traits/dark-triad'
import type { SexualOrientation } from '@hollowdark/engine/traits/orientation'
import type { ValuesOrientation } from '@hollowdark/engine/traits/values'
import type { BaseEntity, PersonId, PlaceId, RelationshipId } from '@hollowdark/engine/entities/base'
import type { EventLogEntry } from '@hollowdark/engine/entities/event-log-entry'
import type { PersonName } from '@hollowdark/engine/entities/person-name'
import type { ReputationProfile } from '@hollowdark/engine/entities/reputation'
import type { ResidenceEntry } from '@hollowdark/engine/entities/residence'
import type { StatusDescriptor } from '@hollowdark/engine/entities/status'

/** The ten modes of death the simulation can resolve. */
export type DeathMode =
  | 'expected_old_age'
  | 'sudden_accident'
  | 'terminal_illness'
  | 'suicide'
  | 'violent_death'
  | 'during_sleep'
  | 'childbirth'
  | 'war'
  | 'child_or_infant'

/**
 * The defining demographic facts of a birth, captured in prose-ready form.
 * The familyContext string is the one-paragraph summary the opening scene
 * draws on.
 */
export interface BirthRecord {
  readonly date: GameTime
  readonly placeId: PlaceId
  readonly familyContext: string
}

export interface DeathRecord {
  readonly date: GameTime
  readonly mode: DeathMode
  readonly placeId: PlaceId
  readonly sceneSummary: string
}

/**
 * NPC simulation fidelity tier. 1 = full weekly simulation (~10–30
 * close-orbit entities), 2 = quarterly compressed (dormant relatives,
 * drifted friends), 3 = generated on demand from seed (everyone else).
 */
export type SimulationTier = 1 | 2 | 3

/**
 * Person — the main simulated entity. Players and NPCs share this shape.
 * Fields are grouped by trait layer:
 *
 *   Layer 1  temperament (Big Five + Dark Triad) — mostly stable
 *   Layer 2  developmental (attachment, core beliefs, values, orientation)
 *   Layer 3  state (mood, stress, energy, trauma load, satisfaction)
 *   Layer 4  acquired (skills, knowledge, habits, dependencies, scars)
 *   Layer 5  social (reputation, status, network capital)
 *
 * Numeric fields stay hidden from the player; everything surfaces as prose.
 */
export interface Person extends BaseEntity<PersonId, 'person'> {
  readonly name: PersonName

  readonly birth: BirthRecord
  readonly death: DeathRecord | null

  readonly bigFive: BigFiveProfile
  readonly darkTriad: DarkTriadProfile

  readonly attachment: AttachmentDistribution
  readonly coreBeliefs: CoreBeliefs
  readonly conscienceCapacity: number
  readonly values: ValuesOrientation
  readonly orientation: SexualOrientation

  readonly mood: MoodState
  readonly stress: number
  readonly energy: number
  readonly traumaLoad: number
  readonly satisfaction: SatisfactionProfile

  readonly skills: ReadonlyMap<string, number>
  readonly knowledge: ReadonlyMap<string, number>
  readonly habits: readonly string[]
  readonly dependencies: readonly Dependency[]
  readonly scars: readonly Scar[]

  readonly reputation: ReputationProfile
  readonly status: StatusDescriptor
  readonly networkCapital: number

  readonly health: HealthState
  readonly chronicConditions: readonly Condition[]
  readonly mentalHealthState: MentalHealthState

  readonly economic: EconomicState
  readonly career: CareerState

  readonly relationshipIds: readonly RelationshipId[]
  readonly currentPlaceId: PlaceId
  readonly residenceHistory: readonly ResidenceEntry[]

  readonly tier: SimulationTier
  readonly lastSimulatedAt: GameTime

  readonly eventLog: readonly EventLogEntry[]
  readonly memorableMoments: readonly string[]

  readonly isPlayerCharacter: boolean
  readonly playerCharacterStartedAt: GameTime | null
  readonly playerCharacterEndedAt: GameTime | null

  readonly parentIds: readonly [PersonId | null, PersonId | null]
  readonly childIds: readonly PersonId[]
  readonly spouseIds: readonly PersonId[]
}