dao::attack::Approach

struct

How an attack or an ability would approach its target, given where the two stand now.

The game approaches in one of two ways. “Melee” below is the approach to a place on the target’s ring: a plain attack without a ranged weapon, or an ability whose Range in the abilities table is 0. “Ranged” is the approach to within a range: a plain attack with a bow, a crossbow or a staff, or an ability with any other Range.

Declared in dao/Attack.h.

Fields

Field Type  
findsRoom bool = true Whether the action will find room on the ring. The ring must have a place now, and the filled ring must still have one, unless the action is done with the ring before it fills: an attack whose blow lands at once, or an ability whose user is already in reach. When false, the command fails with COMMAND_FAILED_NO_SPACE_IN_MELEE_RING. Always true when ranged.
goal Vector Where the approach walks to. Melee: the attacker’s place on the filled ring, or else its place on the ring as it is now, or else the target’s position. Ranged: the target’s position.
inReach bool = false Whether the action would start at once, without a walk. For melee, this is judged on the ring as it is now. For a ranged attack, the target must be within the weapon’s range, no nearer than spaces, and in sight. For a ranged ability, it must be within the ability’s range, and in sight if needsSight.
lineOfSight bool = true Ranged: whether the game’s line-of-sight test passes; true where none is needed. Melee: true.
needsSight bool = false Ranged: whether the approach needs a line of sight to the target. A ranged attack does; an ability does if it has a projectile.
range float = 0 ranged: the weapon’s or the ability’s range in metres, at most 60; melee: 0
ranged bool = false  
roomOnceFilled bool = false Melee: whether the ring still has a place for the attacker after it fills. One frame after an attacker claims a place, the ring fills with the creatures standing around the target.
spaces float = 0 Both creatures’ personal spaces, in metres. A ranged attack shoots from no nearer.
stopWithin float = 0 Ranged: the straight-line distance from the target at which the walk stops: range minus spaces for an attack, range for an ability. Melee: 0, since the walk ends at goal.
strikesAtOnce bool = false A melee attack: whether the blow lands in the command’s first update, before the ring fills. It does when the attacker is in reach and faces the target to within 1 degree, and the target is within striking reach, no more than 60 degrees above or below, and in sight. Always false for an ability.