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::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) {
|
2020-02-01 12:30:51 +00:00
|
|
|
auto l = new DataLibrary(new LibrarySettings(100, 4), BuildSpeciesLibrary(), BuildAttackLibrary(),
|
2019-12-14 12:28:23 +00:00
|
|
|
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();
|
2020-02-27 17:23:23 +00:00
|
|
|
l->Insert("testSpecies1"_cnc,
|
|
|
|
new CreatureSpecies(0, "testSpecies1"_cnc,
|
2020-02-28 18:23:24 +00:00
|
|
|
new SpeciesVariant("default"_cnc, 1, 1, 10, {0, 1},
|
|
|
|
StatisticSet<uint16_t>(10, 10, 10, 10, 10, 10), {"testTalent"_cnc},
|
|
|
|
{"testSecretTalent"_cnc}, new LearnableAttacks(100)),
|
2020-02-27 17:23:23 +00:00
|
|
|
0.5f, "testGrowthRate"_cnc, 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-03-02 14:29:42 +00:00
|
|
|
l->Insert("standard"_cnc, new AttackData("standard"_cnc, 0, AttackCategory::Physical, 20, 100, 30,
|
2020-02-27 17:23:23 +00:00
|
|
|
AttackTarget::AdjacentOpponent, 0, {}));
|
2020-03-02 14:29:42 +00:00
|
|
|
l->Insert("highPriority"_cnc, new AttackData("highPriority"_cnc, 0, AttackCategory::Physical, 20, 100, 30,
|
2020-02-27 17:23:23 +00:00
|
|
|
AttackTarget::AdjacentOpponent, 1, {}));
|
2020-03-02 14:29:42 +00:00
|
|
|
l->Insert("higherPriority"_cnc, new AttackData("higherPriority"_cnc, 0, AttackCategory::Physical, 20, 100, 30,
|
2020-02-27 17:23:23 +00:00
|
|
|
AttackTarget::AdjacentOpponent, 2, {}));
|
2020-03-02 14:29:42 +00:00
|
|
|
l->Insert("lowPriority"_cnc, new AttackData("lowPriority"_cnc, 0, AttackCategory::Physical, 20, 100, 30,
|
2020-02-27 17:23:23 +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();
|
2020-03-04 08:11:32 +00:00
|
|
|
l->AddGrowthRate(
|
|
|
|
"testGrowthRate"_cnc,
|
|
|
|
new 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-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();
|
2020-02-29 14:41:43 +00:00
|
|
|
l->RegisterType("testType1"_cnc);
|
|
|
|
l->RegisterType("testType2"_cnc);
|
|
|
|
l->RegisterType("testType3"_cnc);
|
2019-11-04 16:58:26 +00:00
|
|
|
return l;
|
|
|
|
}
|
2019-10-06 11:50:52 +00:00
|
|
|
|
|
|
|
#endif
|