QcServerCombat Class
Players attacking creatures (decision E-367): reach and sight, the attack cooldown, the damage of the held item and its wear, the creature's sounds and the loot it drops when it dies. More...
| Header: | #include <server/gameplay/QcServerCombat.h> |
Public Types
| struct | Blow |
Public Functions
| void | attack(QcServerClient &client, quint32 entityId) |
Static Public Members
| const double | attackReach |
| void | dropLoot(QcServerState &state, const QList<QcItemDrop> &drops, const QcVec3 &position) |
| bool | hurtCreature(QcServerState &state, QcServerSounds &sounds, const QcServerCombat::Blow &blow) |
| const double | playerAttackCooldown |
| const double | sprintKnockback |
| void | tellNamedDeath(QcServerState &state, const QString &name) |
| void | woundCreature(QcServerState &state, QcServerSounds &sounds, quint32 id, double amount) |
Detailed Description
Armour stands take hits in QcServerStands.
Member Function Documentation
void QcServerCombat::attack(QcServerClient &client, quint32 entityId)
Handles an attack of the player client on the entity entityId; a sprinting player pushes harder (sprintKnockback).
[static] void QcServerCombat::dropLoot(QcServerState &state, const QList<QcItemDrop> &drops, const QcVec3 &position)
Drops the loot drops of a creature of state that died at position, each drop by its chance (also burn deaths, QcBodyBurning).
[static] bool QcServerCombat::hurtCreature(QcServerState &state, QcServerSounds &sounds, const QcServerCombat::Blow &blow)
Deals blow in state with the creature's sounds, its loot and experience when it dies. Returns false when the creature was not hurt (unknown, or invulnerable for a moment after the last hit and the blow no stronger than the strongest of that moment, decision E-429).
[static] void QcServerCombat::tellNamedDeath(QcServerState &state, const QString &name)
Tells every player of state that the creature named name died (decision E-866); nothing for no name.
[static] void QcServerCombat::woundCreature(QcServerState &state, QcServerSounds &sounds, quint32 id, double amount)
Wounds the creature id of state by amount without a blow (burning, drying, drowning): the hurt sound of sounds only when the damage takes as a fresh hit (not while the creature is still invulnerable from the last, decision E-429), the death sound and the loot when it dies. Nothing for an unknown creature.
Member Variable Documentation
const double QcServerCombat::attackReach
Melee reach of players, from the eyes to the target's centre.
const double QcServerCombat::playerAttackCooldown
Seconds a player waits between two attacks.
const double QcServerCombat::sprintKnockback
Blows' worth of push of a sprinting player's attack (decision E-971): the reference adds a level of knockback, which pushes about twice as far.