PkmnLib/src/Battling/Pokemon/CreatePokemon.hpp

78 lines
2.9 KiB
C++

#ifndef PKMNLIB_CREATEPOKEMON_HPP
#define PKMNLIB_CREATEPOKEMON_HPP
#include "Pokemon.hpp"
namespace PkmnLib::Battling {
class CreatePokemon {
private:
ArbUt::BorrowedPtr<const BattleLibrary> _library;
ArbUt::StringView _species = ""_cnc;
ArbUt::StringView _forme = "default"_cnc;
level_int_t _level;
std::optional<std::string> _nickname = "";
ArbUt::StringView _ability = ""_cnc;
ArbUt::StringView _nature;
CreatureLib::Library::Gender _gender = static_cast<CreatureLib::Library::Gender>(-1);
ArbUt::StringView _heldItem = ""_cnc;
u32 _identifier = 0;
struct ToLearnMethod {
ArbUt::OptionalBorrowedPtr<const Library::MoveData> Move;
CreatureLib::Battling::AttackLearnMethod LearnMethod;
ToLearnMethod(ArbUt::BorrowedPtr<const Library::MoveData> move,
CreatureLib::Battling::AttackLearnMethod method)
: Move(move), LearnMethod(method){};
};
ArbUt::List<ToLearnMethod> _attacks;
u8 _currentMove = 0;
u8 _ivHp = 0;
u8 _ivAttack = 0;
u8 _ivDefense = 0;
u8 _ivSpAtt = 0;
u8 _ivSpDef = 0;
u8 _ivSpeed = 0;
u8 _evHp = 0;
u8 _evAttack = 0;
u8 _evDefense = 0;
u8 _evSpAtt = 0;
u8 _evSpDef = 0;
u8 _evSpeed = 0;
bool _shininessSet = false;
bool _isShiny = false;
bool _allowedExperienceGain = true;
public:
CreatePokemon(const BattleLibrary* library, const ArbUt::StringView& species, u8 level)
: _library(library), _species(species), _level(level),
_attacks(library->GetSettings()->GetMaximalAttacks()) {}
CreatePokemon& WithForme(const ArbUt::StringView& forme);
CreatePokemon& WithGender(CreatureLib::Library::Gender gender);
CreatePokemon& IsShiny(bool value);
CreatePokemon& WithHeldItem(const ArbUt::StringView& item);
CreatePokemon& LearnMove(const ArbUt::StringView& move, CreatureLib::Battling::AttackLearnMethod method);
CreatePokemon& WithRandomIndividualValues(ArbUt::Random& rand);
CreatePokemon& WithIndividualValue(CreatureLib::Library::Statistic stat, u8 value);
CreatePokemon& WithIndividualValues(u8 hp, u8 att, u8 def, u8 spAtt, u8 spDef, u8 speed);
CreatePokemon& WithEffortValue(CreatureLib::Library::Statistic stat, u8 value);
CreatePokemon& WithEffortValues(u8 hp, u8 att, u8 def, u8 spAtt, u8 spDef, u8 speed);
CreatePokemon& WithNature(const ArbUt::StringView& nature);
CreatePokemon& IsAllowedExperienceGain(bool value);
CreatePokemon& WithNickname(const std::string& nickname);
Pokemon* Build() {
auto rand = ArbUt::Random();
return Build(rand);
}
Pokemon* Build(ArbUt::Random& rand);
};
}
#endif // PKMNLIB_CREATEPOKEMON_HPP