Breaking change: rework of talents.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -51,7 +51,7 @@ TEST_CASE("Override Creature talent") {
|
||||
auto library = TestLibrary::Get();
|
||||
auto creature = CreateCreature(library, "testSpecies1"_cnc, 1).Create();
|
||||
creature->OverrideActiveTalent("foobar");
|
||||
REQUIRE(creature->GetActiveTalent() == "foobar");
|
||||
REQUIRE(creature->GetActiveTalent()->GetName() == "foobar"_cnc);
|
||||
delete creature;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
#include "../../extern/doctest.hpp"
|
||||
#include "../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
TEST_CASE("Can Create Species Library") {
|
||||
auto l = TestLibrary::BuildSpeciesLibrary();
|
||||
REQUIRE(l != nullptr);
|
||||
delete l;
|
||||
}
|
||||
|
||||
TEST_CASE("Can Create Attack Library") {
|
||||
auto l = TestLibrary::BuildAttackLibrary();
|
||||
REQUIRE(l != nullptr);
|
||||
|
||||
@@ -9,8 +9,9 @@ BattleLibrary* TestLibrary::_library = nullptr;
|
||||
|
||||
BattleLibrary* TestLibrary::Get() {
|
||||
if (TestLibrary::_library == nullptr) {
|
||||
auto l = new DataLibrary(new LibrarySettings(100, 4), BuildSpeciesLibrary(), BuildAttackLibrary(),
|
||||
BuildItemLibrary(), BuildGrowthRateLibrary(), BuildTypeLibrary());
|
||||
auto talentLibrary = BuildTalentLibrary();
|
||||
auto l = new DataLibrary(new LibrarySettings(100, 4), BuildSpeciesLibrary(talentLibrary), BuildAttackLibrary(),
|
||||
BuildItemLibrary(), BuildGrowthRateLibrary(), BuildTypeLibrary(), talentLibrary);
|
||||
auto statCalc = new BattleStatCalculator();
|
||||
auto battleLib = new BattleLibrary(l, statCalc, new DamageLibrary(), new ExperienceLibrary(),
|
||||
new ScriptResolver(), new MiscLibrary());
|
||||
@@ -19,14 +20,15 @@ BattleLibrary* TestLibrary::Get() {
|
||||
return TestLibrary::_library;
|
||||
}
|
||||
|
||||
SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
|
||||
SpeciesLibrary* TestLibrary::BuildSpeciesLibrary(const TalentLibrary* talentLibrary) {
|
||||
auto l = new SpeciesLibrary();
|
||||
l->Insert("testSpecies1"_cnc.GetHash(),
|
||||
new CreatureSpecies(0, "testSpecies1"_cnc,
|
||||
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)),
|
||||
0.5f, "testGrowthRate"_cnc, 5));
|
||||
new CreatureSpecies(
|
||||
0, "testSpecies1"_cnc,
|
||||
new SpeciesVariant("default"_cnc, 1, 1, 10, {0, 1}, StatisticSet<uint16_t>(10, 10, 10, 10, 10, 10),
|
||||
{talentLibrary->Get("testTalent"_cnc)},
|
||||
{talentLibrary->Get("testSecretTalent"_cnc)}, new LearnableAttacks(100)),
|
||||
0.5f, "testGrowthRate"_cnc, 5));
|
||||
return l;
|
||||
}
|
||||
|
||||
@@ -75,4 +77,12 @@ TypeLibrary* TestLibrary::BuildTypeLibrary() {
|
||||
return l;
|
||||
}
|
||||
|
||||
TalentLibrary* TestLibrary::BuildTalentLibrary() {
|
||||
auto* lib = new TalentLibrary();
|
||||
lib->Insert("testTalent", new Talent("testTalent", "", {}));
|
||||
lib->Insert("testSecretTalent", new Talent("testTalent", "", {}));
|
||||
lib->Insert("foobar", new Talent("foobar", "", {}));
|
||||
return lib;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -12,11 +12,12 @@ class TestLibrary {
|
||||
static BattleLibrary* _library;
|
||||
|
||||
public:
|
||||
static SpeciesLibrary* BuildSpeciesLibrary();
|
||||
static SpeciesLibrary* BuildSpeciesLibrary(const TalentLibrary*);
|
||||
static AttackLibrary* BuildAttackLibrary();
|
||||
static ItemLibrary* BuildItemLibrary();
|
||||
static GrowthRateLibrary* BuildGrowthRateLibrary();
|
||||
static TypeLibrary* BuildTypeLibrary();
|
||||
static TalentLibrary* BuildTalentLibrary();
|
||||
|
||||
static BattleLibrary* Get();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user