🛡️ Health — Shields¶
📦 Folder Overview¶
This folder contains the shield layer for the Health system.
Shields intercept damage after PRE rules and before HP is mutated by HealthSystem.
They are optional, modular, and composable.
🎯 Purpose¶
Shields provide a victim-side layer that can absorb or reduce incoming damage before it reaches health.
🧩 What Lives Here¶
Built-in Shields¶
Concrete implementations of shield behaviour.
- Implement
IShieldfor runtime absorption - May implement
IShieldPreviewfor preview support
Examples include:
- Capacity-based shields
- Regenerating shields
- Reduction-based shields
- Overheal or temporary HP
- Shield chains
Shield Pools¶
Value aggregators used for UI, FX, and stacking systems.
- Do not absorb damage
- Track shield contributions
Internal Helpers¶
Non-public utilities supporting shield selection and composition.
⚠️ Important Notes¶
Execution Order¶
Shields run after PRE rules and before HP mutation:
- Receive folded damage value
- May reduce or fully absorb it
- Pass remaining damage to health
Behaviour¶
Shields may:
- Reduce incoming damage
- Consume from a capacity pool
- Fully absorb damage
- Pass a remainder to health
Shields do not:
- Run as part of the rule pipeline
- Own health state
- Replace damage rules
- Handle networking or authority
Preview Behaviour¶
If a shield implements IShieldPreview, it participates in:
HealthSystem.PreviewDamage(...)- AI evaluation
- UI damage estimation
If not implemented:
- Preview may overestimate damage
- Runtime behaviour remains correct
Boundaries¶
Use shields for damage absorption.
For other concerns:
- Damage math → use Rules
- State ownership → use HealthSystem
- Lifecycle behaviour → use Handlers
🧠 Usage Guidance¶
- Treat shields as victim-side damage layers
- Compose multiple shields where needed
- Keep implementations simple and focused
🔗 Related Documentation¶
- Shields — Builtins
- Shields — Pools
- Shields — Internal
- Rules
- Health System