Rework for LearnMove method on CreatePokemon.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2020-04-22 14:02:53 +02:00
parent 984088f7a9
commit 0cce1fdda2
3 changed files with 48 additions and 18 deletions

View File

@@ -17,7 +17,14 @@ namespace PkmnLib::Battling {
CreatureLib::Library::Gender _gender = static_cast<CreatureLib::Library::Gender>(-1);
Arbutils::CaseInsensitiveConstString _heldItem = ""_cnc;
uint32_t _identifier = 0;
std::vector<std::tuple<const Library::MoveData*, CreatureLib::Battling::AttackLearnMethod>> _attacks = {};
struct ToLearnMethod {
const Library::MoveData* Move;
CreatureLib::Battling::AttackLearnMethod LearnMethod;
ToLearnMethod() : Move(nullptr), LearnMethod(CreatureLib::Battling::AttackLearnMethod::Unknown){};
};
Arbutils::Collections::List<ToLearnMethod> _attacks;
size_t _currentMove = 0;
uint8_t _ivHp = 0;
uint8_t _ivAttack = 0;
@@ -38,13 +45,16 @@ namespace PkmnLib::Battling {
public:
CreatePokemon(const BattleLibrary* library, const Arbutils::CaseInsensitiveConstString& species, uint8_t level)
: _library(library), _species(species), _level(level) {}
: _library(library), _species(species), _level(level) {
_attacks.Resize(library->GetSettings()->GetMaximalMoves(), ToLearnMethod());
}
CreatePokemon* WithForme(const Arbutils::CaseInsensitiveConstString& forme);
CreatePokemon* WithGender(CreatureLib::Library::Gender gender);
CreatePokemon* IsShiny(bool value);
CreatePokemon* WithHeldItem(const Arbutils::CaseInsensitiveConstString& item);
CreatePokemon* LearnMove(const Arbutils::CaseInsensitiveConstString& move, CreatureLib::Battling::AttackLearnMethod method);
CreatePokemon* LearnMove(const Arbutils::CaseInsensitiveConstString& move,
CreatureLib::Battling::AttackLearnMethod method);
CreatePokemon* WithRandomIndividualValues(Arbutils::Random rand = Arbutils::Random());
CreatePokemon* WithIndividualValue(CreatureLib::Library::Statistic stat, uint8_t value);
@@ -52,7 +62,7 @@ namespace PkmnLib::Battling {
uint8_t speed);
CreatePokemon* WithEffortValue(CreatureLib::Library::Statistic stat, uint8_t value);
CreatePokemon* WithEffortValues(uint8_t hp, uint8_t att, uint8_t def, uint8_t spAtt, uint8_t spDef,
uint8_t speed);
uint8_t speed);
CreatePokemon* WithNature(const Arbutils::CaseInsensitiveConstString& nature);