Reworked retrieving talent, new method is cleaner and harder to misunderstand.
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
This commit is contained in:
@@ -34,8 +34,8 @@ Creature* CreateCreature::Create() {
|
||||
auto rand = Arbutils::Random();
|
||||
auto species = this->_library->GetSpeciesLibrary()->Get(this->_species);
|
||||
auto variant = species->GetVariant(this->_variant);
|
||||
int8_t talent;
|
||||
if (this->_talent.empty()) {
|
||||
TalentIndex talent;
|
||||
if (this->_talent.Empty()) {
|
||||
talent = variant->GetRandomTalent(&rand);
|
||||
} else {
|
||||
talent = variant->GetTalentIndex(this->_talent);
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace CreatureLib::Battling {
|
||||
uint8_t _level;
|
||||
std::string _nickname = "";
|
||||
|
||||
std::string _talent = "";
|
||||
Arbutils::CaseInsensitiveConstString _talent = ""_cnc;
|
||||
Library::Gender _gender = static_cast<Library::Gender>(-1);
|
||||
uint8_t _coloring = 0;
|
||||
Arbutils::CaseInsensitiveConstString _heldItem = ""_cnc;
|
||||
|
||||
@@ -9,7 +9,7 @@ using namespace CreatureLib;
|
||||
Battling::Creature::Creature(const BattleLibrary* library, const Library::CreatureSpecies* species,
|
||||
const Library::SpeciesVariant* variant, uint8_t level, uint32_t experience, uint32_t uid,
|
||||
Library::Gender gender, uint8_t coloring, const Library::Item* heldItem,
|
||||
std::string nickname, int8_t talent, std::vector<LearnedAttack*> attacks)
|
||||
std::string nickname, const TalentIndex& talent, std::vector<LearnedAttack*> attacks)
|
||||
: _library(library), _species(species), _variant(variant), _level(level), _experience(experience),
|
||||
_uniqueIdentifier(uid), _gender(gender), _coloring(coloring), _heldItem(heldItem), _nickname(std::move(nickname)),
|
||||
_talentIndex(talent), _hasOverridenTalent(false), _attacks(std::move(attacks)) {
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace CreatureLib::Battling {
|
||||
bool _onBattleField = false;
|
||||
|
||||
std::string _nickname = "";
|
||||
int8_t _talentIndex;
|
||||
TalentIndex _talentIndex;
|
||||
Script* _activeTalent = nullptr;
|
||||
|
||||
bool _hasOverridenTalent;
|
||||
@@ -61,7 +61,7 @@ namespace CreatureLib::Battling {
|
||||
Creature(const BattleLibrary* library, const Library::CreatureSpecies* species,
|
||||
const Library::SpeciesVariant* variant, uint8_t level, uint32_t experience, uint32_t uid,
|
||||
Library::Gender gender, uint8_t coloring, const Library::Item* heldItem, std::string nickname,
|
||||
int8_t talent, std::vector<LearnedAttack*> attacks);
|
||||
const TalentIndex& talent, std::vector<LearnedAttack*> attacks);
|
||||
|
||||
virtual ~Creature() {
|
||||
for (auto attack : _attacks) {
|
||||
|
||||
Reference in New Issue
Block a user