Skip to content

Health — Modifiers / Attacker

Folder Overview

Attacker-side damage contributors: components that live on the thing dealing damage and change how much it deals.

The sibling Victim folder holds the mirror image — components on the thing receiving damage.


Purpose

Damage has two ends, and modifiers on each end answer different questions.

A victim-side modifier answers "how much of this lands on me?" — armour, resistance, reflection. An attacker-side modifier answers "how hard do I hit?" — buffs, stances, weapon states, temporary rage.

Splitting them by folder keeps that distinction visible when browsing, because the interfaces alone do not make it obvious which end a component belongs on.


What Lives Here

BerserkBuff

A flat damage multiplier contributed through IAttackerDamageModifier.

Authored with a Min(0) multiplier defaulting to 1.5, adjustable at runtime through SetMultiplier for teaching panels and tooling. OnValidate clamps the authored value, so a negative multiplier cannot be typed into the inspector and silently invert a hit.

It is a worked example as much as a shipped feature: it is the smallest complete IAttackerDamageModifier, and copying it is a reasonable way to start your own.


Important Notes

These contribute values; they do not apply damage

The boundary from the parent Modifiers folder applies here in full. An attacker-side modifier returns a multiplier when asked and does nothing else. It does not call ApplyDamage, does not implement rule logic, and does not reach into HealthSystem.

If a behaviour needs ordering, cancellation, or access to the damage context beyond reading it, it is a rule and belongs under Rules/, not a modifier.

Composition is multiplicative and enable-aware

Multiple attacker-side modifiers on one attacker combine by multiplication. A component that is unticked in the inspector, or whose GameObject is inactive, does not contribute — the same tickbox behaviour the rule hubs apply, decided when damage is evaluated rather than when components were discovered, so toggling one takes effect on the very next hit.