PkmnLib/tests/TestLibrary/TestLibrary.hpp

77 lines
3.7 KiB
C++

#ifndef PKMNLIB_TESTLIBRARY_HPP
#define PKMNLIB_TESTLIBRARY_HPP
#include <CreatureLib/Library/GrowthRates/LookupGrowthRate.hpp>
#include "../../src/Battling/Library/BattleLibrary.hpp"
#include "../../src/Library/Moves/MoveLibrary.hpp"
#include "../../src/Library/PokemonLibrary.hpp"
#include "../../src/Library/Statistic.hpp"
class TestLibrary {
private:
static PkmnLib::Battling::BattleLibrary* _library;
public:
static PkmnLib::Battling::BattleLibrary* GetLibrary() {
if (_library == nullptr) {
_library = BuildLibrary();
}
return _library;
}
static PkmnLib::Battling::BattleLibrary* BuildLibrary() {
auto statCalc = new PkmnLib::Battling::StatCalculator();
auto scriptResolver = PkmnLib::Battling::BattleLibrary::CreateScriptResolver();
auto lib = new PkmnLib::Battling::BattleLibrary(
BuildStaticLibrary(), statCalc, new PkmnLib::Battling::DamageLibrary(),
new CreatureLib::Battling::ExperienceLibrary(), scriptResolver,
new CreatureLib::Battling::MiscLibrary());
scriptResolver->Initialize(lib);
return lib;
}
static PkmnLib::Library::PokemonLibrary* BuildStaticLibrary() {
return new PkmnLib::Library::PokemonLibrary(new PkmnLib::Library::LibrarySettings(100, 4, 4096),
BuildSpeciesLibrary(), BuildMoveLibrary(), BuildItemLibrary(),
BuildGrowthRateLibrary(), BuildTypeLibrary(), BuildNatureLibrary());
}
static PkmnLib::Library::SpeciesLibrary* BuildSpeciesLibrary();
static PkmnLib::Library::MoveLibrary* BuildMoveLibrary();
static PkmnLib::Library::ItemLibrary* BuildItemLibrary();
static CreatureLib::Library::GrowthRateLibrary* BuildGrowthRateLibrary() {
auto lib = new CreatureLib::Library::GrowthRateLibrary();
lib->AddGrowthRate(
"testGrowthRate"_cnc,
new CreatureLib::Library::LookupGrowthRate(
{0, 15, 52, 122, 237, 406, 637, 942, 1326, 1800, 2369, 3041, 3822,
4719, 5737, 6881, 8155, 9564, 11111, 12800, 14632, 16610, 18737, 21012, 23437, 26012,
28737, 31610, 34632, 37800, 41111, 44564, 48155, 51881, 55737, 59719, 63822, 68041, 72369,
76800, 81326, 85942, 90637, 95406, 100237, 105122, 110052, 115015, 120001, 125000, 131324, 137795,
144410, 151165, 158056, 165079, 172229, 179503, 186894, 194400, 202013, 209728, 217540, 225443, 233431,
241496, 249633, 257834, 267406, 276458, 286328, 296358, 305767, 316074, 326531, 336255, 346965, 357812,
367807, 378880, 390077, 400293, 411686, 423190, 433572, 445239, 457001, 467489, 479378, 491346, 501878,
513934, 526049, 536557, 548720, 560922, 571333, 583539, 591882, 600000}));
return lib;
}
static CreatureLib::Library::TypeLibrary* BuildTypeLibrary() {
auto lib = new CreatureLib::Library::TypeLibrary();
return lib;
}
static PkmnLib::Library::NatureLibrary* BuildNatureLibrary() {
auto lib = new PkmnLib::Library::NatureLibrary();
lib->LoadNature("neutralNature", PkmnLib::Library::Nature(PkmnLib::Library::Statistic::PhysicalAttack,
PkmnLib::Library::Statistic::PhysicalDefense, 1, 1));
lib->LoadNature("buffsAttackNerfsSpeed", PkmnLib::Library::Nature(PkmnLib::Library::Statistic::PhysicalAttack,
PkmnLib::Library::Statistic::Speed, 1.1, 0.9));
return lib;
}
};
#endif // PKMNLIB_TESTLIBRARY_HPP