Skip to content

Health Mutation

Folder Overview

This folder defines the minimal mutation surface for applying damage.

It exists so systems can interact with Health without depending on concrete implementations like HealthSystem.


Purpose

IHealthMutator provides:

  • A runtime-safe entry point for damage
  • A minimal event surface for lifecycle awareness
  • A way to decouple gameplay systems from implementation details

What Lives Here

IHealthMutator

Provides:

  • DamageResult ApplyDamage(in DamageContext ctx)
  • event Action Died
  • event Action Revived

Important Notes

Semantics

  • ApplyDamage runs through the damage evaluation pipeline
  • The returned DamageResult reflects:

  • whether damage applied

  • final applied amount
  • rejection reason (if any)

Events:

  • Died → raised when health enters a dead state
  • Revived → raised when health transitions back to alive

Boundaries

IHealthMutator does not:

  • expose healing APIs
  • provide direct state mutation (use IHealthWriter)
  • expose lifecycle control (use IHealthLifecycle)
  • expose internal pipeline behaviour

Usage Guidance

Prefer:

  • IHealthMutator → for damage application
  • IHealable → for simple healing
  • IHealthWriter → for direct mutation
  • IHealthLifecycle → for revive/death control

  • Core Interfaces
  • Contracts
  • Lifecycle
  • Rules