QtCraft API C++ classes QML types Handbook

QcHitEffect Struct

One thing a projectile does when it hits (decision E-427), an entry of its kind's "onHit" list: {"type": "knockback", "strength": 0.5}. More...

Header: #include <common/content/items/QcHitEffect.h>

Public Types

struct Type

Public Functions

bool is(const char *name) const

Public Variables

int count
QJsonObject fields
double groupChance
int groupCount
int level
double number
QString sound
QString subject
QString type

Static Public Members

const char *const breaks
const char *const damage
const char *const effect
const char *const ignite
const char *const knockback
const char *const spawn
const char *const splash
const char *const teleport
std::optional<QcHitEffect::Type> typeNamed(const QString &name)
const std::array<QcHitEffect::Type, 8> types

Detailed Description

The types are a table in code (QcHitEffect::types), each with one number of its own; the server applies them in QcHitEffects. A type no table row names is left out of the list with a warning when the content is finished.

Member Function Documentation

bool QcHitEffect::is(const char *name) const

Returns whether this entry's type is name, one of the type names above.

[static] std::optional<QcHitEffect::Type> QcHitEffect::typeNamed(const QString &name)

Returns the row of types named name, or std::nullopt for an unknown type.

Member Variable Documentation

const char *const QcHitEffect::breaks

The projectile goes when it hits a body or a block instead of bouncing or sticking; sound plays where it breaks.

int QcHitEffect::count

How many appear (spawn; "count", 1 to 16).

const char *const QcHitEffect::damage

Damage to the body hit: amount health points per QcProjectileDefinition::damageSpeed of speed, rounded up; the body is pushed only with a knockback effect.

const char *const QcHitEffect::effect

Gives the body hit the status effect effect of level for seconds (decision E-450), only when the hit counts (not in the short invulnerability).

QJsonObject QcHitEffect::fields

The entry as written, for types added in code that read more of it.

double QcHitEffect::groupChance

Chance that groupCount appear instead (spawn; "groupChance", 0 to 1).

int QcHitEffect::groupCount

How many appear in the bigger group (spawn; "groupCount", 1 to 16).

const char *const QcHitEffect::ignite

Sets the body hit burning for seconds (as fire does, decision E-393).

const char *const QcHitEffect::knockback

Pushes the body hit along the flight like a blow (strength 1), also without damage.

int QcHitEffect::level

The effect's level (effect).

double QcHitEffect::number

The type's number (Type::numberKey), its fallback when not given.

QString QcHitEffect::sound

A sound key (break).

const char *const QcHitEffect::spawn

Where a breaking projectile breaks (at a body or a block), with the chance chance the creatures mob appear there as young ones: count of them, or with groupChance of those times groupCount (an egg's chicks, decision E-452).

const char *const QcHitEffect::splash

Where the projectile breaks, its damage (the amount of its damage effects, not per speed) and status effects reach every living body within radius metres but its thrower, less with the distance (a splash potion, decision E-624); the body hit takes nothing else.

QString QcHitEffect::subject

The kind named: the status effect (effect) or the creature (spawn).

const char *const QcHitEffect::teleport

Teleports the player who threw it to where it lands, on a body or a block (a shade pearl, decision E-460), with damage as fall damage; the projectile breaks there.

QString QcHitEffect::type

The type's name as written ("type", required); it may name no known type.

const std::array<QcHitEffect::Type, 8> QcHitEffect::types

The known types, one row each, in the order of the names above.