04_RegenIFramesCombat — Regen • I-Frames • Combat¶
Goal¶
Teach how regeneration, invincibility frames, and combat state work as optional handler components around a HealthSystem target.
What This Scene Demonstrates¶
HealthSystem target → optional handler component → public handler action → event/result feedback.
This scene shows how support handlers layer behaviour around the core HealthSystem without owning health state themselves. Damage still goes through HealthSystem.ApplyDamage, healing still goes through HealthSystem.TryHeal, and handler state comes from the real handler components.
The panel displays events and state. It does not fake i-frame, regen, combat, damage, or healing behaviour.
What To Look For¶
- Setup: The panel binds a target with
HealthSystemand detects optional handler components. - Quick Actions: Damage, Heal, Kill, and Revive drive real HealthSystem paths.
- I-Frames: The invincibility handler owns active/inactive state and remaining time.
- Regen: The regeneration handler owns cooldown, active state, smooth/ticked mode, and optional ceiling.
- Combat: The combat-state component owns in-combat state and remaining out-of-combat timer.
- Feedback: Damage attempts, i-frame events, regen state, and combat state are reported through visible panel feedback.
Mental model: target HealthSystem → optional handler → public action → service/handler result → visible state update.
Sample Scope¶
This scene covers:
HealthSystemdamage and healing actionsHealthInvincibilityHandleractivation and remaining time- I-frame start/end event feedback
HealthRegenerationHandlerenable/disable state- Regen delay, amount, interval, and smooth mode
- Optional regen ceiling modes
- Regen cooldown and active-state display
HealthCombatStatemark/exit controls- Combat timer display
- Kill and Revive test actions
This scene does NOT cover:
- Damage rules in detail
- Shield behaviour in detail
- Full death FX handling
- Networking implementation
- Production combat input
- Production HUD/VFX/audio integration
Missing handlers simply disable their matching sections. They are optional components, not mandatory HealthSystem dependencies.
Authority Note¶
This scene may include a permissive sample authority setup where mutations are allowed locally for demonstration purposes.
Networking Reminder¶
No networking is included; integration is the developer’s responsibility.
How To Use¶
- Enter Play Mode.
- Open the Setup tab.
-
Confirm the panel has:
-
a Target binding
- optional Attacker binding
HealthSystemon the target- optional
HealthInvincibilityHandler - optional
HealthRegenerationHandler - optional
HealthCombatState - Use the health bar to inspect current HP.
- Use Damage to send a real
DamageContextthroughHealthSystem.ApplyDamage. - Use Heal to call
HealthSystem.TryHeal. - Use Kill to force the target into a dead state.
- Use Revive to restore the target.
- Open the I-Frames tab.
- Click Activate to start invincibility.
- Return to Setup and apply damage while i-frames are active.
- Confirm the hit is rejected by the HealthSystem while invincibility is active.
- Open the Regen tab.
- Toggle Enable and Smooth as needed.
-
Configure:
-
Delay
- Amount
-
Interval
-
Click Apply to apply regen settings and restart cooldown.
-
Configure the optional regen ceiling:
-
% of Max
- % Above Activation
-
Absolute (HP)
-
Use the cooldown and ceiling bars to inspect waiting, active, preview, and live target state.
- Open the Combat tab.
- Click Mark Now to enter combat and refresh the timer.
- Click Force Exit to clear combat state immediately.
- Watch the combat timer count down against
OutOfCombatDelay.
Failure Behaviour¶
-
Missing Target
-
Meaning: The panel has no health object to inspect or mutate.
-
Fix: Assign a GameObject with
HealthSystem. -
Missing HealthSystem
-
Meaning: The selected target cannot run this panel.
-
Fix: Add
HealthSystemor choose a valid health target. -
Optional Handlers Missing
-
Meaning: One or more handler sections cannot run.
-
Fix: Add
HealthInvincibilityHandler,HealthRegenerationHandler, orHealthCombatStateto test those behaviours. -
I-Frames Blocked
-
Meaning: I-frame debugging needs a target with
HealthSystem. -
Fix: Return to Setup and assign a valid target.
-
Missing HealthInvincibilityHandler
-
Meaning: The target cannot activate i-frames from this panel.
-
Fix: Add
HealthInvincibilityHandlerto the target. -
Regen Blocked
-
Meaning: Regen debugging needs a target with
HealthSystem. -
Fix: Return to Setup and assign a valid target.
-
Missing HealthRegenerationHandler
-
Meaning: Regen tuning and cooldown display are unavailable.
-
Fix: Add
HealthRegenerationHandlerto the target. -
Combat Blocked
-
Meaning: Combat debugging needs a target with
HealthSystem. -
Fix: Return to Setup and assign a valid target.
-
Missing HealthCombatState
-
Meaning: Combat timer controls are unavailable.
-
Fix: Add
HealthCombatStateto the target. -
No damage applied: missing HealthSystem
-
Meaning: Damage has no valid service target.
-
Fix: Assign a valid target in Setup.
-
No damage applied: amount must be greater than 0
-
Meaning: Damage value is zero or invalid.
-
Fix: Increase Damage value.
-
Target is dead
-
Meaning: Damage is rejected while the target is dead.
-
Fix: Revive before applying damage.
-
No heal applied: missing HealthSystem
-
Meaning: Healing has no valid service target.
-
Fix: Assign a valid target in Setup.
-
No heal applied: amount must be greater than 0
-
Meaning: Heal value is zero or invalid.
-
Fix: Increase Heal value.
-
Heal had no effect
-
Meaning:
HealthSystem.TryHealreturned false. -
Fix: Check whether the target is full, dead, locked, or blocked by health rules.
-
AuthorityBlocked
-
Meaning: Damage was blocked by authority policy.
-
Fix: Check health authority settings or run from an allowed authority path.
-
Invincible
-
Meaning: Damage was blocked by active i-frames.
-
Fix: Wait for i-frames to end or avoid the invincibility source.
-
DamageLocked
-
Meaning: Damage is currently locked.
-
Fix: Unlock damage or inspect the component that locked it.
-
AbsorbedByShield
-
Meaning: Damage was fully absorbed by a shield.
-
Fix: Deplete/bypass the shield or increase damage.
-
ZeroOrNegativeAmount
-
Meaning: Damage was reduced to zero by active rules or shields.
- Fix: Increase damage or inspect active rules/shields.
Behind The Scenes¶
HealthSystem— owns current HP, max HP, damage, healing, kill, and revive pathsDamageContext— created for damage actionsDamageTag.Melee— used by the panel’s quick damage actionHealthSystem.ApplyDamage(in ctx)— authoritative damage mutation pathHealthSystem.TryHeal(amount)— authoritative healing pathHealthSystem.Kill()— forces dead state for testingHealthSystem.Revive()— restores from dead state for testingHealthInvincibilityHandler— owns i-frame activation, remaining time, and start/end eventsHealthRegenerationHandler— owns regen enable state, delay, amount, interval, smooth mode, cooldown, and ceilingHealthCombatState— owns in-combat state, out-of-combat delay, and remaining combat timeDamageResult— reports damage attempt outcome and rejection reasonHealthReasonText.ToUi(reason)— maps rejection reasons to UI-facing explanations
The panel uses public HealthSystem and handler APIs only. It does not access internals, use reflection, or bypass service results.
Key Takeaway¶
I-frames, regeneration, and combat state are separate optional behaviours around the HealthSystem.
The handlers own their own state, while HealthSystem remains the source of truth for health mutation.
That keeps the behaviour modular, observable, and easy to test without cramming every combat concern into the core health component.