Interface IDamageable
- Namespace
- ElectricDrill.AstraHealth.Damage
- Assembly
- com.electricdrill.astra-health.Runtime.dll
Implemented by entities that can receive damage. The TakeDamage(PreDamageContext) method accepts a PreDamageContext record describing a pending damage attempt and returns a DamageResolutionContext describing whether the damage was applied or prevented and additional details.
public interface IDamageable
Methods
TakeDamage(PreDamageContext)
Process an incoming damage request and return a resolution object.
Implementations should run the damage processing pipeline (pre-phase, reduction,
defensive checks, barriers, health application) or delegate to the centralized
pipeline host used in the project. The provided preDamage
describes the intent (amount, type, source, critical flags, target/dealer).
The returned DamageResolutionContext must reflect the final outcome:
- If damage was applied, an instance created with Applied(DamageInfo, PreDamageContext) is expected and FinalDamageInfo will contain the concrete damage values that were actually applied to the target.
- If the damage was prevented (for example due to immunity, zero amount after reductions, or an explicit ignore), an instance created with Prevented(DamagePreventionReason, PreDamageContext, DamageInfo) is expected.
Implementations SHOULD NOT throw for normal prevention cases; use the prevention reasons and the returned resolution to communicate why the damage didn't apply.
DamageResolutionContext TakeDamage(PreDamageContext preDamage)
Parameters
preDamagePreDamageContextImmutable description of the pending damage attempt.
Returns
- DamageResolutionContext
A DamageResolutionContext describing the final outcome and details.