🛡️ Shields — Built-in¶
📦 Folder Overview¶
This folder contains built-in shield implementations that plug into Health via:
IShield— runtime absorption (TryAbsorb(ref int damage))IShieldPreview— optional preview support (PreviewRemainder(int incoming))
These are victim-side components that intercept damage after PRE rules and before HP is mutated by HealthSystem.
Health works without shields. Add them where needed.
🎯 Purpose¶
Provide ready-to-use shield implementations for absorbing or reducing incoming damage without modifying core systems.
🧩 What Lives Here¶
CapacityShield¶
Capacity-based shield pool.
Behaviour:
- Applies optional flat and percent reduction
- Consumes capacity before passing remainder to HP
- Becomes inactive when capacity reaches zero
Events:
ShieldDamaged(int consumed)ShieldBroken()
Preview:
- Implements
IShieldPreview
RechargeableShield¶
Capacity-based shield with regeneration.
Behaviour:
- Absorbs damage using capacity
- Refreshes regen delay on damage
- Regenerates over time
- Supports scaled or unscaled time
Preview:
- Implements
IShieldPreview
ReductionShield¶
Stateless mitigation layer.
Behaviour:
- Applies flat then percent reduction
- No capacity or break state
Preview:
- Implements
IShieldPreview
OverhealShield¶
Temporary HP layer.
Behaviour:
- Acts as temporary health
- Supports decay over time
- Optional delay after damage
- Supports scaled or unscaled time
Events:
ShieldDamaged(int used)ShieldBroken()
Preview:
- Implements
IShieldPreview
ShieldChain¶
Composite shield runner.
Behaviour:
- Executes multiple
IShieldcomponents in order - Passes remaining damage between shields
- Uses component order for execution
Preview:
- Uses
IShieldPreviewwhen available - Skips shields without preview support
⚠️ Important Notes¶
Execution Order¶
Shields run after PRE rules and before HP mutation.
- Receive folded damage value
- Mutate it to a remaining amount
- Pass remainder to health
Preview Behaviour¶
If a shield does not implement IShieldPreview:
- Runtime behaviour is unaffected
- Preview systems may overestimate damage
Boundaries¶
Built-in shields should not:
- Mutate HP directly
- Implement combat math (use rules)
- Depend on networking
- Include UI logic
Shields intercept damage before it reaches health.
🧠 Usage Guidance¶
- Use built-in shields as modular building blocks
- Combine multiple shields where needed
- Add only where gameplay requires damage absorption
🔗 Related Documentation¶
- Shields Overview
- Pools
- Rules
- Health System