diff --git a/src/Library/CreatureData/CreatureSpecies.hpp b/src/Library/CreatureData/CreatureSpecies.hpp index 609c32b..d699a3e 100644 --- a/src/Library/CreatureData/CreatureSpecies.hpp +++ b/src/Library/CreatureData/CreatureSpecies.hpp @@ -95,6 +95,9 @@ namespace CreatureLib::Library { /// @param key The flag to check for. /// @return True if the species has the flag, false otherwise. bool HasFlag(const ArbUt::StringView& key) const noexcept; + /// @brief Checks whether the species has a specific flag. + /// @param keyHash The flag to check for. + /// @return True if the species has the flag, false otherwise. bool HasFlag(uint32_t keyHash) const noexcept; }; } diff --git a/src/Library/CreatureData/SpeciesVariant.cpp b/src/Library/CreatureData/SpeciesVariant.cpp index 3ebfa9f..98f2639 100644 --- a/src/Library/CreatureData/SpeciesVariant.cpp +++ b/src/Library/CreatureData/SpeciesVariant.cpp @@ -87,6 +87,7 @@ namespace CreatureLib::Library { const std::unordered_set& flags) : _impl(new impl(name, height, weight, baseExperience, types, baseStats, talents, secretTalents, attacks, flags)) {} + SpeciesVariant::~SpeciesVariant() = default; #define ImplGetter(type, func) \ type SpeciesVariant::func() const noexcept { return _impl->func(); } @@ -117,6 +118,4 @@ namespace CreatureLib::Library { bool SpeciesVariant::HasFlag(const ArbUt::StringView& key) const noexcept { return _impl->HasFlag(key); } bool SpeciesVariant::HasFlag(uint32_t keyHash) const noexcept { return _impl->HasFlag(keyHash); } - - SpeciesVariant::~SpeciesVariant() = default; } diff --git a/src/Library/CreatureData/SpeciesVariant.hpp b/src/Library/CreatureData/SpeciesVariant.hpp index 6ddc6fb..696ef3e 100644 --- a/src/Library/CreatureData/SpeciesVariant.hpp +++ b/src/Library/CreatureData/SpeciesVariant.hpp @@ -6,9 +6,7 @@ #include "TalentIndex.hpp" namespace CreatureLib::Library { - /*! - \brief A single species can have more than one variant. This class holds the data for those variants. - */ + /// @brief A single species can have more than one variant. This class holds the data for those variants. class SpeciesVariant { private: struct impl; @@ -17,6 +15,19 @@ namespace CreatureLib::Library { protected: private: public: + /// @brief Instantiate SpeciesVariant. + /// @param name The unique name of the variant. + /// @param height The height of the variant. + /// @param weight The weight of the variant. + /// @param baseExperience The number of base experienced that a variant returns when defeated. + /// @param types The indices of the types of the variant, as retrieved from the TypeLibrary. + /// @param baseStats The basic, unboosted stats of the variant. + /// @param talents The names of the possible talents of the variant. These are later resolved as scripts when + /// battling. + /// @param secretTalents The names of the possible secret talents of the variant. These are later resolved as + /// scripts when battling. + /// @param attacks The attacks that this variant can learn. + /// @param flags A set of flags for use by the developer. These can be used for easy grouping. SpeciesVariant(const ArbUt::StringView& name, float height, float weight, uint32_t baseExperience, const ArbUt::List& types, Library::StatisticSet baseStats, const ArbUt::List& talents, @@ -24,26 +35,70 @@ namespace CreatureLib::Library { const std::unordered_set& flags = {}); virtual ~SpeciesVariant(); + /// @brief Returns the unique name of the variant. + /// @return The unique name of the variant. const ArbUt::StringView& GetName() const noexcept; + /// @brief Returns the height of the variant. + /// @return The height of the variant. Traditionally in meters. float GetHeight() const noexcept; + /// @brief Returns the weight of the variant. + /// @return The weight of the variant. Traditionally in kilograms. float GetWeight() const noexcept; + /// @brief Returns the amount of base experience gained when defeating a creature with this variant. + /// @return The amount of base experience gained when defeating a creature with this variant. uint32_t GetBaseExperience() const noexcept; + /// @brief Returns the amount of types this variant has. + /// @return The amount of types this variant has. [[nodiscard]] size_t GetTypeCount() const noexcept; + /// @brief Returns a type index at a specified index. + /// @param index The index of the type requested. + /// @return A type index, as defined in TypeLibrary. [[nodiscard]] uint8_t GetType(size_t index) const; + /// @brief Returns a list of the types on this variant. + /// @return A list of types on the variant, [[nodiscard]] const ArbUt::List& GetTypes() const noexcept; + /// @brief Returns the value of a base statistic. + /// @param stat The desired statistic. + /// @return The base statistic value. [[nodiscard]] uint16_t GetStatistic(Library::Statistic stat) const noexcept; + + /// @brief Returns the amount of talents this variant has. + /// @return The amount of talents this variant has. [[nodiscard]] size_t GetTalentCount() const noexcept; + /// @brief Returns the amount of secret talents this variant has. + /// @return The amount of secret talents this variant has. [[nodiscard]] size_t GetSecretTalentCount() const noexcept; + /// @brief Returns a talent name at a specified TalentIndex. + /// @param index Whether it's a secret talent, and which index to get. + /// @return The name of the talent at the given TalentIndex. [[nodiscard]] const ArbUt::StringView& GetTalent(const TalentIndex& index) const; + /// @brief Search for the index of a talent with a name. + /// @param talent The name that's being looked for. + /// @return The index of the talent. [[nodiscard]] TalentIndex GetTalentIndex(const ArbUt::StringView& talent) const; + /// @brief Returns the attacks the variant can learn. + /// @return The attacks the variant can learn. [[nodiscard]] ArbUt::BorrowedPtr GetLearnableAttacks() const noexcept; + /// @brief Returns a random talent from the normal talents (so not from the secret talents). + /// @param rand The random number generator. + /// @return The index of the random talent. [[nodiscard]] TalentIndex GetRandomTalent(ArbUt::Random& rand) const noexcept; + /// @brief Returns a list of talents of the variant. + /// @return A list of talents of the variant. [[nodiscard]] const ArbUt::List& GetTalents() const noexcept; + /// @brief Returns a list of secret talents of the variant. + /// @return A list of secret talents of the variant. [[nodiscard]] const ArbUt::List& GetSecretTalents() const noexcept; + /// @brief Checks whether the species has a specific flag. + /// @param key The flag to check for. + /// @return True if the species has the flag, false otherwise. bool HasFlag(const ArbUt::StringView& key) const noexcept; + /// @brief Checks whether the species has a specific flag. + /// @param keyHash The flag to check for. + /// @return True if the species has the flag, false otherwise. bool HasFlag(uint32_t keyHash) const noexcept; }; }