QtCraft API C++ classes QML types Handbook

QcSpawnWeights Class

The monster list of every biome (decision E-838), as in the original game: each monster kind has a weight in a biome, and an attempt picks one kind of the whole list by weight and then tests it at the place; a kind that may not spawn there wastes the attempt. More...

Header: #include <common/content/mobs/QcSpawnWeights.h>

Public Functions

double total(const QString &biome) const
double weight(QcCreatureKindId type, const QString &biome) const

Static Public Members

QStringList problems(const QcContentRegistry &content)
double ruleWeight(const QcMobDefinition &mob, const QString &biome)

Detailed Description

The weight of a kind in a biome is the biome's own (monsters of the biome) or else the highest weight among the kind's spawn rules that allow the biome; a kind whose rules all have weight 0 never spawns, whatever a biome says. Worlds without biomes (the test terrain) use the empty name. Shared by the server's spawning and the handbook's biome pages.

Member Function Documentation

[static] QStringList QcSpawnWeights::problems(const QcContentRegistry &content)

Returns the warnings for monsters entries of the biomes in content that name no creature or one that is no monster (they are left out by the lists).

[static] double QcSpawnWeights::ruleWeight(const QcMobDefinition &mob, const QString &biome)

Returns the highest weight among the spawn rules of mob that allow biome, without the biome's own.

double QcSpawnWeights::total(const QString &biome) const

Returns the sum of the weights of all monster kinds in biome.

double QcSpawnWeights::weight(QcCreatureKindId type, const QString &biome) const

Returns the weight of monster kind type in biome; 0 for other kinds.