Struct AICombatContext
Everything the shared combat decision needs, as plain numbers.
public struct AICombatContext
- Inherited Members
Remarks
Deliberately Unity-free. Every field is filled from the attacking state's serialized tuning plus a handful of runtime measurements, which is what makes an archetype asset testable: a test can build the same context the game builds and assert that a "pathetic" wolf flees where a "raging" one does not.
Fields
AbilityRange
Range of the ability the picker chose. Ignored when HasUsableAbility is false.
public float AbilityRange
Field Value
CanFlee
False when the NPC has no way to flee (no retreat state, or a style that refuses to). Gates Flee only; emergency retreat is still allowed.
public bool CanFlee
Field Value
Distance
Current distance from the NPC to its target, in world units.
public float Distance
Field Value
EmergencyRetreatThreshold
Fraction (0-1) of MinComfortDistance at which backing away escalates to an interrupt-and-run emergency retreat.
public float EmergencyRetreatThreshold
Field Value
FleeHealthThreshold
Health fraction at or below which the NPC abandons the fight. 0 means "never flee". Supplied by RetreatHealthThreshold.
public float FleeHealthThreshold
Field Value
HasUsableAbility
True when the ability picker returned something castable this tick.
public bool HasUsableAbility
Field Value
HealthPercent
The NPC's current health as a fraction (0-1) of its maximum.
public float HealthPercent
Field Value
MeleeReach
Fallback engagement distance for melee archetypes, used when PreferredDistance is 0. Typically twice the agent radius, floored at 1.
public float MeleeReach
Field Value
MinComfortDistance
Distance below which the NPC starts backing away. 0 disables backing away.
public float MinComfortDistance
Field Value
PreferredDistance
Distance the NPC wants to hold. 0 means "close to melee reach" — see MeleeReach.
public float PreferredDistance
Field Value
WasAttacking
True when the NPC attacked on the previous tick rather than moving.
public bool WasAttacking
Field Value
Remarks
Drives the hysteresis that keeps an NPC from flickering between attacking and closing when its target hovers at the edge of ability range. See RANGE_HYSTERESIS.