QtCraft API C++ classes QML types Handbook

QcServerEffects Class

The status effects of players and creatures in the server tick (decision E-450): every effect counts down and does what its kind (QcEffectDefinition) says at its level; poison hurts every QcEffectDefinition::periodAt ticks without taking the health below its minHealth, players through QcPlayerHealth::damage (unblockable), creatures through QcServerCombat::hurtCreature (no push, QcMobManager::damage); hunger exhausts players' food (decision E-838; slowness acts where bodies move, QcStatusEffects::speedFactor). More...

Header: #include <server/gameplay/QcServerEffects.h>

Public Functions

void tick()

Static Public Members

bool giveCreature(const QcContentRegistry &content, QcMobManager &creatures, quint32 creature, const QcStatusEffect &effect)
bool givePlayer(QcServerState &state, QcServerClient &client, const QcStatusEffect &effect)
bool givePlayer(const QcContentRegistry &content, QcServerClient &client, const QcStatusEffect &effect)
const int sendIntervalTicks

Detailed Description

Dead players lose their effects. A player hears of their own with their health (QcMsg::PlayerHealth::effects) whenever they change and every second while they have any, so the HUD shows the time left.

Member Function Documentation

[static] bool QcServerEffects::giveCreature(const QcContentRegistry &content, QcMobManager &creatures, quint32 creature, const QcStatusEffect &effect)

Gives the creature creature of creatures the effect of a known kind of content, unless it is immune to it. Returns false when nothing changed.

[static] bool QcServerEffects::givePlayer(QcServerState &state, QcServerClient &client, const QcStatusEffect &effect)

Gives the living player client the effect like the other overload, with the content of state, and a given effect counts for the adventure guide (decision E-923). Returns false when nothing changed.

[static] bool QcServerEffects::givePlayer(const QcContentRegistry &content, QcServerClient &client, const QcStatusEffect &effect)

Gives the living player client the effect of a known kind of content. Returns false when nothing changed.

void QcServerEffects::tick()

One simulated tick of the effects of every playing player and awake creature.

Member Variable Documentation

const int QcServerEffects::sendIntervalTicks

A player with effects hears of them at least this often.