From 6c7c4606405da8b934591992b4afd93386208769 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Wed, 20 May 2020 16:05:52 +0200 Subject: [PATCH] Support Pokemon style experience gain. --- CInterface/Battling/BattleLibrary.cpp | 4 ++-- CInterface/Battling/ExperienceLibrary.cpp | 15 ++++++++++++ CInterface/Library/PokemonSpecies.cpp | 6 +++-- src/Battling/Library/BattleLibrary.hpp | 3 ++- src/Battling/Library/ExperienceLibrary.cpp | 23 +++++++++++++++++++ src/Battling/Library/ExperienceLibrary.hpp | 13 +++++++++++ src/Battling/PkmnScript.hpp | 3 ++- src/Battling/Pokemon/CreatePokemon.cpp | 6 ++++- src/Battling/Pokemon/CreatePokemon.hpp | 2 ++ src/Battling/Pokemon/Pokemon.hpp | 9 ++++++-- src/Library/Species/PokemonSpecies.hpp | 7 ++++-- .../AngelScript/AngelScriptScript.hpp | 2 +- tests/LibraryTests/SpeciesLibraryTests.cpp | 4 ++-- tests/LibraryTests/SpeciesTests.cpp | 22 +++++++++--------- tests/PokemonTests/ExperienceGainTests.cpp | 17 ++++++++++++++ tests/TestLibrary/TestLibrary.cpp | 8 +++---- tests/TestLibrary/TestLibrary.hpp | 2 +- 17 files changed, 116 insertions(+), 30 deletions(-) create mode 100644 CInterface/Battling/ExperienceLibrary.cpp create mode 100644 src/Battling/Library/ExperienceLibrary.cpp create mode 100644 src/Battling/Library/ExperienceLibrary.hpp create mode 100644 tests/PokemonTests/ExperienceGainTests.cpp diff --git a/CInterface/Battling/BattleLibrary.cpp b/CInterface/Battling/BattleLibrary.cpp index a6b114b..948c4e5 100644 --- a/CInterface/Battling/BattleLibrary.cpp +++ b/CInterface/Battling/BattleLibrary.cpp @@ -4,9 +4,9 @@ using namespace PkmnLib::Battling; export uint8_t PkmnLib_BattleLibrary_Construct(BattleLibrary*& out, PkmnLib::Library::PokemonLibrary* staticLib, StatCalculator* statCalculator, DamageLibrary* damageLibrary, - CreatureLib::Battling::ExperienceLibrary* experienceLibrary, + ExperienceLibrary* experienceLibrary, CreatureLib::Battling::ScriptResolver* scriptResolver, - PkmnLib::Battling::MiscLibrary* miscLibrary) { + MiscLibrary* miscLibrary) { Try(out = new BattleLibrary(staticLib, statCalculator, damageLibrary, experienceLibrary, scriptResolver, miscLibrary)); } diff --git a/CInterface/Battling/ExperienceLibrary.cpp b/CInterface/Battling/ExperienceLibrary.cpp new file mode 100644 index 0000000..e8609f9 --- /dev/null +++ b/CInterface/Battling/ExperienceLibrary.cpp @@ -0,0 +1,15 @@ +#include "../../src/Battling/Library/ExperienceLibrary.hpp" +#include "../Core.hpp" +using namespace PkmnLib::Battling; + +export ExperienceLibrary* PkmnLib_ExperienceLibrary_Construct() { return new ExperienceLibrary(); } + +export uint8_t PkmnLib_ExperienceLibrary_HandleExperienceGain(ExperienceLibrary* p, + CreatureLib::Battling::Creature* faintedMon, + CreatureLib::Battling::Creature* const* opponents, + size_t numberOfOpponents) { + Try(p->HandleExperienceGain( + faintedMon, std::unordered_set(opponents, opponents + numberOfOpponents));) +} + +export void PkmnLib_ExperienceLibrary_Destruct(ExperienceLibrary* p) { delete p; } diff --git a/CInterface/Library/PokemonSpecies.cpp b/CInterface/Library/PokemonSpecies.cpp index 6f95d33..d493596 100644 --- a/CInterface/Library/PokemonSpecies.cpp +++ b/CInterface/Library/PokemonSpecies.cpp @@ -4,10 +4,12 @@ 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) { + const char* growthRate, uint8_t captureRate, uint8_t baseHappiness, + uint16_t experienceGain) { Try(auto cName = Arbutils::CaseInsensitiveConstString(name); auto cGrowthRate = Arbutils::CaseInsensitiveConstString(growthRate); - out = new PokemonSpecies(id, cName, defaultForme, genderRatio, cGrowthRate, captureRate, baseHappiness);) + out = new PokemonSpecies(id, cName, defaultForme, genderRatio, cGrowthRate, captureRate, baseHappiness, + experienceGain);) } export void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { delete p; } diff --git a/src/Battling/Library/BattleLibrary.hpp b/src/Battling/Library/BattleLibrary.hpp index 0b2705d..d434e22 100644 --- a/src/Battling/Library/BattleLibrary.hpp +++ b/src/Battling/Library/BattleLibrary.hpp @@ -4,6 +4,7 @@ #include #include "../../Library/PokemonLibrary.hpp" #include "DamageLibrary.hpp" +#include "ExperienceLibrary.hpp" #include "MiscLibrary.hpp" #include "StatCalculator.hpp" @@ -11,7 +12,7 @@ namespace PkmnLib::Battling { class BattleLibrary : public CreatureLib::Battling::BattleLibrary { public: BattleLibrary(Library::PokemonLibrary* staticLib, StatCalculator* statCalculator, DamageLibrary* damageLibrary, - CreatureLib::Battling::ExperienceLibrary* experienceLibrary, + PkmnLib::Battling::ExperienceLibrary* experienceLibrary, CreatureLib::Battling::ScriptResolver* scriptResolver, PkmnLib::Battling::MiscLibrary* miscLibrary) : CreatureLib::Battling::BattleLibrary(staticLib, statCalculator, damageLibrary, experienceLibrary, diff --git a/src/Battling/Library/ExperienceLibrary.cpp b/src/Battling/Library/ExperienceLibrary.cpp new file mode 100644 index 0000000..6421698 --- /dev/null +++ b/src/Battling/Library/ExperienceLibrary.cpp @@ -0,0 +1,23 @@ +#include "ExperienceLibrary.hpp" +#include "../PkmnScriptHook.hpp" +#include "../Pokemon/Pokemon.hpp" + +void PkmnLib::Battling::ExperienceLibrary::HandleExperienceGain( + CreatureLib::Battling::Creature* faintedMon, + const std::unordered_set& opponents) const { + + auto fainted = dynamic_cast(faintedMon); + auto expGain = fainted->GetPokemonSpecies()->GetExperienceGains(); + auto level = fainted->GetLevel(); + // TODO exp share + + auto v1 = (expGain * level) / 5; + + for (auto op : opponents) { + auto v2 = pow(2 * level + 10, 2.5) / pow(level + op->GetLevel() + 10, 2.5); + uint32_t experienceGain = v1 * v2 + 1; + // TODO: Check owner and international + PKMN_HOOK(ModifyExperienceGain, op, faintedMon, op, experienceGain); + op->AddExperience(experienceGain); + } +} diff --git a/src/Battling/Library/ExperienceLibrary.hpp b/src/Battling/Library/ExperienceLibrary.hpp new file mode 100644 index 0000000..98e053f --- /dev/null +++ b/src/Battling/Library/ExperienceLibrary.hpp @@ -0,0 +1,13 @@ +#ifndef PKMNLIB_EXPERIENCELIBRARY_HPP +#define PKMNLIB_EXPERIENCELIBRARY_HPP + +#include +namespace PkmnLib::Battling { + class ExperienceLibrary : public CreatureLib::Battling::ExperienceLibrary { + public: + void HandleExperienceGain(CreatureLib::Battling::Creature* faintedMon, + const std::unordered_set& opponents) const override; + }; +} + +#endif // PKMNLIB_EXPERIENCELIBRARY_HPP diff --git a/src/Battling/PkmnScript.hpp b/src/Battling/PkmnScript.hpp index a2785cd..0dc95dd 100644 --- a/src/Battling/PkmnScript.hpp +++ b/src/Battling/PkmnScript.hpp @@ -1,13 +1,14 @@ #ifndef PKMNLIB_PKMNSCRIPT_HPP #define PKMNLIB_PKMNSCRIPT_HPP #include -#include "Pokemon/Pokemon.hpp" namespace PkmnLib::Battling { class PkmnScript : public CreatureLib::Battling::Script { public: virtual void ModifyCriticalStage(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, uint8_t hit, uint8_t* critStage){}; + virtual void ModifyExperienceGain(CreatureLib::Battling::Creature* faintedMon, + CreatureLib::Battling::Creature* winningMon, uint32_t experienceGain){}; }; } diff --git a/src/Battling/Pokemon/CreatePokemon.cpp b/src/Battling/Pokemon/CreatePokemon.cpp index 95f38b9..5e50de2 100644 --- a/src/Battling/Pokemon/CreatePokemon.cpp +++ b/src/Battling/Pokemon/CreatePokemon.cpp @@ -97,7 +97,7 @@ PkmnLib::Battling::Pokemon* PkmnLib::Battling::CreatePokemon::Build() { } auto pkmn = new Pokemon(_library, species, forme, _level, experience, identifier, gender, shiny, heldItem, - _nickname, ability, attacks, ivs, evs, nature); + _nickname, ability, attacks, ivs, evs, nature, _allowedExperienceGain); pkmn->Initialize(); return pkmn; } @@ -161,3 +161,7 @@ PkmnLib::Battling::CreatePokemon::LearnMove(const Arbutils::CaseInsensitiveConst _attacks.Append(ToLearnMethod(move, method)); return *this; } +PkmnLib::Battling::CreatePokemon PkmnLib::Battling::CreatePokemon::IsAllowedExperienceGain(bool value) { + _allowedExperienceGain = value; + return *this; +} diff --git a/src/Battling/Pokemon/CreatePokemon.hpp b/src/Battling/Pokemon/CreatePokemon.hpp index 27c2032..383f2ba 100644 --- a/src/Battling/Pokemon/CreatePokemon.hpp +++ b/src/Battling/Pokemon/CreatePokemon.hpp @@ -44,6 +44,7 @@ namespace PkmnLib::Battling { bool _shininessSet = false; bool _isShiny = false; + bool _allowedExperienceGain = true; public: CreatePokemon(const BattleLibrary* library, const Arbutils::CaseInsensitiveConstString& species, uint8_t level) @@ -66,6 +67,7 @@ namespace PkmnLib::Battling { uint8_t speed); CreatePokemon WithNature(const Arbutils::CaseInsensitiveConstString& nature); + CreatePokemon IsAllowedExperienceGain(bool value); Pokemon* Build(); }; diff --git a/src/Battling/Pokemon/Pokemon.hpp b/src/Battling/Pokemon/Pokemon.hpp index 396dd77..080758d 100644 --- a/src/Battling/Pokemon/Pokemon.hpp +++ b/src/Battling/Pokemon/Pokemon.hpp @@ -24,9 +24,10 @@ namespace PkmnLib::Battling { const std::string& nickname, const CreatureLib::Library::TalentIndex& talent, const List& moves, CreatureLib::Library::StatisticSet individualValues, - CreatureLib::Library::StatisticSet effortValues, const PkmnLib::Library::Nature* nature) + CreatureLib::Library::StatisticSet effortValues, const PkmnLib::Library::Nature* nature, + bool allowedExperienceGain = true) : CreatureLib::Battling::Creature(library, species, forme, level, experience, uid, gender, coloring, - heldItem, nickname, talent, moves), + heldItem, nickname, talent, moves, allowedExperienceGain), _individualValues(individualValues), _effortValues(effortValues), _nature(nature) {} const Library::PokemonForme* GetForme() const { @@ -46,6 +47,10 @@ namespace PkmnLib::Battling { inline uint8_t GetEffortValue(CreatureLib::Library::Statistic stat) const { return _effortValues.GetStat(stat); } + + inline const PkmnLib::Library::PokemonSpecies* GetPokemonSpecies() const noexcept { + return dynamic_cast(_species); + } }; } diff --git a/src/Library/Species/PokemonSpecies.hpp b/src/Library/Species/PokemonSpecies.hpp index c36cc17..4a65f35 100644 --- a/src/Library/Species/PokemonSpecies.hpp +++ b/src/Library/Species/PokemonSpecies.hpp @@ -9,13 +9,14 @@ 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) noexcept + uint8_t baseHappiness, uint16_t experienceGain) noexcept : CreatureSpecies(id, name, defaultForme, genderRatio, growthRate, captureRate), - _baseHappiness(baseHappiness) {} + _baseHappiness(baseHappiness), _experienceGain(experienceGain) {} ~PokemonSpecies() override { for (auto evo : _evolutions) { @@ -41,6 +42,8 @@ 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/src/ScriptResolving/AngelScript/AngelScriptScript.hpp b/src/ScriptResolving/AngelScript/AngelScriptScript.hpp index 3ea4357..4bfaaa0 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptScript.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptScript.hpp @@ -18,7 +18,7 @@ private: ContextPool* _ctxPool = nullptr; asIScriptObject* _obj = nullptr; - CScriptArray* GetEffectParameters(const List& ls); + CScriptArray* GetEffectParameters(const Arbutils::Collections::List& ls); public: AngelScriptScript(AngelScriptResolver* resolver, AngelScriptTypeInfo* type, asIScriptObject* obj, diff --git a/tests/LibraryTests/SpeciesLibraryTests.cpp b/tests/LibraryTests/SpeciesLibraryTests.cpp index 4048519..58dc112 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)); + 0.5f, "testGrowthRate"_cnc, 100, 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)); + 0.5f, "testGrowthRate"_cnc, 100, 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 7233412..447613a 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); + 0.5f, "testGrowthRate"_cnc, 100, 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); + 0.5f, "testGrowthRate"_cnc, 100, 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); + 0.5f, "testGrowthRate"_cnc, 100, 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); + 0.5f, "testGrowthRate"_cnc, 100, 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); + 0.5f, "testGrowthRate"_cnc, 100, 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); + 0.5f, "testGrowthRate"_cnc, 100, 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); + 0.5f, "testGrowthRate"_cnc, 100, 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); + 0.5f, "testGrowthRate"_cnc, 100, 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); + 0.5f, "testGrowthRate"_cnc, 100, 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); + 0.5f, "testGrowthRate"_cnc, 100, 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); + 0.5f, "testGrowthRate"_cnc, 100, 100, 100); species->AddEvolution(PkmnLib::Library::EvolutionData::CreateLevelEvolution(16, species2)); auto evolutions = species->GetEvolutions(); diff --git a/tests/PokemonTests/ExperienceGainTests.cpp b/tests/PokemonTests/ExperienceGainTests.cpp new file mode 100644 index 0000000..043f986 --- /dev/null +++ b/tests/PokemonTests/ExperienceGainTests.cpp @@ -0,0 +1,17 @@ +#ifdef TESTS_BUILD +#include "../../extern/catch.hpp" +#include "../../src/Battling/Library/ExperienceLibrary.hpp" +#include "../../src/Battling/Pokemon/CreatePokemon.hpp" +#include "../TestLibrary/TestLibrary.hpp" +using namespace PkmnLib::Battling; + +TEST_CASE("Basic Experience gain test", "battling") { + auto lib = TestLibrary::GetLibrary(); + auto mon1 = CreatePokemon(lib, "testSpecies"_cnc, 55).Build(); + auto initialExp = mon1->GetExperience(); + auto mon2 = CreatePokemon(lib, "testSpecies2"_cnc, 62).Build(); + auto expLib = lib->GetExperienceLibrary(); + expLib->HandleExperienceGain(mon2, {mon1}); + REQUIRE(mon1->GetExperience() - initialExp == 4339); +} +#endif \ No newline at end of file diff --git a/tests/TestLibrary/TestLibrary.cpp b/tests/TestLibrary/TestLibrary.cpp index 7eda6a0..bc9dd99 100644 --- a/tests/TestLibrary/TestLibrary.cpp +++ b/tests/TestLibrary/TestLibrary.cpp @@ -11,7 +11,7 @@ PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() { "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)); + 0.5f, "testGrowthRate"_cnc, 100, 100, 236)); lib->Insert("testSpecies2"_cnc, new PkmnLib::Library::PokemonSpecies( 2, "testSpecies2"_cnc, @@ -19,7 +19,7 @@ PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() { "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)); + 0.5f, "testGrowthRate"_cnc, 100, 100, 306)); lib->Insert("statTestSpecies1"_cnc, new PkmnLib::Library::PokemonSpecies( 3, "statTestSpecies1"_cnc, @@ -27,7 +27,7 @@ PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() { "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)); + 0.5f, "testGrowthRate"_cnc, 100, 100, 236)); lib->Insert("testSpecies3"_cnc, new PkmnLib::Library::PokemonSpecies( 2, "testSpecies3"_cnc, @@ -35,7 +35,7 @@ PkmnLib::Library::SpeciesLibrary* TestLibrary::BuildSpeciesLibrary() { "default"_cnc, 1.0f, 1.0f, 100, {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)); + 0.5f, "testGrowthRate"_cnc, 100, 100, 236)); return lib; } diff --git a/tests/TestLibrary/TestLibrary.hpp b/tests/TestLibrary/TestLibrary.hpp index e4502f7..00aa30b 100644 --- a/tests/TestLibrary/TestLibrary.hpp +++ b/tests/TestLibrary/TestLibrary.hpp @@ -25,7 +25,7 @@ public: auto scriptResolver = PkmnLib::Battling::BattleLibrary::CreateScriptResolver(); auto lib = new PkmnLib::Battling::BattleLibrary( BuildStaticLibrary(), statCalc, new PkmnLib::Battling::DamageLibrary(), - new CreatureLib::Battling::ExperienceLibrary(), scriptResolver, new PkmnLib::Battling::MiscLibrary()); + new PkmnLib::Battling::ExperienceLibrary(), scriptResolver, new PkmnLib::Battling::MiscLibrary()); scriptResolver->Initialize(lib); return lib; }