Reworked retrieving talent, new method is cleaner and harder to misunderstand.
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
2020-03-02 13:59:49 +01:00
parent bfc049a97c
commit 0c1580ade6
8 changed files with 62 additions and 27 deletions

View File

@@ -7,6 +7,7 @@
#include "../../Core/StatisticSet.hpp"
#include "CreatureMoves.hpp"
#include "LearnableAttacks.hpp"
#include "TalentIndex.hpp"
using ConstString = Arbutils::CaseInsensitiveConstString;
namespace CreatureLib::Library {
@@ -44,10 +45,17 @@ namespace CreatureLib::Library {
[[nodiscard]] uint8_t GetType(size_t index) const;
[[nodiscard]] const std::vector<uint8_t>& GetTypes() const;
[[nodiscard]] uint32_t GetStatistic(Core::Statistic stat) const;
[[nodiscard]] const ConstString& GetTalent(int32_t index) const;
[[nodiscard]] const size_t GetTalentCount() const { return _talents.size(); }
[[nodiscard]] const size_t GetSecretTalentCount() const { return _secretTalents.size(); }
[[nodiscard]] const ConstString& GetTalent(const TalentIndex& index) const {
if (index.IsSecret())
return _secretTalents.at(index.GetIndex());
return _talents.at(index.GetIndex());
}
[[nodiscard]] const TalentIndex GetTalentIndex(const ConstString& talent) const;
[[nodiscard]] const LearnableAttacks* GetLearnableAttacks() const;
[[nodiscard]] int8_t GetTalentIndex(const std::string& talent) const;
[[nodiscard]] int8_t GetRandomTalent(Arbutils::Random* rand) const;
[[nodiscard]] TalentIndex GetRandomTalent(Arbutils::Random* rand) const;
[[nodiscard]] inline const std::vector<ConstString>& GetTalents() const { return _talents; }
[[nodiscard]] inline const std::vector<ConstString>& GetSecretTalents() const { return _secretTalents; }
};