CreatureLib/src/Library/CreatureData/CreatureSpecies.hpp

32 lines
1.1 KiB
C++

#ifndef CREATURELIB_CREATURESPECIES_HPP
#define CREATURELIB_CREATURESPECIES_HPP
#include <string>
#include <unordered_map>
#include "SpeciesVariant.hpp"
#include "../Gender.hpp"
namespace CreatureLib::Library {
/*!
\brief This holds the data required for a species of a creature, so the general data we can describe different creatures with.
*/
class CreatureSpecies {
GetProperty(uint16_t, Id);
GetProperty(std::string, Name);
GetProperty(float, GenderRate);
GetProperty(std::string, GrowthRate);
GetProperty(uint8_t, CaptureRate);
GetProperty(uint8_t, BaseHappiness);
private:
std::unordered_map<std::string, const SpeciesVariant*> _variants;
public:
CreatureSpecies(uint16_t id, std::string name, const SpeciesVariant* defaultVariant,
float genderRatio, std::string growthRate, uint8_t captureRate, uint8_t baseHappiness);
[[nodiscard]] const SpeciesVariant* GetVariant(const std::string& key) const;
[[nodiscard]] Gender GetRandomGender(Core::Random& rand) const;
};
}
#endif //CREATURELIB_CREATURESPECIES_HPP