Update to latest CreatureLib.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
42ea76cf53
commit
19062cfc93
|
@ -73,13 +73,13 @@ PkmnLib::Battling::Pokemon* PkmnLib::Battling::CreatePokemon::Build() {
|
||||||
auto experience = _library->GetGrowthRateLibrary()->CalculateExperience(species->GetGrowthRate(), _level);
|
auto experience = _library->GetGrowthRateLibrary()->CalculateExperience(species->GetGrowthRate(), _level);
|
||||||
|
|
||||||
auto attacks = List<CreatureLib::Battling::LearnedAttack*>(_attacks.Count());
|
auto attacks = List<CreatureLib::Battling::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];
|
auto& kv = _attacks[i];
|
||||||
auto move = kv.Move;
|
auto move = kv.Move;
|
||||||
if (move != nullptr)
|
if (move != nullptr)
|
||||||
attacks[i] = new LearnedMove(move, kv.LearnMethod);
|
attacks.Append(new LearnedMove(move, kv.LearnMethod));
|
||||||
else
|
else
|
||||||
attacks[i] = nullptr;
|
attacks.Append(nullptr);
|
||||||
}
|
}
|
||||||
auto ivs = CreatureLib::Library::StatisticSet(_ivHp, _ivAttack, _ivDefense, _ivSpAtt, _ivSpDef, _ivSpeed);
|
auto ivs = CreatureLib::Library::StatisticSet(_ivHp, _ivAttack, _ivDefense, _ivSpAtt, _ivSpDef, _ivSpeed);
|
||||||
auto evs = CreatureLib::Library::StatisticSet(_evHp, _evAttack, _evDefense, _evSpAtt, _evSpDef, _evSpeed);
|
auto evs = CreatureLib::Library::StatisticSet(_evHp, _evAttack, _evDefense, _evSpAtt, _evSpDef, _evSpeed);
|
||||||
|
@ -158,8 +158,6 @@ PkmnLib::Battling::CreatePokemon::LearnMove(const Arbutils::CaseInsensitiveConst
|
||||||
throw CreatureException("This pokemon already has the maximal allowed moves.");
|
throw CreatureException("This pokemon already has the maximal allowed moves.");
|
||||||
}
|
}
|
||||||
Assert(move != nullptr);
|
Assert(move != nullptr);
|
||||||
auto& c = _attacks[_currentMove++];
|
_attacks.Append(ToLearnMethod(move, method));
|
||||||
c.Move = move;
|
|
||||||
c.LearnMethod = method;
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ namespace PkmnLib::Battling {
|
||||||
const Library::MoveData* Move;
|
const Library::MoveData* Move;
|
||||||
CreatureLib::Battling::AttackLearnMethod LearnMethod;
|
CreatureLib::Battling::AttackLearnMethod LearnMethod;
|
||||||
ToLearnMethod() : Move(nullptr), LearnMethod(CreatureLib::Battling::AttackLearnMethod::Unknown){};
|
ToLearnMethod() : Move(nullptr), LearnMethod(CreatureLib::Battling::AttackLearnMethod::Unknown){};
|
||||||
|
ToLearnMethod(const Library::MoveData* move, CreatureLib::Battling::AttackLearnMethod method)
|
||||||
|
: Move(move), LearnMethod(method){};
|
||||||
};
|
};
|
||||||
Arbutils::Collections::List<ToLearnMethod> _attacks;
|
Arbutils::Collections::List<ToLearnMethod> _attacks;
|
||||||
uint8_t _currentMove = 0;
|
uint8_t _currentMove = 0;
|
||||||
|
@ -45,8 +47,7 @@ namespace PkmnLib::Battling {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CreatePokemon(const BattleLibrary* library, const Arbutils::CaseInsensitiveConstString& species, uint8_t level)
|
CreatePokemon(const BattleLibrary* library, const Arbutils::CaseInsensitiveConstString& species, uint8_t level)
|
||||||
: _library(library), _species(species), _level(level) {
|
: _library(library), _species(species), _level(level), _attacks(library->GetSettings()->GetMaximalMoves()) {
|
||||||
_attacks.Resize(library->GetSettings()->GetMaximalMoves(), ToLearnMethod());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePokemon WithForme(const Arbutils::CaseInsensitiveConstString& forme);
|
CreatePokemon WithForme(const Arbutils::CaseInsensitiveConstString& forme);
|
||||||
|
|
Loading…
Reference in New Issue