2019-10-06 11:50:52 +00:00
|
|
|
#ifdef TESTS_BUILD
|
|
|
|
#include "../../extern/catch.hpp"
|
2019-10-24 11:37:55 +00:00
|
|
|
#include "../../src/Battling/Library/BattleLibrary.hpp"
|
|
|
|
#include "../../src/Library/SpeciesLibrary.hpp"
|
|
|
|
#include "../../src/Library/AttackLibrary.hpp"
|
|
|
|
#include "../../src/Library/ItemLibrary.hpp"
|
|
|
|
#include "../../src/Library/GrowthRates/GrowthRateLibrary.hpp"
|
2019-10-06 11:50:52 +00:00
|
|
|
#include "../../src/Library/DataLibrary.hpp"
|
|
|
|
|
|
|
|
using namespace CreatureLib::Core;
|
|
|
|
using namespace CreatureLib::Library;
|
2019-10-24 11:37:55 +00:00
|
|
|
using namespace CreatureLib::Battling;
|
|
|
|
static BattleLibrary* __library = nullptr;
|
2019-10-06 11:50:52 +00:00
|
|
|
|
|
|
|
static SpeciesLibrary* BuildSpeciesLibrary(){
|
|
|
|
auto l = new SpeciesLibrary();
|
|
|
|
l->LoadSpecies("testSpecies1", new CreatureSpecies(0, "testSpecies1",
|
2019-10-17 12:33:25 +00:00
|
|
|
new SpeciesVariant("default", 1,1, 10, {"fire", "water"},
|
|
|
|
StatisticSet<uint16_t >(10,10,10,10,10,10),
|
2019-10-24 09:04:19 +00:00
|
|
|
{"testTalent"}, {"testSecretTalent"},
|
|
|
|
new LearnableAttacks(100)),
|
2019-10-06 11:50:52 +00:00
|
|
|
0.5f, "testGrowthRate", 5, 100));
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
|
|
|
static AttackLibrary* BuildAttackLibrary(){
|
|
|
|
auto l = new AttackLibrary();
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ItemLibrary* BuildItemLibrary(){
|
|
|
|
auto l = new ItemLibrary();
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GrowthRateLibrary* BuildGrowthRateLibrary(){
|
|
|
|
auto l = new GrowthRateLibrary();
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-24 11:37:55 +00:00
|
|
|
static BattleLibrary* BuildLibrary(){
|
2019-10-24 09:04:19 +00:00
|
|
|
auto l = new DataLibrary(LibrarySettings(100, 4), BuildSpeciesLibrary(), BuildAttackLibrary(),
|
|
|
|
BuildItemLibrary(), BuildGrowthRateLibrary());
|
2019-10-24 11:37:55 +00:00
|
|
|
auto battleLib = new BattleLibrary(l, new BattleStatCalculator());
|
|
|
|
return battleLib;
|
2019-10-06 11:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[[maybe_unused]]
|
2019-10-24 11:37:55 +00:00
|
|
|
static BattleLibrary* GetLibrary(){
|
2019-10-06 11:50:52 +00:00
|
|
|
if (__library == nullptr){
|
|
|
|
__library = BuildLibrary();
|
|
|
|
}
|
|
|
|
return __library;
|
|
|
|
}
|
|
|
|
#endif
|