QtCraft API C++ classes QML types Handbook

QcArcherState Struct

What an archer (QcMobDefinition::Ai::Archer, decision E-426) does between ticks: its draw, the side it circles to, where it last saw its target (for the lead of its shots) and its drink. More...

Header: #include <server/mobbrains/QcArcherState.h>

Public Functions

bool drawing() const
bool drinking() const
void track(quint32 targetId, const QcVec3 &position, quint64 tick, double dt)

Public Variables

qint64 drawStart
quint64 drinkReady
qint64 drinkStart
quint64 seenTick
int strafeSide
int strafeTicks
quint32 target
QcVec3 targetPosition
QcVec3 targetVelocity

Detailed Description

A component of the creature (QcCreature::archer); not saved, like all hostile creatures.

Member Function Documentation

bool QcArcherState::drawing() const

Returns whether it draws its bow.

bool QcArcherState::drinking() const

Returns whether it drinks.

void QcArcherState::track(quint32 targetId, const QcVec3 &position, quint64 tick, double dt)

Keeps that the target targetId is at position at tick and its smoothed velocity (QcArcherBrain.cpp); dt is the length of a tick.

Member Variable Documentation

qint64 QcArcherState::drawStart

The tick of its brain (QcMobBrain::Context::tick) it began to draw at; -1 while it does not draw.

quint64 QcArcherState::drinkReady

The first tick it may drink again.

qint64 QcArcherState::drinkStart

A drink to heal (QcMobDefinition::drinks, decision E-623; QcMobDrinking): the game tick it began at (-1 while it does not drink).

quint64 QcArcherState::seenTick

The tick it last saw the target.

int QcArcherState::strafeSide

Circles to the left (-1) or the right (1) of its target until strafeTicks run out.

int QcArcherState::strafeTicks

Ticks it keeps circling to strafeSide.

quint32 QcArcherState::target

The target it last saw (entity id).

QcVec3 QcArcherState::targetPosition

Where it last saw the target.

QcVec3 QcArcherState::targetVelocity

The target's velocity (smoothed from the change of position).