Adds more templated functions for getting stats
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2022-05-28 12:31:29 +02:00
parent df1fd007f1
commit b0e2e9935a
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
3 changed files with 10 additions and 0 deletions

View File

@ -240,6 +240,9 @@ namespace CreatureLib::Battling {
return _boostedStats.GetStat<stat>(); return _boostedStats.GetStat<stat>();
} }
[[nodiscard]] inline u32 GetBaseStat(Library::Statistic stat) const { return _variant->GetStatistic(stat); } [[nodiscard]] inline u32 GetBaseStat(Library::Statistic stat) const { return _variant->GetStatistic(stat); }
template <Library::Statistic stat> [[nodiscard]] inline u32 GetBaseStat() const {
return _variant->GetStatistics().GetStat<stat>();
}
[[nodiscard]] inline i8 GetStatBoost(Library::Statistic stat) const { return _statBoost.GetStat(stat); } [[nodiscard]] inline i8 GetStatBoost(Library::Statistic stat) const { return _statBoost.GetStat(stat); }
template <Library::Statistic stat> [[nodiscard]] inline u32 GetStatBoost() const { template <Library::Statistic stat> [[nodiscard]] inline u32 GetStatBoost() const {
return _statBoost.GetStat<stat>(); return _statBoost.GetStat<stat>();

View File

@ -31,6 +31,7 @@ namespace CreatureLib::Library {
[[nodiscard]] inline size_t GetTypeCount() const { return _types.Count(); } [[nodiscard]] inline size_t GetTypeCount() const { return _types.Count(); }
[[nodiscard]] inline u8 GetType(size_t index) const { return _types[index]; } [[nodiscard]] inline u8 GetType(size_t index) const { return _types[index]; }
[[nodiscard]] inline const ArbUt::List<u8>& GetTypes() const { return _types; } [[nodiscard]] inline const ArbUt::List<u8>& GetTypes() const { return _types; }
[[nodiscard]] inline const Library::StatisticSet<u16>& GetStatistics() const { return _baseStatistics; }
[[nodiscard]] inline u16 GetStatistic(Library::Statistic stat) const { return _baseStatistics.GetStat(stat); } [[nodiscard]] inline u16 GetStatistic(Library::Statistic stat) const { return _baseStatistics.GetStat(stat); }
[[nodiscard]] inline size_t GetTalentCount() const noexcept { return _talents.Count(); } [[nodiscard]] inline size_t GetTalentCount() const noexcept { return _talents.Count(); }
[[nodiscard]] inline size_t GetSecretTalentCount() const noexcept { return _secretTalents.Count(); } [[nodiscard]] inline size_t GetSecretTalentCount() const noexcept { return _secretTalents.Count(); }
@ -114,6 +115,7 @@ namespace CreatureLib::Library {
ImplGetter(size_t, GetTypeCount); ImplGetter(size_t, GetTypeCount);
u8 SpeciesVariant::GetType(size_t index) const { return _impl->GetType(index); } u8 SpeciesVariant::GetType(size_t index) const { return _impl->GetType(index); }
ImplGetter(const ArbUt::List<u8>&, GetTypes); ImplGetter(const ArbUt::List<u8>&, GetTypes);
ImplGetter(const Library::StatisticSet<u16>&, GetStatistics);
u16 SpeciesVariant::GetStatistic(Library::Statistic stat) const noexcept { return _impl->GetStatistic(stat); } u16 SpeciesVariant::GetStatistic(Library::Statistic stat) const noexcept { return _impl->GetStatistic(stat); }
ImplGetter(size_t, GetTalentCount); ImplGetter(size_t, GetTalentCount);

View File

@ -57,6 +57,11 @@ namespace CreatureLib::Library {
/// @brief Returns a list of the types on this variant. /// @brief Returns a list of the types on this variant.
/// @return A list of types on the variant, /// @return A list of types on the variant,
[[nodiscard]] const ArbUt::List<u8>& GetTypes() const noexcept; [[nodiscard]] const ArbUt::List<u8>& GetTypes() const noexcept;
/// @brief Returns the base statistics.
/// @return The base statistics.
[[nodiscard]] const Library::StatisticSet<u16>& GetStatistics() const noexcept;
/// @brief Returns the value of a base statistic. /// @brief Returns the value of a base statistic.
/// @param stat The desired statistic. /// @param stat The desired statistic.
/// @return The base statistic value. /// @return The base statistic value.