Abstract base class for all SoHL domain entities — test/combat results (sohl.entity.result.SuccessTestResult, sohl.entity.result.AttackResult, …), modifiers (sohl.entity.modifier.ValueModifier, …), strike modes, and dice. It establishes the shapes and machinery every entity shares: a constructor-input Data bag, an Options bag carrying the owning parent, the kind discriminator, and the toJSON / clone round-trip used by sohl.utils.defaultToJSON / sohl.utils.defaultFromJSON.

Two invariants every subclass inherits:

  • The parent Logic is required and transient. The constructor throws without options.parent; parent is never serialized (it is not emitted by toJSON) and is re-supplied on revival. This is the "reference on the wire, live object in memory" rule — see the Entity serialization contract in the Runtime Contracts reference.
  • Kind identifies the concrete class for revival. Each subclass overrides the static Kind with a unique string and self-registers it (registerKind(X.Kind, X)); without that, sohl.utils.defaultFromJSON leaves the serialized form as inert data instead of reviving the concrete class.

Hierarchy (View Summary)

Constructors

Accessors

Methods

Constructors

Accessors

  • get kind(): string
  • The serialization discriminator for this instance — the concrete class's static Kind. Written into the JSON by toJSON under the kind key and read back by sohl.utils.defaultFromJSON to select the constructor. Derived from the class, never stored per-instance.

    Returns string

  • get parent(): SohlLogic<any>
  • The Logic that owns this entity. Always present (the constructor rejects a missing parent) and transient — it is not serialized and is re-supplied when the entity is revived or cloned.

    Returns SohlLogic<any>

Methods

  • Deep-copy this entity, re-parenting the copy under parent with no other changes. Shorthand for clone({}, { parent }).

    Parameters

    • parent: SohlLogic<any>

      The Logic to own the cloned entity.

    Returns this

    The cloned entity.

  • Deep-copy this entity, optionally overriding fields and clone options.

    Parameters

    • data: PlainObject

      Field overrides applied to the clone.

    • options: Partial<sohl.entity.SohlEntity.Options>

      Clone options (e.g. a new parent).

    Returns this

    The cloned entity.

  • Serialize this instance to a plain object suitable for JSON serialization.

    Returns PlainObject

    A plain object representing this instance, consistent with the Data interface of the subclass.

    The base emits only the kind tag. A subclass that adds state overrides this, chaining ...super.toJSON(), and emits keys matching its own Data interface in persisted form (a uuid/shortcode where the live object holds a resolved reference). The governing rule: toJSON() output must be valid data for the constructor. The transient parent is deliberately not emitted — it is re-supplied on revival.