Skip to content

🧱 Health β€” Modifiers

This folder contains supporting modifier components and utilities that contribute values into existing Health rules or shield systems.

Modifiers are not core health logic.
They exist to let multiple independent systems safely influence behaviour without tightly coupling to rules or HealthSystem.

They are: - Optional - Runtime-safe - Composable - Designed for enable/disable and pooling


πŸ“¦ What Modifiers Are (and Aren’t)

Modifiers are - Value contributors to existing rules or systems - Lightweight adapters between gameplay and rules - Safe aggregation helpers

Modifiers are not - Health owners - Rule engines - Gameplay systems by themselves

Modifiers always work alongside rules β€” never instead of them.


βš”οΈ Modifier Components

ReflectBuff

A lightweight contributor used with ReflectStacksRule to provide stackable reflected damage.

Behaviour

  • On Enable β†’ pushes its reflect percentage into ReflectStacksRule
  • On Disable β†’ removes only its own contribution
  • Contributions are summed, not multiplied
  • Total reflect is clamped by ReflectStacksRule.maxTotal
  • Safe for:
  • runtime toggling
  • pooling
  • temporary buffs

Typical Uses

  • Thorns-style passives
  • Temporary reflect shields
  • Rage / berserk defence buffs
  • Equipment-based reflect bonuses

Typical Setup

  1. Attach ReflectStacksRule to the victim
  2. Add one or more ReflectBuff components
  3. Enable/disable buffs as needed

Example

ReflectStacksRule.maxTotal = 0.9

Buffs added: - 0.3
- 0.3
- 0.3

Effective reflect: 0.9 (clamped)


HealingUtility

Static helper used to aggregate passive healing modifiers from a target.

This utility is intentionally: - non-mutating - rule-agnostic - predictable and reusable

ℹ️ Note
The simple overload allocates an array via GetComponents<T>().
Use the List<IHealingModifier> overload for hot paths or per-frame evaluation.

It exists to provide a single, consistent source of truth for healing multiplier aggregation.

API

float GetHealingMultiplier(GameObject target);
float GetHealingMultiplier(GameObject target, List<IHealingModifier> buffer);

int ApplyHealingModifiers(GameObject target, int baseAmount);
int ApplyHealingModifiers(GameObject target, int baseAmount, List<IHealingModifier> buffer);

🧠 Design Notes

Best Practices

  • Modifiers should be stateless or ticket-based
  • Never mutate health directly from modifiers
  • Prefer modifiers over custom aggregation logic
  • For reflect:
  • single-source β†’ DamageReflectRule
  • stacked β†’ ReflectStacksRule + ReflectBuff

❌ What Modifiers Should Not Do

  • Do not own health state
  • Do not apply damage or healing directly
  • Do not replace rules or shields
  • Do not encode authority or networking logic

Modifiers exist to stay small, predictable, and disposable.


πŸ”— See Also