Implement basic library class that other libraries inherit from for performance.
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:
@@ -28,8 +28,8 @@ TEST_CASE("Turn ordering: Attack before pass", "[Battling]") {
|
||||
|
||||
TEST_CASE("Turn ordering: High priority goes before no priority", "[Battling]") {
|
||||
auto l = TestLibrary::Get()->GetAttackLibrary();
|
||||
auto a1 = new LearnedAttack(l->GetAttack("standard"), AttackLearnMethod::Unknown);
|
||||
auto a2 = new LearnedAttack(l->GetAttack("highPriority"), AttackLearnMethod::Unknown);
|
||||
auto a1 = new LearnedAttack(l->Get("standard"), AttackLearnMethod::Unknown);
|
||||
auto a2 = new LearnedAttack(l->Get("highPriority"), AttackLearnMethod::Unknown);
|
||||
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
|
||||
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
|
||||
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
|
||||
@@ -50,8 +50,8 @@ TEST_CASE("Turn ordering: High priority goes before no priority", "[Battling]")
|
||||
|
||||
TEST_CASE("Turn ordering: Higher priority goes before high priority", "[Battling]") {
|
||||
auto l = TestLibrary::Get()->GetAttackLibrary();
|
||||
auto a1 = new LearnedAttack(l->GetAttack("highPriority"), AttackLearnMethod::Unknown);
|
||||
auto a2 = new LearnedAttack(l->GetAttack("higherPriority"), AttackLearnMethod::Unknown);
|
||||
auto a1 = new LearnedAttack(l->Get("highPriority"), AttackLearnMethod::Unknown);
|
||||
auto a2 = new LearnedAttack(l->Get("higherPriority"), AttackLearnMethod::Unknown);
|
||||
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
|
||||
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
|
||||
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
|
||||
@@ -72,8 +72,8 @@ TEST_CASE("Turn ordering: Higher priority goes before high priority", "[Battling
|
||||
|
||||
TEST_CASE("Turn ordering: High priority goes before low priority", "[Battling]") {
|
||||
auto l = TestLibrary::Get()->GetAttackLibrary();
|
||||
auto a1 = new LearnedAttack(l->GetAttack("lowPriority"), AttackLearnMethod::Unknown);
|
||||
auto a2 = new LearnedAttack(l->GetAttack("higherPriority"), AttackLearnMethod::Unknown);
|
||||
auto a1 = new LearnedAttack(l->Get("lowPriority"), AttackLearnMethod::Unknown);
|
||||
auto a2 = new LearnedAttack(l->Get("higherPriority"), AttackLearnMethod::Unknown);
|
||||
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
|
||||
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
|
||||
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
|
||||
@@ -94,8 +94,8 @@ TEST_CASE("Turn ordering: High priority goes before low priority", "[Battling]")
|
||||
|
||||
TEST_CASE("Turn ordering: No priority goes before low priority", "[Battling]") {
|
||||
auto l = TestLibrary::Get()->GetAttackLibrary();
|
||||
auto a1 = new LearnedAttack(l->GetAttack("lowPriority"), AttackLearnMethod::Unknown);
|
||||
auto a2 = new LearnedAttack(l->GetAttack("standard"), AttackLearnMethod::Unknown);
|
||||
auto a1 = new LearnedAttack(l->Get("lowPriority"), AttackLearnMethod::Unknown);
|
||||
auto a2 = new LearnedAttack(l->Get("standard"), AttackLearnMethod::Unknown);
|
||||
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
|
||||
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
|
||||
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
|
||||
|
||||
@@ -22,25 +22,25 @@ BattleLibrary* TestLibrary::Get() {
|
||||
|
||||
SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
|
||||
auto l = new SpeciesLibrary();
|
||||
l->LoadSpecies("testSpecies1",
|
||||
new CreatureSpecies(
|
||||
0, "testSpecies1",
|
||||
new SpeciesVariant("default", 1, 1, 10, {0, 1}, StatisticSet<uint16_t>(10, 10, 10, 10, 10, 10),
|
||||
{"testTalent"}, {"testSecretTalent"}, new LearnableAttacks(100)),
|
||||
0.5f, "testGrowthRate", 5));
|
||||
l->Insert("testSpecies1",
|
||||
new CreatureSpecies(0, "testSpecies1",
|
||||
new SpeciesVariant("default", 1, 1, 10, {0, 1},
|
||||
StatisticSet<uint16_t>(10, 10, 10, 10, 10, 10), {"testTalent"},
|
||||
{"testSecretTalent"}, new LearnableAttacks(100)),
|
||||
0.5f, "testGrowthRate", 5));
|
||||
return l;
|
||||
}
|
||||
|
||||
AttackLibrary* TestLibrary::BuildAttackLibrary() {
|
||||
auto l = new AttackLibrary();
|
||||
l->LoadAttack("standard", new AttackData("standard", 0, AttackCategory::Physical, 20, 100, 30,
|
||||
AttackTarget::AdjacentOpponent, 0, {}));
|
||||
l->LoadAttack("highPriority", new AttackData("highPriority", 0, AttackCategory::Physical, 20, 100, 30,
|
||||
AttackTarget::AdjacentOpponent, 1, {}));
|
||||
l->LoadAttack("higherPriority", new AttackData("higherPriority", 0, AttackCategory::Physical, 20, 100, 30,
|
||||
AttackTarget::AdjacentOpponent, 2, {}));
|
||||
l->LoadAttack("lowPriority", new AttackData("lowPriority", 0, AttackCategory::Physical, 20, 100, 30,
|
||||
AttackTarget::AdjacentOpponent, -1, {}));
|
||||
l->Insert("standard", new AttackData("standard", 0, AttackCategory::Physical, 20, 100, 30,
|
||||
AttackTarget::AdjacentOpponent, 0, {}));
|
||||
l->Insert("highPriority", new AttackData("highPriority", 0, AttackCategory::Physical, 20, 100, 30,
|
||||
AttackTarget::AdjacentOpponent, 1, {}));
|
||||
l->Insert("higherPriority", new AttackData("higherPriority", 0, AttackCategory::Physical, 20, 100, 30,
|
||||
AttackTarget::AdjacentOpponent, 2, {}));
|
||||
l->Insert("lowPriority", new AttackData("lowPriority", 0, AttackCategory::Physical, 20, 100, 30,
|
||||
AttackTarget::AdjacentOpponent, -1, {}));
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user