QtCraft API C++ classes QML types Handbook

QcHitEffects Class

What the effects of a projectile's hit on a body add up to (decision E-427). More...

Header: #include <server/projectiles/QcHitEffects.h>

Public Types

struct Impact
Handler

Public Functions

QcHitEffects()
void add(const QString &type, const QcHitEffects::Handler &handler)
QcHitEffects::Impact impactOf(const QcProjectileDefinition &definition, double damage) const

Static Public Members

int spawnCount(const QcHitEffect &effect, QRandomGenerator &random)
QcHitEffects::Impact splashImpact(const QcProjectileDefinition &definition, double share)

Detailed Description

Each type of QcHitEffect::types has a handler here that adds to the Impact; QcServerProjectiles then deals the impact at once: the damage with the knockback as one hit (armour, the short invulnerability, sounds, loot), then the burning. A new type is a row of QcHitEffect::types (so the content keeps it) and a handler here (add); a type without a handler does nothing.

Member Type Documentation

[alias] QcHitEffects::Handler

damage: the hit's damage from the projectile's speed (QcProjectileFlight::damageAt), which the damage effects deal.

Member Function Documentation

QcHitEffects::QcHitEffects()

The handlers of the base types.

void QcHitEffects::add(const QString &type, const QcHitEffects::Handler &handler)

Sets handler as the handler of the hit effects of type.

QcHitEffects::Impact QcHitEffects::impactOf(const QcProjectileDefinition &definition, double damage) const

Returns the impact of a hit of definition with the speed damage damage: the handlers aggregate (damage once, the strongest knockback, the longest burning), so the order does not matter.

[static] int QcHitEffects::spawnCount(const QcHitEffect &effect, QRandomGenerator &random)

Returns how many creatures the spawn effect effect brings where its projectile breaks (decision E-450): with the effect's chance its count, of those with groupChance its groupCount, else none. Two draws of random when the first succeeds, one otherwise.

[static] QcHitEffects::Impact QcHitEffects::splashImpact(const QcProjectileDefinition &definition, double share)

Returns what a splash of definition (decision E-624) does to a body share of the full strength (1 at the place it broke, 0 at the splash's radius): the amounts of its damage effects and its status effects for that share of their ticks, scaled alike.