Updated to latest Arbutils.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-04-25 10:41:15 +02:00
parent df37558ec0
commit 1eb751538d
7 changed files with 66 additions and 77 deletions

View File

@@ -5,29 +5,29 @@
using namespace CreatureLib::Battling;
CreateCreature* CreateCreature::WithVariant(const Arbutils::CaseInsensitiveConstString& variant) {
CreateCreature CreateCreature::WithVariant(const Arbutils::CaseInsensitiveConstString& variant) {
this->_variant = variant;
return this;
return *this;
}
CreateCreature* CreateCreature::WithNickname(std::string nickname) {
CreateCreature CreateCreature::WithNickname(std::string nickname) {
this->_nickname = std::move(nickname);
return this;
return *this;
}
CreateCreature* CreateCreature::WithGender(Library::Gender gender) {
CreateCreature CreateCreature::WithGender(Library::Gender gender) {
this->_gender = gender;
return this;
return *this;
}
CreateCreature* CreateCreature::WithAttack(const Arbutils::CaseInsensitiveConstString& attackName,
AttackLearnMethod learnMethod) {
CreateCreature CreateCreature::WithAttack(const Arbutils::CaseInsensitiveConstString& attackName,
AttackLearnMethod learnMethod) {
if (_attacks.Count() >= _library->GetSettings()->GetMaximalMoves())
throw CreatureException("You have already set the maximum amount of allowed moves.");
auto attackData = _library->GetAttackLibrary()->Get(attackName);
_attacks.Append(std::tuple(attackData, learnMethod));
return this;
return *this;
}
Creature* CreateCreature::Create() {
@@ -57,9 +57,9 @@ Creature* CreateCreature::Create() {
auto experience = _library->GetGrowthRateLibrary()->CalculateExperience(species->GetGrowthRate(), _level);
auto attacks = List<LearnedAttack*>(_attacks.Count());
for (size_t i = 0; i < attacks.Count(); i++) {
for (size_t i = 0; i < _attacks.Count(); i++) {
auto kv = _attacks[i];
attacks[i] = new LearnedAttack(std::get<0>(kv), std::get<1>(kv));
attacks.Append(new LearnedAttack(std::get<0>(kv), std::get<1>(kv)));
}
auto c = new Creature(_library, species, variant, _level, experience, identifier, gender, _coloring, heldItem,
_nickname, talent, attacks);