48 lines
2.1 KiB
C++
48 lines
2.1 KiB
C++
#ifndef CREATURELIB_CREATURESPECIES_HPP
|
|
#define CREATURELIB_CREATURESPECIES_HPP
|
|
|
|
#include "../Gender.hpp"
|
|
#include "SpeciesVariant.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 {
|
|
struct impl;
|
|
std::unique_ptr<impl> _impl;
|
|
|
|
public:
|
|
CreatureSpecies(uint16_t id, const ArbUt::StringView& name, const SpeciesVariant* defaultVariant,
|
|
float genderRatio, const ArbUt::StringView& growthRate, uint8_t captureRate,
|
|
std::unordered_set<uint32_t> flags = {});
|
|
|
|
virtual ~CreatureSpecies();
|
|
|
|
uint16_t GetId() const noexcept;
|
|
float GetGenderRate() const noexcept;
|
|
const ArbUt::StringView& GetGrowthRate() const noexcept;
|
|
uint8_t GetCaptureRate() const noexcept;
|
|
|
|
[[nodiscard]] bool HasVariant(const ArbUt::BasicStringView& key) const noexcept;
|
|
[[nodiscard]] bool HasVariant(uint32_t hash) const noexcept;
|
|
[[nodiscard]] bool TryGetVariant(const ArbUt::BasicStringView& name,
|
|
ArbUt::BorrowedPtr<const SpeciesVariant>& out) const noexcept;
|
|
[[nodiscard]] bool TryGetVariant(uint32_t hash, ArbUt::BorrowedPtr<const SpeciesVariant>& out) const noexcept;
|
|
[[nodiscard]] ArbUt::BorrowedPtr<const SpeciesVariant> GetVariant(const ArbUt::BasicStringView& key) const;
|
|
[[nodiscard]] ArbUt::BorrowedPtr<const SpeciesVariant> GetVariant(uint32_t key) const;
|
|
[[nodiscard]] Gender GetRandomGender(ArbUt::Random& rand) const noexcept;
|
|
[[nodiscard]] const ArbUt::StringView& GetName() const noexcept;
|
|
|
|
void SetVariant(const ArbUt::StringView& name, const SpeciesVariant* variant);
|
|
|
|
const ArbUt::List<ArbUt::BorrowedPtr<const SpeciesVariant>>& GetVariantsIterator() const;
|
|
|
|
bool HasFlag(const ArbUt::StringView& key) const noexcept;
|
|
bool HasFlag(uint32_t keyHash) const noexcept;
|
|
};
|
|
}
|
|
|
|
#endif // CREATURELIB_CREATURESPECIES_HPP
|