Updates needed for breaking change in how abilities work.
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:
@@ -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
|
||||
@@ -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
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user