Persisted data model for an Affliction item.

The shape of system on a affliction item — i.e. item.system (equivalently item.logic.data) when item.type === "affliction". The backing DataModel implements this interface.

interface AfflictionData<
    TLogic extends AfflictionLogic<AfflictionData> = AfflictionLogic<any>,
> {
    actionDefs: sohl.entity.action.SohlAction.Data[];
    actorLogic: null | SohlActorLogic<any>;
    category: null | string;
    contagionIndexBase: number;
    contractDate: null | number;
    docHtml: HTMLString;
    healingCheckDurationBase: null | number;
    healingCheckDurationFormula: null | string;
    healingRateBase: null | number;
    id: string;
    isDormant: boolean;
    isOwner: boolean;
    kind: string;
    lastRun?: Record<string, number>;
    levelBase: number;
    logic: TLogic;
    name: string;
    notes: HTMLString;
    onsetDate: null | number;
    onsetDurationBase: null | number;
    onsetDurationFormula: null | string;
    onsetFormula: null | string;
    onsetMacroUuid: null | string;
    outcome: KindValue;
    outcomeTrauma: null | string;
    parent: null | SohlItem;
    resolutionDate: null | number;
    resolutionDurationBase: null | number;
    resolutionDurationFormula: null | string;
    scheduledActions?: ScheduledAction[];
    shortcode: string;
    subType: KindValue;
    transmission: KindValue;
    treatmentDate: null | number;
    type: string;
    uuid: string;
    get item(): SohlItem;
    getFlag(scope: string, key: string): unknown;
    label(options?: { withName: boolean; withSubType: boolean }): string;
    setFlag(scope: string, key: string, value: unknown): Promise<unknown>;
    update(data: object): Promise<unknown>;
}

Type Parameters

Hierarchy (View Summary)

Properties

Serialized action definitions used to build the logic's actions map.

actorLogic: null | SohlActorLogic<any>

The logic of the owning actor — this actor's own logic when the data is an actor's, the owning actor's logic when it is an item's, or null.

category: null | string

Additional sub-categorization within the affliction type

contagionIndexBase: number

Risk of transmitting this affliction to others

contractDate: null | number

World-time (seconds) at which the affliction was contracted.

docHtml: HTMLString

Rich-text description shown on the item's sheet and chat cards.

healingCheckDurationBase: null | number

Rolled seconds between course/recovery checks; null until rolled.

healingCheckDurationFormula: null | string

Formula rolled to seed the recurring course/recovery-check interval.

healingRateBase: null | number

Rate of natural recovery; null means no natural healing

id: string

The owning document's id.

isDormant: boolean

Whether the affliction is inactive but potentially contagious

isOwner: boolean

Whether the current user owns the document (edit permission).

kind: string

The document kind (its actor or item type id).

lastRun?: Record<string, number>

Generic run record (issue #579) — a map of actionName → the world time (seconds) that action last performed on this document, stamped at the action chokepoint for actions flagged recordsLastRun. The past-tense mirror of scheduledActions: "when did X last happen here?" for any action, without a bespoke field, and it survives after a schedule ends. For an event-driven trigger (no computable next fire) it is the only meaningful temporal fact.

levelBase: number

Severity of the affliction

logic: TLogic

The logic instance built from this data.

name: string

The owning document's name.

notes: HTMLString

Rich-text GM/player notes for the item.

onsetDate: null | number

World-time at which symptoms began (onset crystallized); null while incubating.

onsetDurationBase: null | number

Rolled seconds of incubation; null until rolled.

onsetDurationFormula: null | string

Formula rolled to seed the incubation (contract → onset) interval.

onsetFormula: null | string

A sohl.entity.roll.SimpleRoll formula giving the number of days between contracting the affliction and the start of onset, rolled by the receiving actor's Contagion Test. null means no incubation.

onsetMacroUuid: null | string

UUID of an optional author Macro run when the affliction becomes symptomatic at onset (a reference, never source). May schedule further events. Blank means no onset macro.

outcome: KindValue

The authored outcome applied at resolution when the affliction was not defeated — an AFFLICTION_OUTCOME value (DEATH or CURED).

outcomeTrauma: null | string

Optional sohl.entity.expr.SafeExpression source evaluating to a trauma shortcode — or an array of shortcodes — the host contracts as part of the outcome. Blank means none; combines with outcome.

parent: null | SohlItem

The Foundry document (actor or item) this data belongs to, or null.

resolutionDate: null | number

World-time at which the affliction resolved (death/disability/cure); null until resolved.

resolutionDurationBase: null | number

Rolled seconds from onset to resolution; null until rolled.

resolutionDurationFormula: null | string

Formula rolled to seed the onset → resolution interval.

scheduledActions?: ScheduledAction[]

Persisted recurring/deferred schedules for this document (issue #588) — each entry defers actionName to anchor + interval. The generic store that replaces the retired bespoke last*Date anchors; a recurring effect's finalize() re-arms these into the event queue on every preparation. Only documents whose data model extends the base SohlDataModel (actors, items, combatants) carry it — hence optional here. See https://kb.heroiclands.org/dev/reference/event-queue/.

shortcode: string

Short identity code for this document.

subType: KindValue

Affliction category (Disease, Poison, Fatigue, etc.)

transmission: KindValue

How this affliction spreads (Contact, Airborne, etc.)

treatmentDate: null | number

World-time (seconds) at which medical treatment was applied, or null if untreated. isTreated is derived from this on the logic.

type: string

The owning document's type (its actor or item kind).

uuid: string

The owning document's globally-unique id, treated as an opaque identity token: pass it through (e.g. into chat-card data) and resolve it back to logic via fvttLogicFromUuid / fvttLogicFromUuidSync — never fromUuid it to a Foundry document inside the logic layer.

Accessors

Methods

  • The item's display label; with withName, includes the item's name, and with withSubType, includes its sub-type.

    Parameters

    • Optionaloptions: { withName: boolean; withSubType: boolean }

    Returns string

  • Write a namespaced flag on the owning document.

    Parameters

    • scope: string
    • key: string
    • value: unknown

    Returns Promise<unknown>