CombatState beta
Interface of @v12-engine/engine
export interface CombatStateWhat a unit keeps of its fighting: cooldown, swing, targets and recovery
Members
autoTarget
autoTarget: EntityId;Target picked by the unit itself rather than by an order
cooldown
cooldown: number;Seconds until the next attack may start
engaged
engaged?: EntityId;What it is fighting or closing in on, whoever picked it: 0 for nothing (see engagement.ts)
guard
guard: Vec2 | null;Where an idle unit returns to after chasing
helpedAt
helpedAt?: number;The tick the allies of whoever it hit were last called to help (RuleSettings.combat.helpRange), so that they are asked once in a while, not by every blow. Unset until it hits someone
lastAttacker
lastAttacker: EntityId;The entity that last hit it
passive
passive: boolean;Does not pick fights of its own accord until it gets an order (set by a game's rules; stop no longer sets it)
recovery
recovery?: number;Seconds left of the recovery after its last blow (AttackDef.recovery), while what it is told waits: none when it has none
shunned
shunned?: [EntityId, number][];Targets it left alone because it could not get at them, and until when, in world time
slot
slot?: number | null;The spot it holds around that, as an angle seen from it. Null when it has none: it flies, it hits a building
swing
swing: number;Seconds until the running swing lands. 0 when not swinging
swingTarget
swingTarget: EntityId;The entity the running swing is aimed at
weapon
weapon?: number;Which of its attacks the running swing, or the last, is of, by place (UnitTypeDef.attacks): the first when left out, as for every unit with one. It swings one at a time, and waits out the cooldown of the one that hit