diff --git a/CInterface/Library/PokemonSpecies.cpp b/CInterface/Library/PokemonSpecies.cpp index d493596..6f95d33 100644 --- a/CInterface/Library/PokemonSpecies.cpp +++ b/CInterface/Library/PokemonSpecies.cpp @@ -4,12 +4,10 @@ using namespace PkmnLib::Library; export uint8_t PkmnLib_PokemonSpecies_Construct(const PokemonSpecies*& out, uint16_t id, const char* name, const PokemonForme* defaultForme, float genderRatio, - const char* growthRate, uint8_t captureRate, uint8_t baseHappiness, - uint16_t experienceGain) { + const char* growthRate, uint8_t captureRate, uint8_t baseHappiness) { Try(auto cName = Arbutils::CaseInsensitiveConstString(name); auto cGrowthRate = Arbutils::CaseInsensitiveConstString(growthRate); - out = new PokemonSpecies(id, cName, defaultForme, genderRatio, cGrowthRate, captureRate, baseHappiness, - experienceGain);) + out = new PokemonSpecies(id, cName, defaultForme, genderRatio, cGrowthRate, captureRate, baseHappiness);) } export void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { delete p; } diff --git a/src/Battling/Library/ExperienceLibrary.cpp b/src/Battling/Library/ExperienceLibrary.cpp index 6421698..bdddf98 100644 --- a/src/Battling/Library/ExperienceLibrary.cpp +++ b/src/Battling/Library/ExperienceLibrary.cpp @@ -7,7 +7,7 @@ void PkmnLib::Battling::ExperienceLibrary::HandleExperienceGain( const std::unordered_set& opponents) const { auto fainted = dynamic_cast(faintedMon); - auto expGain = fainted->GetPokemonSpecies()->GetExperienceGains(); + auto expGain = fainted->GetForme()->GetBaseExperience(); auto level = fainted->GetLevel(); // TODO exp share diff --git a/src/Library/Species/PokemonForme.hpp b/src/Library/Species/PokemonForme.hpp index e912ae1..3deb17d 100644 --- a/src/Library/Species/PokemonForme.hpp +++ b/src/Library/Species/PokemonForme.hpp @@ -2,6 +2,7 @@ #define PKMNLIB_POKEMONFORME_HPP #include +#include namespace PkmnLib::Library { class PokemonForme : public CreatureLib::Library::SpeciesVariant { diff --git a/src/Library/Species/PokemonSpecies.hpp b/src/Library/Species/PokemonSpecies.hpp index 4a65f35..c36cc17 100644 --- a/src/Library/Species/PokemonSpecies.hpp +++ b/src/Library/Species/PokemonSpecies.hpp @@ -9,14 +9,13 @@ namespace PkmnLib::Library { private: uint8_t _baseHappiness; Arbutils::Collections::List _evolutions; - uint16_t _experienceGain; public: PokemonSpecies(uint16_t id, const Arbutils::CaseInsensitiveConstString& name, const PokemonForme* defaultForme, float genderRatio, const Arbutils::CaseInsensitiveConstString& growthRate, uint8_t captureRate, - uint8_t baseHappiness, uint16_t experienceGain) noexcept + uint8_t baseHappiness) noexcept : CreatureSpecies(id, name, defaultForme, genderRatio, growthRate, captureRate), - _baseHappiness(baseHappiness), _experienceGain(experienceGain) {} + _baseHappiness(baseHappiness) {} ~PokemonSpecies() override { for (auto evo : _evolutions) { @@ -42,8 +41,6 @@ namespace PkmnLib::Library { inline void AddEvolution(const EvolutionData* data) noexcept { _evolutions.Append(data); } const Arbutils::Collections::List& GetEvolutions() const noexcept { return _evolutions; } - - inline uint16_t GetExperienceGains() const noexcept { return _experienceGain; } }; } diff --git a/tests/LibraryTests/SpeciesLibraryTests.cpp b/tests/LibraryTests/SpeciesLibraryTests.cpp index 58dc112..4048519 100644 --- a/tests/LibraryTests/SpeciesLibraryTests.cpp +++ b/tests/LibraryTests/SpeciesLibraryTests.cpp @@ -17,7 +17,7 @@ TEST_CASE("Able to build, destroy and insert library", "library") { "default"_cnc, 1.0f, 1.0f, 100, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 100)); + 0.5f, "testGrowthRate"_cnc, 100, 100)); delete lib; } @@ -30,7 +30,7 @@ TEST_CASE("Able to insert and retrieve from library", "library") { "default"_cnc, 1.0f, 1.0f, 100, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 100)); + 0.5f, "testGrowthRate"_cnc, 100, 100)); auto val = lib->Get("foo"_cnc); REQUIRE(val->GetName() == "foo"); delete lib; diff --git a/tests/LibraryTests/SpeciesTests.cpp b/tests/LibraryTests/SpeciesTests.cpp index 447613a..7233412 100644 --- a/tests/LibraryTests/SpeciesTests.cpp +++ b/tests/LibraryTests/SpeciesTests.cpp @@ -9,7 +9,7 @@ TEST_CASE("Able to create and destroy species", "library") { CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 100); + 0.5f, "testGrowthRate"_cnc, 100, 100); delete species; } @@ -20,7 +20,7 @@ TEST_CASE("Able to get default forme", "library") { CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 100); + 0.5f, "testGrowthRate"_cnc, 100, 100); auto forme = species->GetDefaultForme(); REQUIRE(forme != nullptr); @@ -35,7 +35,7 @@ TEST_CASE("Able to get default forme name", "library") { CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 100); + 0.5f, "testGrowthRate"_cnc, 100, 100); auto forme = species->GetDefaultForme(); REQUIRE(forme != nullptr); @@ -51,7 +51,7 @@ TEST_CASE("Able to get species name", "library") { CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 100); + 0.5f, "testGrowthRate"_cnc, 100, 100); REQUIRE(species->GetName() == "foo"); @@ -65,7 +65,7 @@ TEST_CASE("Able to get species id", "library") { CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 100); + 0.5f, "testGrowthRate"_cnc, 100, 100); REQUIRE(species->GetId() == 1); @@ -79,7 +79,7 @@ TEST_CASE("Able to get species gender ratio", "library") { CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 100); + 0.5f, "testGrowthRate"_cnc, 100, 100); REQUIRE(species->GetGenderRate() == 0.5f); @@ -93,7 +93,7 @@ TEST_CASE("Able to get species growth rate", "library") { CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 100); + 0.5f, "testGrowthRate"_cnc, 100, 100); REQUIRE(species->GetGrowthRate() == "testGrowthRate"); @@ -107,7 +107,7 @@ TEST_CASE("Able to get species capture rate", "library") { CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 100); + 0.5f, "testGrowthRate"_cnc, 100, 100); REQUIRE(species->GetCaptureRate() == 100); @@ -121,7 +121,7 @@ TEST_CASE("Able to get species base happiness", "library") { CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 100); + 0.5f, "testGrowthRate"_cnc, 100, 100); REQUIRE(species->GetBaseHappiness() == 100); @@ -135,14 +135,14 @@ TEST_CASE("Able to set and get evolution", "library") { CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 100); + 0.5f, "testGrowthRate"_cnc, 100, 100); auto species2 = new PkmnLib::Library::PokemonSpecies( 2, "bar"_cnc, new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 100); + 0.5f, "testGrowthRate"_cnc, 100, 100); species->AddEvolution(PkmnLib::Library::EvolutionData::CreateLevelEvolution(16, species2)); auto evolutions = species->GetEvolutions(); diff --git a/tests/TestLibrary/TestLibrary.cpp b/tests/TestLibrary/TestLibrary.cpp index bc9dd99..4a4e9d7 100644 --- a/tests/TestLibrary/TestLibrary.cpp +++ b/tests/TestLibrary/TestLibrary.cpp @@ -8,34 +8,34 @@ PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() { new PkmnLib::Library::PokemonSpecies( 1, "testSpecies"_cnc, new PkmnLib::Library::PokemonForme( - "default"_cnc, 1.0f, 1.0f, 100, {0}, + "default"_cnc, 1.0f, 1.0f, 236, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 236)); + 0.5f, "testGrowthRate"_cnc, 100, 100)); lib->Insert("testSpecies2"_cnc, new PkmnLib::Library::PokemonSpecies( 2, "testSpecies2"_cnc, new PkmnLib::Library::PokemonForme( - "default"_cnc, 1.0f, 1.0f, 100, {0}, + "default"_cnc, 1.0f, 1.0f, 306, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 306)); + 0.5f, "testGrowthRate"_cnc, 100, 100)); lib->Insert("statTestSpecies1"_cnc, new PkmnLib::Library::PokemonSpecies( 3, "statTestSpecies1"_cnc, new PkmnLib::Library::PokemonForme( - "default"_cnc, 1.0f, 1.0f, 100, {0}, + "default"_cnc, 1.0f, 1.0f, 236, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 236)); + 0.5f, "testGrowthRate"_cnc, 100, 100)); lib->Insert("testSpecies3"_cnc, new PkmnLib::Library::PokemonSpecies( 2, "testSpecies3"_cnc, new PkmnLib::Library::PokemonForme( - "default"_cnc, 1.0f, 1.0f, 100, {0, 4}, + "default"_cnc, 1.0f, 1.0f, 236, {0, 4}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)), - 0.5f, "testGrowthRate"_cnc, 100, 100, 236)); + 0.5f, "testGrowthRate"_cnc, 100, 100)); return lib; }