2019-10-06 11:50:52 +00:00
|
|
|
#ifdef TESTS_BUILD
|
2019-12-07 12:45:44 +00:00
|
|
|
|
|
|
|
#include "TestLibrary.hpp"
|
2019-12-14 12:28:23 +00:00
|
|
|
#include "../../src/Library/GrowthRates/LookupGrowthRate.hpp"
|
2019-10-06 11:50:52 +00:00
|
|
|
|
|
|
|
using namespace CreatureLib::Core;
|
|
|
|
using namespace CreatureLib::Library;
|
2019-10-24 11:37:55 +00:00
|
|
|
using namespace CreatureLib::Battling;
|
2019-12-07 12:45:44 +00:00
|
|
|
BattleLibrary* TestLibrary::_library = nullptr;
|
|
|
|
|
2019-12-14 12:28:23 +00:00
|
|
|
BattleLibrary* TestLibrary::Get() {
|
|
|
|
if (TestLibrary::_library == nullptr) {
|
|
|
|
auto l = new DataLibrary(LibrarySettings(100, 4), BuildSpeciesLibrary(), BuildAttackLibrary(),
|
|
|
|
BuildItemLibrary(), BuildGrowthRateLibrary(), BuildTypeLibrary());
|
2019-12-07 12:45:44 +00:00
|
|
|
auto statCalc = new BattleStatCalculator();
|
2019-12-15 10:52:10 +00:00
|
|
|
auto battleLib = new BattleLibrary(l, statCalc, new DamageLibrary(), new ExperienceLibrary(),
|
|
|
|
new ScriptResolver(), new MiscLibrary());
|
2019-12-07 12:45:44 +00:00
|
|
|
TestLibrary::_library = battleLib;
|
|
|
|
}
|
|
|
|
return TestLibrary::_library;
|
|
|
|
}
|
2019-10-06 11:50:52 +00:00
|
|
|
|
2019-12-14 12:28:23 +00:00
|
|
|
SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
|
2019-10-06 11:50:52 +00:00
|
|
|
auto l = new SpeciesLibrary();
|
2019-11-28 11:55:22 +00:00
|
|
|
l->LoadSpecies("testSpecies1",
|
|
|
|
new CreatureSpecies(
|
2019-12-14 12:28:23 +00:00
|
|
|
0, "testSpecies1",
|
|
|
|
new SpeciesVariant("default", 1, 1, 10, {0, 1}, StatisticSet<uint16_t>(10, 10, 10, 10, 10, 10),
|
|
|
|
{"testTalent"}, {"testSecretTalent"}, new LearnableAttacks(100)),
|
2019-12-27 11:19:38 +00:00
|
|
|
0.5f, "testGrowthRate", 5));
|
2019-10-06 11:50:52 +00:00
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
2019-12-14 12:28:23 +00:00
|
|
|
AttackLibrary* TestLibrary::BuildAttackLibrary() {
|
2019-10-06 11:50:52 +00:00
|
|
|
auto l = new AttackLibrary();
|
2020-01-18 12:41:01 +00:00
|
|
|
l->LoadAttack("standard", new AttackData("standard", 0, AttackCategory::Physical, 20, 100, 30,
|
2019-11-28 11:55:22 +00:00
|
|
|
AttackTarget::AdjacentOpponent, 0, {}));
|
2020-01-18 12:41:01 +00:00
|
|
|
l->LoadAttack("highPriority", new AttackData("highPriority", 0, AttackCategory::Physical, 20, 100, 30,
|
2019-11-28 11:55:22 +00:00
|
|
|
AttackTarget::AdjacentOpponent, 1, {}));
|
2020-01-18 12:41:01 +00:00
|
|
|
l->LoadAttack("higherPriority", new AttackData("higherPriority", 0, AttackCategory::Physical, 20, 100, 30,
|
2019-11-28 11:55:22 +00:00
|
|
|
AttackTarget::AdjacentOpponent, 2, {}));
|
2020-01-18 12:41:01 +00:00
|
|
|
l->LoadAttack("lowPriority", new AttackData("lowPriority", 0, AttackCategory::Physical, 20, 100, 30,
|
2019-11-28 11:55:22 +00:00
|
|
|
AttackTarget::AdjacentOpponent, -1, {}));
|
2019-10-06 11:50:52 +00:00
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
2019-12-14 12:28:23 +00:00
|
|
|
ItemLibrary* TestLibrary::BuildItemLibrary() {
|
2019-10-06 11:50:52 +00:00
|
|
|
auto l = new ItemLibrary();
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
2019-12-14 12:28:23 +00:00
|
|
|
GrowthRateLibrary* TestLibrary::BuildGrowthRateLibrary() {
|
2019-10-06 11:50:52 +00:00
|
|
|
auto l = new GrowthRateLibrary();
|
2019-12-14 12:28:23 +00:00
|
|
|
l->AddGrowthRate("testGrowthRate", new LookupGrowthRate());
|
2019-10-06 11:50:52 +00:00
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
2019-12-14 12:28:23 +00:00
|
|
|
TypeLibrary* TestLibrary::BuildTypeLibrary() {
|
2019-11-04 16:58:26 +00:00
|
|
|
auto l = new TypeLibrary();
|
|
|
|
l->RegisterType("testType1");
|
|
|
|
l->RegisterType("testType2");
|
|
|
|
l->RegisterType("testType3");
|
|
|
|
return l;
|
|
|
|
}
|
2019-10-06 11:50:52 +00:00
|
|
|
|
|
|
|
#endif
|