Update to new version of Arbutils.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
70fc8d2d5f
commit
88eda6ef94
|
@ -1,11 +1,13 @@
|
||||||
#ifndef CREATURELIB_SCRIPT_HPP
|
#ifndef CREATURELIB_SCRIPT_HPP
|
||||||
#define CREATURELIB_SCRIPT_HPP
|
#define CREATURELIB_SCRIPT_HPP
|
||||||
|
|
||||||
|
#include <Arbutils/ConstString.hpp>
|
||||||
#include <any>
|
#include <any>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../../Library/CreatureData/CreatureSpecies.hpp"
|
|
||||||
|
using ConstString = Arbutils::CaseInsensitiveConstString;
|
||||||
|
|
||||||
namespace CreatureLib::Battling {
|
namespace CreatureLib::Battling {
|
||||||
class BaseTurnChoice;
|
class BaseTurnChoice;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#ifndef CREATURELIB_SCRIPTSET_HPP
|
#ifndef CREATURELIB_SCRIPTSET_HPP
|
||||||
#define CREATURELIB_SCRIPTSET_HPP
|
#define CREATURELIB_SCRIPTSET_HPP
|
||||||
|
|
||||||
|
#include <Arbutils/Collections/Dictionary.hpp>
|
||||||
|
#include <Arbutils/Collections/List.hpp>
|
||||||
#include <any>
|
#include <any>
|
||||||
#include <unordered_map>
|
|
||||||
#include "Script.hpp"
|
#include "Script.hpp"
|
||||||
|
|
||||||
namespace CreatureLib::Battling {
|
namespace CreatureLib::Battling {
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace CreatureLib::Library {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
constexpr SecondaryEffect() noexcept : _chance(0), _effectName(""_cnc) {}
|
constexpr SecondaryEffect() noexcept : _chance(0), _effectName(""_cnc) {}
|
||||||
constexpr SecondaryEffect(float chance, const Arbutils::CaseInsensitiveConstString& effectName) noexcept
|
SecondaryEffect(float chance, const Arbutils::CaseInsensitiveConstString& effectName) noexcept
|
||||||
: _chance(chance), _effectName(effectName) {}
|
: _chance(chance), _effectName(effectName) {}
|
||||||
|
|
||||||
constexpr float GetChance() const noexcept { return _chance; }
|
constexpr float GetChance() const noexcept { return _chance; }
|
||||||
|
|
|
@ -64,7 +64,7 @@ TEST_CASE("Add script to script set, then remove it", "[Battling, Scripting]") {
|
||||||
auto s = new TestScript("foobar");
|
auto s = new TestScript("foobar");
|
||||||
set.Add(s);
|
set.Add(s);
|
||||||
REQUIRE(set.Count() == 1);
|
REQUIRE(set.Count() == 1);
|
||||||
set.Remove("foobar"_cnc);
|
set.Remove("foobar"_cnc.GetHash());
|
||||||
REQUIRE(set.Count() == 0);
|
REQUIRE(set.Count() == 0);
|
||||||
auto it = set.GetIterator();
|
auto it = set.GetIterator();
|
||||||
REQUIRE(it->Count() == 0);
|
REQUIRE(it->Count() == 0);
|
||||||
|
@ -77,7 +77,7 @@ TEST_CASE("Add two scripts to script set, then remove them", "[Battling, Scripti
|
||||||
set.Add(s);
|
set.Add(s);
|
||||||
set.Add(s2);
|
set.Add(s2);
|
||||||
REQUIRE(set.Count() == 2);
|
REQUIRE(set.Count() == 2);
|
||||||
set.Remove("foobar"_cnc);
|
set.Remove("foobar"_cnc.GetHash());
|
||||||
REQUIRE(set.Count() == 1);
|
REQUIRE(set.Count() == 1);
|
||||||
auto it = set.GetIterator();
|
auto it = set.GetIterator();
|
||||||
REQUIRE(it->At(0)->GetName() == "foobar2");
|
REQUIRE(it->At(0)->GetName() == "foobar2");
|
||||||
|
|
|
@ -11,7 +11,8 @@ using namespace CreatureLib::Battling;
|
||||||
|
|
||||||
TEST_CASE("Turn ordering: Attack before pass", "[Battling]") {
|
TEST_CASE("Turn ordering: Attack before pass", "[Battling]") {
|
||||||
auto lib = TestLibrary::Get();
|
auto lib = TestLibrary::Get();
|
||||||
auto learnedAttack = LearnedAttack(lib->GetAttackLibrary()->Get("standard"_cnc), AttackLearnMethod::Unknown);
|
auto learnedAttack =
|
||||||
|
LearnedAttack(lib->GetAttackLibrary()->Get("standard"_cnc.GetHash()), AttackLearnMethod::Unknown);
|
||||||
auto choice1 = new PassTurnChoice(nullptr);
|
auto choice1 = new PassTurnChoice(nullptr);
|
||||||
auto choice2 = new AttackTurnChoice(nullptr, &learnedAttack, CreatureIndex(0, 0));
|
auto choice2 = new AttackTurnChoice(nullptr, &learnedAttack, CreatureIndex(0, 0));
|
||||||
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
|
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
|
||||||
|
@ -30,8 +31,8 @@ TEST_CASE("Turn ordering: Attack before pass", "[Battling]") {
|
||||||
|
|
||||||
TEST_CASE("Turn ordering: High priority goes before no priority", "[Battling]") {
|
TEST_CASE("Turn ordering: High priority goes before no priority", "[Battling]") {
|
||||||
auto l = TestLibrary::Get()->GetAttackLibrary();
|
auto l = TestLibrary::Get()->GetAttackLibrary();
|
||||||
auto a1 = new LearnedAttack(l->Get("standard"_cnc), AttackLearnMethod::Unknown);
|
auto a1 = new LearnedAttack(l->Get("standard"_cnc.GetHash()), AttackLearnMethod::Unknown);
|
||||||
auto a2 = new LearnedAttack(l->Get("highPriority"_cnc), AttackLearnMethod::Unknown);
|
auto a2 = new LearnedAttack(l->Get("highPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
|
||||||
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
|
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
|
||||||
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
|
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
|
||||||
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
|
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
|
||||||
|
@ -52,8 +53,8 @@ TEST_CASE("Turn ordering: High priority goes before no priority", "[Battling]")
|
||||||
|
|
||||||
TEST_CASE("Turn ordering: Higher priority goes before high priority", "[Battling]") {
|
TEST_CASE("Turn ordering: Higher priority goes before high priority", "[Battling]") {
|
||||||
auto l = TestLibrary::Get()->GetAttackLibrary();
|
auto l = TestLibrary::Get()->GetAttackLibrary();
|
||||||
auto a1 = new LearnedAttack(l->Get("highPriority"_cnc), AttackLearnMethod::Unknown);
|
auto a1 = new LearnedAttack(l->Get("highPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
|
||||||
auto a2 = new LearnedAttack(l->Get("higherPriority"_cnc), AttackLearnMethod::Unknown);
|
auto a2 = new LearnedAttack(l->Get("higherPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
|
||||||
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
|
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
|
||||||
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
|
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
|
||||||
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
|
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
|
||||||
|
@ -74,8 +75,8 @@ TEST_CASE("Turn ordering: Higher priority goes before high priority", "[Battling
|
||||||
|
|
||||||
TEST_CASE("Turn ordering: High priority goes before low priority", "[Battling]") {
|
TEST_CASE("Turn ordering: High priority goes before low priority", "[Battling]") {
|
||||||
auto l = TestLibrary::Get()->GetAttackLibrary();
|
auto l = TestLibrary::Get()->GetAttackLibrary();
|
||||||
auto a1 = new LearnedAttack(l->Get("lowPriority"_cnc), AttackLearnMethod::Unknown);
|
auto a1 = new LearnedAttack(l->Get("lowPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
|
||||||
auto a2 = new LearnedAttack(l->Get("higherPriority"_cnc), AttackLearnMethod::Unknown);
|
auto a2 = new LearnedAttack(l->Get("higherPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
|
||||||
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
|
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
|
||||||
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
|
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
|
||||||
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
|
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
|
||||||
|
@ -96,8 +97,8 @@ TEST_CASE("Turn ordering: High priority goes before low priority", "[Battling]")
|
||||||
|
|
||||||
TEST_CASE("Turn ordering: No priority goes before low priority", "[Battling]") {
|
TEST_CASE("Turn ordering: No priority goes before low priority", "[Battling]") {
|
||||||
auto l = TestLibrary::Get()->GetAttackLibrary();
|
auto l = TestLibrary::Get()->GetAttackLibrary();
|
||||||
auto a1 = new LearnedAttack(l->Get("lowPriority"_cnc), AttackLearnMethod::Unknown);
|
auto a1 = new LearnedAttack(l->Get("lowPriority"_cnc.GetHash()), AttackLearnMethod::Unknown);
|
||||||
auto a2 = new LearnedAttack(l->Get("standard"_cnc), AttackLearnMethod::Unknown);
|
auto a2 = new LearnedAttack(l->Get("standard"_cnc.GetHash()), AttackLearnMethod::Unknown);
|
||||||
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
|
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
|
||||||
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
|
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
|
||||||
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
|
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
|
||||||
|
|
|
@ -21,7 +21,7 @@ BattleLibrary* TestLibrary::Get() {
|
||||||
|
|
||||||
SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
|
SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
|
||||||
auto l = new SpeciesLibrary();
|
auto l = new SpeciesLibrary();
|
||||||
l->Insert("testSpecies1"_cnc,
|
l->Insert("testSpecies1"_cnc.GetHash(),
|
||||||
new CreatureSpecies(0, "testSpecies1"_cnc,
|
new CreatureSpecies(0, "testSpecies1"_cnc,
|
||||||
new SpeciesVariant("default"_cnc, 1, 1, 10, {0, 1},
|
new SpeciesVariant("default"_cnc, 1, 1, 10, {0, 1},
|
||||||
StatisticSet<uint16_t>(10, 10, 10, 10, 10, 10), {"testTalent"_cnc},
|
StatisticSet<uint16_t>(10, 10, 10, 10, 10, 10), {"testTalent"_cnc},
|
||||||
|
@ -32,14 +32,15 @@ SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
|
||||||
|
|
||||||
AttackLibrary* TestLibrary::BuildAttackLibrary() {
|
AttackLibrary* TestLibrary::BuildAttackLibrary() {
|
||||||
auto l = new AttackLibrary();
|
auto l = new AttackLibrary();
|
||||||
l->Insert("standard"_cnc, new AttackData("standard"_cnc, 0, AttackCategory::Physical, 20, 100, 30,
|
l->Insert("standard"_cnc.GetHash(), new AttackData("standard"_cnc, 0, AttackCategory::Physical, 20, 100, 30,
|
||||||
AttackTarget::AdjacentOpponent, 0, SecondaryEffect(), {}));
|
AttackTarget::AdjacentOpponent, 0, SecondaryEffect(), {}));
|
||||||
l->Insert("highPriority"_cnc, new AttackData("highPriority"_cnc, 0, AttackCategory::Physical, 20, 100, 30,
|
l->Insert("highPriority"_cnc.GetHash(), new AttackData("highPriority"_cnc, 0, AttackCategory::Physical, 20, 100, 30,
|
||||||
AttackTarget::AdjacentOpponent, 1, SecondaryEffect(), {}));
|
AttackTarget::AdjacentOpponent, 1, SecondaryEffect(), {}));
|
||||||
l->Insert("higherPriority"_cnc, new AttackData("higherPriority"_cnc, 0, AttackCategory::Physical, 20, 100, 30,
|
l->Insert("higherPriority"_cnc.GetHash(),
|
||||||
AttackTarget::AdjacentOpponent, 2, SecondaryEffect(), {}));
|
new AttackData("higherPriority"_cnc, 0, AttackCategory::Physical, 20, 100, 30,
|
||||||
l->Insert("lowPriority"_cnc, new AttackData("lowPriority"_cnc, 0, AttackCategory::Physical, 20, 100, 30,
|
AttackTarget::AdjacentOpponent, 2, SecondaryEffect(), {}));
|
||||||
AttackTarget::AdjacentOpponent, -1, SecondaryEffect(), {}));
|
l->Insert("lowPriority"_cnc.GetHash(), new AttackData("lowPriority"_cnc, 0, AttackCategory::Physical, 20, 100, 30,
|
||||||
|
AttackTarget::AdjacentOpponent, -1, SecondaryEffect(), {}));
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ ItemLibrary* TestLibrary::BuildItemLibrary() {
|
||||||
GrowthRateLibrary* TestLibrary::BuildGrowthRateLibrary() {
|
GrowthRateLibrary* TestLibrary::BuildGrowthRateLibrary() {
|
||||||
auto l = new GrowthRateLibrary();
|
auto l = new GrowthRateLibrary();
|
||||||
l->AddGrowthRate(
|
l->AddGrowthRate(
|
||||||
"testGrowthRate"_cnc,
|
"testGrowthRate"_cnc.GetHash(),
|
||||||
new LookupGrowthRate(
|
new LookupGrowthRate(
|
||||||
{0, 15, 52, 122, 237, 406, 637, 942, 1326, 1800, 2369, 3041, 3822,
|
{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,
|
4719, 5737, 6881, 8155, 9564, 11111, 12800, 14632, 16610, 18737, 21012, 23437, 26012,
|
||||||
|
@ -66,9 +67,9 @@ GrowthRateLibrary* TestLibrary::BuildGrowthRateLibrary() {
|
||||||
|
|
||||||
TypeLibrary* TestLibrary::BuildTypeLibrary() {
|
TypeLibrary* TestLibrary::BuildTypeLibrary() {
|
||||||
auto l = new TypeLibrary();
|
auto l = new TypeLibrary();
|
||||||
l->RegisterType("testType1"_cnc);
|
l->RegisterType("testType1"_cnc.GetHash());
|
||||||
l->RegisterType("testType2"_cnc);
|
l->RegisterType("testType2"_cnc.GetHash());
|
||||||
l->RegisterType("testType3"_cnc);
|
l->RegisterType("testType3"_cnc.GetHash());
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue