Updates needed for breaking change in how abilities work.
All checks were successful
continuous-integration/drone/push Build is passing

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

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