Updates needed for breaking change in how abilities work.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-11-15 12:47:02 +01:00
parent 46538092bf
commit 545e321018
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
14 changed files with 71 additions and 221 deletions

View File

@ -3,27 +3,27 @@
#include "../Core.hpp"
using namespace PkmnLib::Library;
export PokemonForme* PkmnLib_PokemonForme_Construct(const char* name, float height, float weight,
uint32_t baseExperience, uint8_t types[], size_t typeLength,
uint16_t baseHealth, uint16_t baseAttack, uint16_t baseDefense,
uint16_t baseMagicalAttack, uint16_t baseMagicalDefense,
uint16_t baseSpeed, const char* talents[], size_t talentsLength,
const char* secretTalents[], size_t secretTalentsLength,
const LearnableMoves* attacks, const char* flags[],
size_t flagsCount) {
export PokemonForme*
PkmnLib_PokemonForme_Construct(const char* name, float height, float weight, uint32_t baseExperience, uint8_t types[],
size_t typeLength, uint16_t baseHealth, uint16_t baseAttack, uint16_t baseDefense,
uint16_t baseMagicalAttack, uint16_t baseMagicalDefense, uint16_t baseSpeed,
const CreatureLib::Library::Talent* talents[], size_t talentsLength,
const CreatureLib::Library::Talent* secretTalents[], size_t secretTalentsLength,
const LearnableMoves* attacks, const char* flags[], size_t flagsCount) {
std::unordered_set<uint32_t> conversedFlags(flagsCount);
for (size_t i = 0; i < flagsCount; i++) {
conversedFlags.insert(ArbUt::StringView::CalculateHash(flags[i]));
}
auto talentsWrapped = ArbUt::List<ArbUt::StringView>(talentsLength);
auto talentsWrapped = ArbUt::List<ArbUt::BorrowedPtr<const CreatureLib::Library::Talent>>(talentsLength);
for (size_t i = 0; i < talentsLength; i++) {
talentsWrapped.Append(ArbUt::StringView(talents[i]));
talentsWrapped.Append(talents[i]);
}
auto secretTalentsWrapped = ArbUt::List<ArbUt::StringView>(secretTalentsLength);
auto secretTalentsWrapped =
ArbUt::List<ArbUt::BorrowedPtr<const CreatureLib::Library::Talent>>(secretTalentsLength);
for (size_t i = 0; i < secretTalentsLength; i++) {
secretTalentsWrapped.Append(ArbUt::StringView(secretTalents[i]));
secretTalentsWrapped.Append(secretTalents[i]);
}
return new PokemonForme(ArbUt::StringView(name), height, weight, baseExperience,

View File

@ -6,8 +6,9 @@ export uint8_t PkmnLib_PokemonLibrary_Construct(PokemonLibrary*& out, PkmnLib::L
SpeciesLibrary* species, MoveLibrary* moves, ItemLibrary* items,
CreatureLib::Library::GrowthRateLibrary* growthRates,
CreatureLib::Library::TypeLibrary* typeLibrary,
CreatureLib::Library::TalentLibrary* talentLibrary,
NatureLibrary* natures) {
Try(out = new PokemonLibrary(settings, species, moves, items, growthRates, typeLibrary, natures));
Try(out = new PokemonLibrary(settings, species, moves, items, growthRates, typeLibrary, talentLibrary, natures));
}
export void PkmnLib_PokemonLibrary_Destruct(const PokemonLibrary* p) { delete p; }

View File

@ -56,7 +56,7 @@ CreatureLib::Battling::Creature* PkmnLib::Battling::Pokemon::Clone() const {
c->_activeTalent = std::unique_ptr<PkmnScript::BattleScript>(_activeTalent->Clone(c));
}
c->_hasOverridenTalent = _hasOverridenTalent;
c->_overridenTalentName = _overridenTalentName;
c->_overridenTalent = _overridenTalent;
if (_status != nullptr) {
c->_status = std::unique_ptr<PkmnScript::BattleScript>(_status->Clone(c));
}

View File

@ -18,8 +18,10 @@ namespace PkmnLib::Library {
PokemonLibrary(PkmnLib::Library::LibrarySettings* settings, SpeciesLibrary* species, MoveLibrary* moves,
ItemLibrary* items, CreatureLib::Library::GrowthRateLibrary* growthRates,
CreatureLib::Library::TypeLibrary* typeLibrary, NatureLibrary* natures)
: DataLibrary(settings, species, moves, items, growthRates, typeLibrary), _natures(natures) {}
CreatureLib::Library::TypeLibrary* typeLibrary,
CreatureLib::Library::TalentLibrary* talentLibrary, NatureLibrary* natures)
: DataLibrary(settings, species, moves, items, growthRates, typeLibrary, talentLibrary), _natures(natures) {
}
const std::unique_ptr<const PkmnLib::Library::LibrarySettings>& GetSettings() const {
return (const std::unique_ptr<const LibrarySettings>&)CreatureLib::Library::DataLibrary::GetSettings();

View File

@ -1,9 +1,12 @@
#include "PokemonForme.hpp"
using namespace CreatureLib::Library;
PkmnLib::Library::PokemonForme::PokemonForme(const ArbUt::StringView& name, float height, float weight,
uint32_t baseExperience, const ArbUt::List<uint8_t>& types,
CreatureLib::Library::StatisticSet<uint16_t> baseStats,
const ArbUt::List<ArbUt::StringView>& talents,
const ArbUt::List<ArbUt::StringView>& secretTalents,
StatisticSet<uint16_t> baseStats,
const ArbUt::List<ArbUt::BorrowedPtr<const Talent>>& talents,
const ArbUt::List<ArbUt::BorrowedPtr<const Talent>>& secretTalents,
const LearnableMoves* moves, std::unordered_set<uint32_t> flags)
: SpeciesVariant(name, height, weight, baseExperience, types, baseStats, talents, secretTalents, moves,
std::move(flags)) {}

View File

@ -9,12 +9,14 @@ namespace PkmnLib::Library {
public:
PokemonForme(const ArbUt::StringView& name, float height, float weight, uint32_t baseExperience,
const ArbUt::List<uint8_t>& types, CreatureLib::Library::StatisticSet<uint16_t> baseStats,
const ArbUt::List<ArbUt::StringView>& talents, const ArbUt::List<ArbUt::StringView>& secretTalents,
const ArbUt::List<ArbUt::BorrowedPtr<const CreatureLib::Library::Talent>>& talents,
const ArbUt::List<ArbUt::BorrowedPtr<const CreatureLib::Library::Talent>>& secretTalents,
const LearnableMoves* moves, std::unordered_set<uint32_t> flags = {});
private:
public:
inline const ArbUt::StringView& GetAbility(const CreatureLib::Library::TalentIndex& index) const {
inline const ArbUt::BorrowedPtr<const CreatureLib::Library::Talent>&
GetAbility(const CreatureLib::Library::TalentIndex& index) const {
return GetTalent(index);
}
};

View File

@ -66,6 +66,10 @@ static std::string NicknameWrapper(const PkmnLib::Battling::Pokemon* obj) {
return std::string(obj->GetNickname().value());
}
static const ArbUt::StringView& GetActiveAbilityWrapper(PkmnLib::Battling::Pokemon* p) {
return p->GetActiveTalent()->GetName();
}
static CScriptHandle AddVolatileWrapper(PkmnLib::Battling::Pokemon* obj, const ArbUt::StringView& name) {
auto handle = CScriptHandle();
auto* resolver = static_cast<AngelScriptResolver*>(obj->GetLibrary()->GetScriptResolver().get());
@ -90,8 +94,6 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
GetHeldItem);
REGISTER_GETTER("Pokemon", "uint32 get_CurrentHealth() const property", CreatureLib::Battling::Creature,
GetCurrentHealth);
REGISTER_GETTER("Pokemon", "const constString& get_ActiveAbility() const property", CreatureLib::Battling::Creature,
GetActiveTalent);
REGISTER_GETTER("Pokemon", "bool get_IsFainted() const property", CreatureLib::Battling::Creature, IsFainted);
REGISTER_GETTER("Pokemon", "uint32 get_MaxHealth() const property", CreatureLib::Battling::Creature, GetMaxHealth);
REGISTER_GETTER("Pokemon", "const Species@ get_DisplaySpecies() const property", CreatureLib::Battling::Creature,
@ -111,6 +113,10 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
auto r = engine->RegisterObjectMethod("Pokemon", "void set_Weight(float value) property",
asMETHOD(PkmnLib::Battling::Pokemon, SetWeight), asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "const constString& get_ActiveAbility() const property",
asFUNCTION(GetActiveAbilityWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "void set_Height(float value) property",
asMETHOD(PkmnLib::Battling::Pokemon, SetHeight), asCALL_THISCALL);
Ensure(r >= 0);

View File

@ -63,7 +63,7 @@ void RegisterSpeciesTypes::RegisterSpeciesType(asIScriptEngine* engine) {
}
const ArbUt::StringView& GetAbility(PkmnLib::Library::PokemonForme* p, bool hidden, uint8_t index) {
return p->GetAbility(CreatureLib::Library::TalentIndex(hidden, index));
return p->GetAbility(CreatureLib::Library::TalentIndex(hidden, index))->GetName();
}
void RegisterSpeciesTypes::RegisterFormeType(asIScriptEngine* engine) {

View File

@ -8,32 +8,4 @@ TEST_CASE("Able to build and destroy empty library") {
delete lib;
}
TEST_CASE("Able to build, destroy and insert library") {
auto lib = new PkmnLib::Library::SpeciesLibrary();
lib->Insert("foo"_cnc.GetHash(),
new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme(
"default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
{"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
delete lib;
}
TEST_CASE("Able to insert and retrieve from library") {
auto lib = new PkmnLib::Library::SpeciesLibrary();
lib->Insert("foo"_cnc.GetHash(),
new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme(
"default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
{"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
auto val = lib->Get("foo"_cnc);
REQUIRE(val->GetName() == "foo");
delete lib;
}
#endif

View File

@ -2,156 +2,6 @@
#include "../../extern/doctest.hpp"
#include "../../src/Library/Species/PokemonSpecies.hpp"
TEST_CASE("Able to create and destroy species") {
auto species = new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
delete species;
}
TEST_CASE("Able to get default forme") {
auto species = new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
[[maybe_unused]] auto forme = species->GetDefaultForme();
delete species;
}
TEST_CASE("Able to get default forme name") {
auto species = new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
auto forme = species->GetDefaultForme();
REQUIRE(forme->GetName() == "default");
delete species;
}
TEST_CASE("Able to get species name") {
auto species = new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
REQUIRE(species->GetName() == "foo");
delete species;
}
TEST_CASE("Able to get species id") {
auto species = new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
REQUIRE(species->GetId() == 1);
delete species;
}
TEST_CASE("Able to get species gender ratio") {
auto species = new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
REQUIRE(species->GetGenderRate() == 0.5f);
delete species;
}
TEST_CASE("Able to get species growth rate") {
auto species = new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
REQUIRE(species->GetGrowthRate() == "testGrowthRate");
delete species;
}
TEST_CASE("Able to get species capture rate") {
auto species = new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
REQUIRE(species->GetCaptureRate() == 100);
delete species;
}
TEST_CASE("Able to get species base happiness") {
auto species = new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
REQUIRE(species->GetBaseHappiness() == 100);
delete species;
}
TEST_CASE("Able to set and get evolution") {
auto species = new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
auto species2 = new PkmnLib::Library::PokemonSpecies(
2, "bar"_cnc,
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
species->AddEvolution(PkmnLib::Library::EvolutionData::CreateLevelEvolution(16, species2));
auto& evolutions = species->GetEvolutions();
REQUIRE(evolutions.Count() == 1);
auto evo = evolutions[0];
CHECK(evo->GetMethod() == PkmnLib::Library::EvolutionMethod::Level);
CHECK(evo->GetNewSpecies() == species2);
INFO(CreatureLib::Library::EffectParameterTypeHelper::ToString(evo->GetDataAt(0)->GetType()));
CHECK(evo->GetDataAt(0)->AsInt() == 16);
delete species;
delete species2;
}
#endif

View File

@ -214,7 +214,7 @@ TEST_CASE("Validate Pokemon Active Ability in Script") {
.WithGender(CreatureLib::Library::Gender::Male)
.Build();
data.Context->SetArgObject(0, (void*)mon);
auto name = mon->GetActiveTalent();
auto name = mon->GetActiveTalent()->GetName();
data.Context->SetArgAddress(1, &name);
REQUIRE(data.Context->Execute() == asEXECUTION_FINISHED);

View File

@ -167,7 +167,7 @@ TEST_CASE("Validate Forme GetAbility in Script") {
auto data = GetScript(mainLib, "testGetAbility"_cnc);
auto forme = mainLib->GetSpeciesLibrary()->Get("testSpecies2"_cnc)->GetDefaultForme();
data.Context->SetArgObject(0, (void*)forme.GetRaw());
auto ability = forme->GetAbility(CreatureLib::Library::TalentIndex(false, 0));
auto ability = forme->GetAbility(CreatureLib::Library::TalentIndex(false, 0))->GetName();
data.Context->SetArgAddress(1, &ability);
REQUIRE(data.Context->Execute() == asEXECUTION_FINISHED);
REQUIRE((bool)data.Context->GetReturnWord());

View File

@ -2,39 +2,43 @@
#include <Arbutils/StringView.hpp>
PkmnLib::Battling::BattleLibrary* TestLibrary::_library = nullptr;
PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary(CreatureLib::Library::TalentLibrary* talentLibrary) {
auto lib = new PkmnLib::Library::SpeciesLibrary();
lib->Insert("testSpecies"_cnc.GetHash(),
new PkmnLib::Library::PokemonSpecies(
1, "testSpecies"_cnc,
new PkmnLib::Library::PokemonForme(
"default"_cnc, 1.0f, 1.0f, 236, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
{"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{talentLibrary->Get("testAbility"_cnc)}, {talentLibrary->Get("testHiddenAbility"_cnc)},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
lib->Insert("testSpecies2"_cnc.GetHash(),
new PkmnLib::Library::PokemonSpecies(
2, "testSpecies2"_cnc,
new PkmnLib::Library::PokemonForme(
"default"_cnc, 1.0f, 1.0f, 306, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
{"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{talentLibrary->Get("testAbility"_cnc)}, {talentLibrary->Get("testHiddenAbility"_cnc)},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
lib->Insert("statTestSpecies1"_cnc.GetHash(),
new PkmnLib::Library::PokemonSpecies(
3, "statTestSpecies1"_cnc,
new PkmnLib::Library::PokemonForme(
"default"_cnc, 1.0f, 1.0f, 236, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
{"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{talentLibrary->Get("testAbility"_cnc)}, {talentLibrary->Get("testHiddenAbility"_cnc)},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
lib->Insert("testSpecies3"_cnc.GetHash(),
new PkmnLib::Library::PokemonSpecies(
4, "testSpecies3"_cnc,
new PkmnLib::Library::PokemonForme(
"default"_cnc, 1.0f, 1.0f, 236, {0, 4},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
{"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
{talentLibrary->Get("testAbility"_cnc)}, {talentLibrary->Get("testHiddenAbility"_cnc)},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
lib->Insert("testCharizard"_cnc.GetHash(),
@ -42,16 +46,18 @@ PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() {
5, "testCharizard"_cnc,
new PkmnLib::Library::PokemonForme(
"default"_cnc, 1.7f, 90.5f, 240, {0, 4},
CreatureLib::Library::StatisticSet<uint16_t>(78, 84, 78, 109, 85, 100), {"testAbility"_cnc},
{"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
CreatureLib::Library::StatisticSet<uint16_t>(78, 84, 78, 109, 85, 100),
{talentLibrary->Get("testAbility"_cnc)}, {talentLibrary->Get("testHiddenAbility"_cnc)},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
lib->Insert("testVenusaur"_cnc.GetHash(),
new PkmnLib::Library::PokemonSpecies(
6, "testVenusaur"_cnc,
new PkmnLib::Library::PokemonForme(
"default"_cnc, 2.0f, 100.0f, 236, {0, 4},
CreatureLib::Library::StatisticSet<uint16_t>(80, 82, 83, 100, 100, 80), {"testAbility"_cnc},
{"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
CreatureLib::Library::StatisticSet<uint16_t>(80, 82, 83, 100, 100, 80),
{talentLibrary->Get("testAbility"_cnc)}, {talentLibrary->Get("testHiddenAbility"_cnc)},
new PkmnLib::Library::LearnableMoves(100)),
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
return lib;

View File

@ -33,12 +33,13 @@ public:
}
static PkmnLib::Library::PokemonLibrary* BuildStaticLibrary() {
return new PkmnLib::Library::PokemonLibrary(new PkmnLib::Library::LibrarySettings(100, 4, 4096),
BuildSpeciesLibrary(), BuildMoveLibrary(), BuildItemLibrary(),
BuildGrowthRateLibrary(), BuildTypeLibrary(), BuildNatureLibrary());
auto talentLibrary = BuildTalentLibrary();
return new PkmnLib::Library::PokemonLibrary(
new PkmnLib::Library::LibrarySettings(100, 4, 4096), BuildSpeciesLibrary(talentLibrary), BuildMoveLibrary(),
BuildItemLibrary(), BuildGrowthRateLibrary(), BuildTypeLibrary(), talentLibrary, BuildNatureLibrary());
}
static PkmnLib::Library::SpeciesLibrary* BuildSpeciesLibrary();
static PkmnLib::Library::SpeciesLibrary* BuildSpeciesLibrary(CreatureLib::Library::TalentLibrary*);
static PkmnLib::Library::MoveLibrary* BuildMoveLibrary();
@ -66,6 +67,13 @@ public:
return lib;
}
static CreatureLib::Library::TalentLibrary* BuildTalentLibrary() {
auto lib = new CreatureLib::Library::TalentLibrary();
lib->Insert("testAbility", new CreatureLib::Library::Talent("testAbility", "", {}));
lib->Insert("testHiddenAbility", new CreatureLib::Library::Talent("testHiddenAbility", "", {}));
return lib;
}
static PkmnLib::Library::NatureLibrary* BuildNatureLibrary() {
auto lib = new PkmnLib::Library::NatureLibrary();
lib->LoadNature("neutralNature"_cnc,