QtCraft API C++ classes QML types Handbook

QcPassiveBrain Class

The brain of passive creatures (QcMobDefinition::Ai::Passive, decision E-423): they wander to reachable places nearby or stand, and flee from whoever hurt them to a reachable place away from them (decision E-400). More...

Header: #include <server/mobbrains/QcCreatureBrains.h>
Inherits: QcMobBrain
Inherited By:

QcArcherBrain, QcGolemBrain, QcHostileBrain, QcNeutralBrain, and QcTameBrain

Reimplemented Public Functions

virtual QcPhysics::Steering think(QcCreature &mob, const QcMobDefinition &definition, const QcMobBrain::Context &context, int thinkTicks) override

Static Public Members

const double fleeDistance
const double fleeSeconds
const double wanderDistance

Protected Functions

QcPhysics::Steering chase(QcCreature &mob, const QcMobDefinition &definition, const QcMobManager::PlayerView &target, const QcMobBrain::Context &context, bool mayPlan)
virtual bool chases() const
QcMobNavigator::Navigation navigate(QcCreature &mob, double speed, const QcMobBrain::Context &context, bool mayPlan)
const QcPathPlanner &paths() const
QRandomGenerator &random()
QcPhysics::Steering wander(QcCreature &mob, const QcMobDefinition &definition, const QcMobBrain::Context &context, bool mayPlan)

Detailed Description

Member Function Documentation

[protected] QcPhysics::Steering QcPassiveBrain::chase(QcCreature &mob, const QcMobDefinition &definition, const QcMobManager::PlayerView &target, const QcMobBrain::Context &context, bool mayPlan)

Returns the steering of mob of the kind definition along a path towards target, or a blow in melee, in the tick of context; a new path only when it mayPlan.

[virtual protected] bool QcPassiveBrain::chases() const

Returns whether it looks for a player to chase.

Returns the steering of mob along its path at speed in the tick of context, asking for a new path only when it mayPlan.

[protected] const QcPathPlanner &QcPassiveBrain::paths() const

Returns the path searches.

[protected] QRandomGenerator &QcPassiveBrain::random()

Returns the random sequence of the creatures.

[override virtual] QcPhysics::Steering QcPassiveBrain::think(QcCreature &mob, const QcMobDefinition &definition, const QcMobBrain::Context &context, int thinkTicks)

Reimplements: QcMobBrain::think(QcCreature &mob, const QcMobDefinition &definition, const QcMobBrain::Context &context, int thinkTicks).

[protected] QcPhysics::Steering QcPassiveBrain::wander(QcCreature &mob, const QcMobDefinition &definition, const QcMobBrain::Context &context, bool mayPlan)

Returns the steering of mob of the kind definition in the tick of context: walking to a place nearby, standing still or fleeing when hurt; a new path only when it mayPlan.

Member Variable Documentation

const double QcPassiveBrain::wanderDistance

How far a wanderer looks for a place to walk to.