87 lines
3.8 KiB
C++
87 lines
3.8 KiB
C++
#ifndef PKMNLIB_TESTLIBRARY_HPP
|
|
#define PKMNLIB_TESTLIBRARY_HPP
|
|
|
|
#include <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 CreatureLib::Battling::BattleStatCalculator();
|
|
return new PkmnLib::Battling::BattleLibrary(
|
|
BuildStaticLibrary(), statCalc, new CreatureLib::Battling::DamageLibrary(),
|
|
new CreatureLib::Battling::ExperienceLibrary(), new CreatureLib::Battling::ScriptResolver(),
|
|
new CreatureLib::Battling::MiscLibrary());
|
|
}
|
|
|
|
static PkmnLib::Library::PokemonLibrary* BuildStaticLibrary() {
|
|
return new PkmnLib::Library::PokemonLibrary(CreatureLib::Library::LibrarySettings(100, 4),
|
|
BuildSpeciesLibrary(), BuildMoveLibrary(), BuildItemLibrary(),
|
|
BuildGrowthRateLibrary(), BuildTypeLibrary(), BuildNatureLibrary());
|
|
}
|
|
|
|
static PkmnLib::Library::SpeciesLibrary* BuildSpeciesLibrary() {
|
|
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
|
lib->LoadSpecies("testSpecies", new PkmnLib::Library::PokemonSpecies(
|
|
1, "testSpecies",
|
|
new PkmnLib::Library::PokemonForme(
|
|
"default", 1.0f, 1.0f, 100, {0},
|
|
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
|
{"testAbility"}, {"testHiddenAbility"},
|
|
new CreatureLib::Library::LearnableAttacks(100)),
|
|
0.5f, "testGrowthRate", 100, 100));
|
|
lib->LoadSpecies(
|
|
"testSpecies2",
|
|
new PkmnLib::Library::PokemonSpecies(
|
|
2, "testSpecies2",
|
|
new PkmnLib::Library::PokemonForme(
|
|
"default", 1.0f, 1.0f, 100, {0},
|
|
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
|
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
|
0.5f, "testGrowthRate", 100, 100));
|
|
return lib;
|
|
}
|
|
|
|
static PkmnLib::Library::MoveLibrary* BuildMoveLibrary() {
|
|
auto lib = new PkmnLib::Library::MoveLibrary();
|
|
return lib;
|
|
}
|
|
|
|
static PkmnLib::Library::ItemLibrary* BuildItemLibrary() {
|
|
auto lib = new PkmnLib::Library::ItemLibrary();
|
|
return lib;
|
|
}
|
|
|
|
static CreatureLib::Library::GrowthRateLibrary* BuildGrowthRateLibrary() {
|
|
auto lib = new CreatureLib::Library::GrowthRateLibrary();
|
|
lib->AddGrowthRate("testGrowthRate", new CreatureLib::Library::LookupGrowthRate());
|
|
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));
|
|
return lib;
|
|
}
|
|
};
|
|
|
|
#endif // PKMNLIB_TESTLIBRARY_HPP
|