Implement basic library class that other libraries inherit from for performance.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -24,14 +24,14 @@ CreateCreature* CreateCreature::WithAttack(const std::string& attackName, Attack
|
||||
if (_attacks.size() >= _library->GetSettings()->GetMaximalMoves())
|
||||
throw CreatureException("You have already set the maximum amount of allowed moves.");
|
||||
|
||||
auto attackData = _library->GetAttackLibrary()->GetAttack(attackName);
|
||||
auto attackData = _library->GetAttackLibrary()->Get(attackName.c_str());
|
||||
_attacks.emplace_back(attackData, learnMethod);
|
||||
return this;
|
||||
}
|
||||
|
||||
Creature* CreateCreature::Create() {
|
||||
auto rand = Core::Random();
|
||||
auto species = this->_library->GetSpeciesLibrary()->GetSpecies(this->_species);
|
||||
auto species = this->_library->GetSpeciesLibrary()->Get(this->_species.c_str());
|
||||
auto variant = species->GetVariant(this->_variant);
|
||||
int8_t talent;
|
||||
if (this->_talent.empty()) {
|
||||
@@ -49,7 +49,9 @@ Creature* CreateCreature::Create() {
|
||||
}
|
||||
const Library::Item* heldItem = nullptr;
|
||||
if (!this->_heldItem.empty()) {
|
||||
heldItem = _library->GetItemLibrary()->GetItem(this->_heldItem);
|
||||
if (!_library->GetItemLibrary()->TryGet(this->_heldItem.c_str(), heldItem)) {
|
||||
throw CreatureException("Invalid held item.");
|
||||
}
|
||||
}
|
||||
// FIXME: implement experience
|
||||
auto experience = 0;
|
||||
|
||||
Reference in New Issue
Block a user