2019-12-29 14:29:52 +00:00
|
|
|
#ifndef PKMNLIB_TESTLIBRARY_HPP
|
|
|
|
#define PKMNLIB_TESTLIBRARY_HPP
|
|
|
|
|
2020-01-02 17:02:40 +00:00
|
|
|
#include <Library/GrowthRates/LookupGrowthRate.hpp>
|
|
|
|
#include "../../src/Battling/Library/BattleLibrary.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;
|
|
|
|
}
|
|
|
|
|
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(
|
2020-01-02 17:02:40 +00:00
|
|
|
BuildStaticLibrary(), statCalc, new CreatureLib::Battling::DamageLibrary(),
|
2020-01-09 16:03:34 +00:00
|
|
|
new CreatureLib::Battling::ExperienceLibrary(), scriptResolver,
|
2020-01-02 17:02:40 +00:00
|
|
|
new CreatureLib::Battling::MiscLibrary());
|
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() {
|
2019-12-29 14:29:52 +00:00
|
|
|
return new PkmnLib::Library::PokemonLibrary(CreatureLib::Library::LibrarySettings(100, 4),
|
2019-12-30 15:19:53 +00:00
|
|
|
BuildSpeciesLibrary(), BuildMoveLibrary(), BuildItemLibrary(),
|
|
|
|
BuildGrowthRateLibrary(), BuildTypeLibrary(), BuildNatureLibrary());
|
2019-12-29 14:29:52 +00:00
|
|
|
}
|
|
|
|
|
2020-01-05 14:18:30 +00:00
|
|
|
static PkmnLib::Library::SpeciesLibrary* BuildSpeciesLibrary();
|
2019-12-29 14:29:52 +00:00
|
|
|
|
2019-12-30 15:19:53 +00:00
|
|
|
static PkmnLib::Library::MoveLibrary* BuildMoveLibrary() {
|
|
|
|
auto lib = new PkmnLib::Library::MoveLibrary();
|
2019-12-29 14:29:52 +00:00
|
|
|
return lib;
|
|
|
|
}
|
|
|
|
|
2019-12-30 15:19:53 +00:00
|
|
|
static PkmnLib::Library::ItemLibrary* BuildItemLibrary() {
|
|
|
|
auto lib = new PkmnLib::Library::ItemLibrary();
|
2019-12-29 14:29:52 +00:00
|
|
|
return lib;
|
|
|
|
}
|
|
|
|
|
|
|
|
static CreatureLib::Library::GrowthRateLibrary* BuildGrowthRateLibrary() {
|
|
|
|
auto lib = new CreatureLib::Library::GrowthRateLibrary();
|
2020-01-02 17:02:40 +00:00
|
|
|
lib->AddGrowthRate("testGrowthRate", new CreatureLib::Library::LookupGrowthRate());
|
2019-12-29 14:29:52 +00:00
|
|
|
return lib;
|
|
|
|
}
|
|
|
|
|
|
|
|
static CreatureLib::Library::TypeLibrary* BuildTypeLibrary() {
|
|
|
|
auto lib = new CreatureLib::Library::TypeLibrary();
|
|
|
|
return lib;
|
|
|
|
}
|
2019-12-30 15:19:53 +00:00
|
|
|
|
|
|
|
static PkmnLib::Library::NatureLibrary* BuildNatureLibrary() {
|
|
|
|
auto lib = new PkmnLib::Library::NatureLibrary();
|
2020-01-02 19:26:01 +00:00
|
|
|
lib->LoadNature("neutralNature", PkmnLib::Library::Nature(PkmnLib::Library::Statistic::PhysicalAttack,
|
|
|
|
PkmnLib::Library::Statistic::PhysicalDefense, 1, 1));
|
2020-01-05 14:18:30 +00:00
|
|
|
lib->LoadNature("buffsAttackNerfsSpeed", PkmnLib::Library::Nature(PkmnLib::Library::Statistic::PhysicalAttack,
|
|
|
|
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
|