Support Pokemon style experience gain.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2020-05-20 16:05:52 +02:00
parent a19965c1c3
commit 6c7c460640
17 changed files with 116 additions and 30 deletions

View File

@@ -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));
}

View File

@@ -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<CreatureLib::Battling::Creature*>(opponents, opponents + numberOfOpponents));)
}
export void PkmnLib_ExperienceLibrary_Destruct(ExperienceLibrary* p) { delete p; }

View File

@@ -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; }