2019-12-29 14:29:52 +00:00
|
|
|
#ifndef PKMNLIB_TESTLIBRARY_HPP
|
|
|
|
#define PKMNLIB_TESTLIBRARY_HPP
|
|
|
|
|
2020-02-08 18:22:29 +00:00
|
|
|
#include <CreatureLib/Library/GrowthRates/LookupGrowthRate.hpp>
|
2020-01-02 17:02:40 +00:00
|
|
|
#include "../../src/Battling/Library/BattleLibrary.hpp"
|
2020-04-22 14:10:13 +00:00
|
|
|
#include "../../src/Battling/Library/MiscLibrary.hpp"
|
2019-12-30 15:19:53 +00:00
|
|
|
#include "../../src/Library/Moves/MoveLibrary.hpp"
|
2019-12-29 14:29:52 +00:00
|
|
|
#include "../../src/Library/PokemonLibrary.hpp"
|
2020-01-02 19:26:01 +00:00
|
|
|
#include "../../src/Library/Statistic.hpp"
|
2020-01-11 21:30:23 +00:00
|
|
|
|
2019-12-29 14:29:52 +00:00
|
|
|
class TestLibrary {
|
|
|
|
private:
|
2020-01-02 17:02:40 +00:00
|
|
|
static PkmnLib::Battling::BattleLibrary* _library;
|
2019-12-29 14:29:52 +00:00
|
|
|
|
|
|
|
public:
|
2020-01-02 17:02:40 +00:00
|
|
|
static PkmnLib::Battling::BattleLibrary* GetLibrary() {
|
2019-12-29 14:29:52 +00:00
|
|
|
if (_library == nullptr) {
|
|
|
|
_library = BuildLibrary();
|
|
|
|
}
|
|
|
|
return _library;
|
|
|
|
}
|
|
|
|
|
2021-06-27 15:11:37 +00:00
|
|
|
static PkmnLib::Library::TimeOfDay GetTime() { return PkmnLib::Library::TimeOfDay::Morning; }
|
|
|
|
|
2020-01-02 17:02:40 +00:00
|
|
|
static PkmnLib::Battling::BattleLibrary* BuildLibrary() {
|
2020-01-05 14:18:30 +00:00
|
|
|
auto statCalc = new PkmnLib::Battling::StatCalculator();
|
2020-01-11 21:30:23 +00:00
|
|
|
auto scriptResolver = PkmnLib::Battling::BattleLibrary::CreateScriptResolver();
|
2020-01-09 16:03:34 +00:00
|
|
|
auto lib = new PkmnLib::Battling::BattleLibrary(
|
2021-08-28 10:04:18 +00:00
|
|
|
BuildStaticLibrary(), statCalc, new PkmnLib::Battling::DamageLibrary(false),
|
2021-06-27 15:11:37 +00:00
|
|
|
new PkmnLib::Battling::ExperienceLibrary(), scriptResolver, new PkmnLib::Battling::MiscLibrary(GetTime));
|
2020-01-09 16:03:34 +00:00
|
|
|
scriptResolver->Initialize(lib);
|
|
|
|
return lib;
|
2020-01-02 17:02:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static PkmnLib::Library::PokemonLibrary* BuildStaticLibrary() {
|
2021-11-15 11:47:02 +00:00
|
|
|
auto talentLibrary = BuildTalentLibrary();
|
|
|
|
return new PkmnLib::Library::PokemonLibrary(
|
|
|
|
new PkmnLib::Library::LibrarySettings(100, 4, 4096), BuildSpeciesLibrary(talentLibrary), BuildMoveLibrary(),
|
|
|
|
BuildItemLibrary(), BuildGrowthRateLibrary(), BuildTypeLibrary(), talentLibrary, BuildNatureLibrary());
|
2019-12-29 14:29:52 +00:00
|
|
|
}
|
|
|
|
|
2021-11-15 11:47:02 +00:00
|
|
|
static PkmnLib::Library::SpeciesLibrary* BuildSpeciesLibrary(CreatureLib::Library::TalentLibrary*);
|
2019-12-29 14:29:52 +00:00
|
|
|
|
2020-01-18 13:35:08 +00:00
|
|
|
static PkmnLib::Library::MoveLibrary* BuildMoveLibrary();
|
2019-12-29 14:29:52 +00:00
|
|
|
|
2020-01-22 09:33:10 +00:00
|
|
|
static PkmnLib::Library::ItemLibrary* BuildItemLibrary();
|
2019-12-29 14:29:52 +00:00
|
|
|
|
|
|
|
static CreatureLib::Library::GrowthRateLibrary* BuildGrowthRateLibrary() {
|
|
|
|
auto lib = new CreatureLib::Library::GrowthRateLibrary();
|
2020-04-06 18:03:44 +00:00
|
|
|
lib->AddGrowthRate(
|
2020-04-10 12:57:20 +00:00
|
|
|
"testGrowthRate"_cnc.GetHash(),
|
2020-04-06 18:03:44 +00:00
|
|
|
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}));
|
2019-12-29 14:29:52 +00:00
|
|
|
return lib;
|
|
|
|
}
|
|
|
|
|
|
|
|
static CreatureLib::Library::TypeLibrary* BuildTypeLibrary() {
|
|
|
|
auto lib = new CreatureLib::Library::TypeLibrary();
|
2020-12-28 14:11:06 +00:00
|
|
|
lib->RegisterType("testType1"_cnc);
|
2019-12-29 14:29:52 +00:00
|
|
|
return lib;
|
|
|
|
}
|
2019-12-30 15:19:53 +00:00
|
|
|
|
2021-11-15 11:47:02 +00:00
|
|
|
static CreatureLib::Library::TalentLibrary* BuildTalentLibrary() {
|
|
|
|
auto lib = new CreatureLib::Library::TalentLibrary();
|
|
|
|
lib->Insert("testAbility", new CreatureLib::Library::Talent("testAbility", "", {}));
|
|
|
|
lib->Insert("testHiddenAbility", new CreatureLib::Library::Talent("testHiddenAbility", "", {}));
|
|
|
|
return lib;
|
|
|
|
}
|
|
|
|
|
2019-12-30 15:19:53 +00:00
|
|
|
static PkmnLib::Library::NatureLibrary* BuildNatureLibrary() {
|
|
|
|
auto lib = new PkmnLib::Library::NatureLibrary();
|
2020-04-17 16:20:48 +00:00
|
|
|
lib->LoadNature("neutralNature"_cnc,
|
2020-04-17 16:39:04 +00:00
|
|
|
new PkmnLib::Library::Nature(PkmnLib::Library::Statistic::PhysicalAttack,
|
2020-04-22 14:10:13 +00:00
|
|
|
PkmnLib::Library::Statistic::PhysicalDefense, 1, 1));
|
2020-04-17 16:20:48 +00:00
|
|
|
lib->LoadNature("buffsAttackNerfsSpeed"_cnc,
|
2020-04-17 16:39:04 +00:00
|
|
|
new PkmnLib::Library::Nature(PkmnLib::Library::Statistic::PhysicalAttack,
|
2020-04-22 14:10:13 +00:00
|
|
|
PkmnLib::Library::Statistic::Speed, 1.1, 0.9));
|
2019-12-30 15:19:53 +00:00
|
|
|
return lib;
|
|
|
|
}
|
2019-12-29 14:29:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PKMNLIB_TESTLIBRARY_HPP
|