2020-04-18 11:43:05 +00:00
|
|
|
#include "../../src/Battling/Pokemon/Pokemon.hpp"
|
|
|
|
#include "../Core.hpp"
|
|
|
|
using namespace PkmnLib::Battling;
|
|
|
|
|
2022-06-07 21:23:40 +00:00
|
|
|
export_func uint8_t PkmnLib_Pokemon_Construct(
|
|
|
|
Pokemon*& out, const BattleLibrary* library, const PkmnLib::Library::PokemonSpecies* species,
|
|
|
|
const PkmnLib::Library::PokemonForme* forme, uint8_t level, uint32_t experience, uint32_t uid,
|
|
|
|
CreatureLib::Library::Gender gender, uint8_t coloring, const PkmnLib::Library::Item* heldItem, const char* nickname,
|
|
|
|
bool hiddenAbility, uint8_t abilityIndex, CreatureLib::Battling::LearnedAttack* const* moves, size_t moveCount,
|
|
|
|
uint8_t hpIv, uint8_t attIv, uint8_t defIv, uint8_t sAtIv, uint8_t sDeIv, uint8_t spIv, uint8_t hpEv, uint8_t attEv,
|
|
|
|
uint8_t defEv, uint8_t sAtEv, uint8_t sDeEv, uint8_t spEv, const PkmnLib::Library::Nature* nature,
|
|
|
|
bool allowedExperienceGain, bool isEgg) {
|
2020-12-28 14:11:06 +00:00
|
|
|
Try({
|
|
|
|
if (nickname == nullptr) {
|
|
|
|
nickname = "";
|
|
|
|
}
|
|
|
|
std::string nick(nickname);
|
|
|
|
std::vector<CreatureLib::Battling::LearnedAttack*> cMoves(moves, moves + moveCount);
|
2020-04-18 11:43:05 +00:00
|
|
|
|
2020-12-28 14:11:06 +00:00
|
|
|
out = new Pokemon(
|
|
|
|
library, species, forme, level, experience, uid, gender, coloring, heldItem, nick,
|
|
|
|
CreatureLib::Library::TalentIndex(hiddenAbility, abilityIndex), cMoves,
|
|
|
|
CreatureLib::Library::ClampedStatisticSet<uint8_t, 0, 31>(hpIv, attIv, defIv, sAtIv, sDeIv, spIv),
|
2021-06-19 10:44:05 +00:00
|
|
|
CreatureLib::Library::ClampedStatisticSet<uint8_t, 0, 252>(hpEv, attEv, defEv, sAtEv, sDeEv, spEv), nature,
|
|
|
|
allowedExperienceGain, isEgg);
|
2020-12-28 14:11:06 +00:00
|
|
|
})
|
2020-04-18 11:43:05 +00:00
|
|
|
};
|
|
|
|
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func void PkmnLib_Pokemon_Destruct(const Pokemon* p) { delete p; }
|
2020-04-18 11:43:05 +00:00
|
|
|
|
|
|
|
SIMPLE_GET_FUNC(Pokemon, IsShiny, bool)
|
2022-03-26 15:23:24 +00:00
|
|
|
SIMPLE_GET_FUNC(Pokemon, WasCaught, bool)
|
2020-06-02 18:37:21 +00:00
|
|
|
SIMPLE_GET_FUNC_SMART_PTR(Pokemon, GetNature, const PkmnLib::Library::Nature*)
|
2020-04-18 11:43:05 +00:00
|
|
|
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func u8 PkmnLib_Pokemon_GetIndividualValue(const Pokemon* p, CreatureLib::Library::Statistic stat) {
|
2020-04-18 11:43:05 +00:00
|
|
|
return p->GetIndividualValue(stat);
|
|
|
|
}
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func void PkmnLib_Pokemon_SetIndividualValue(Pokemon* p, CreatureLib::Library::Statistic stat, uint8_t value) {
|
2020-08-08 15:52:57 +00:00
|
|
|
p->SetIndividualValue(stat, value);
|
|
|
|
}
|
|
|
|
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func u8 PkmnLib_Pokemon_GetEffortValue(const Pokemon* p, CreatureLib::Library::Statistic stat) {
|
2020-04-18 11:43:05 +00:00
|
|
|
return p->GetEffortValue(stat);
|
2020-08-08 10:01:05 +00:00
|
|
|
}
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func void PkmnLib_Pokemon_SetEffortValue(Pokemon* p, CreatureLib::Library::Statistic stat, uint8_t value) {
|
2020-08-08 15:52:57 +00:00
|
|
|
p->SetEffortValue(stat, value);
|
|
|
|
}
|
2020-08-08 10:01:05 +00:00
|
|
|
|
2020-08-08 15:52:57 +00:00
|
|
|
SIMPLE_GET_FUNC(Pokemon, GetFriendship, uint8_t)
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func void PkmnLib_Pokemon_SetFriendship(Pokemon* p, u8 value) { p->SetFriendship(value); }
|
|
|
|
export_func void PkmnLib_Pokemon_ChangeFriendship(Pokemon* p, i8 amount) { p->ChangeFriendship(amount); }
|
2021-06-19 10:44:05 +00:00
|
|
|
SIMPLE_GET_FUNC(Pokemon, IsEgg, bool)
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func void PkmnLib_Pokemon_SetIsEgg(Pokemon* p, bool value) { p->SetIsEgg(value); }
|
2020-08-30 11:53:15 +00:00
|
|
|
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func u8 PkmnLib_Pokemon_Evolve(Pokemon* p, const PkmnLib::Library::PokemonSpecies* species,
|
2022-06-07 21:23:40 +00:00
|
|
|
const PkmnLib::Library::PokemonForme* forme) {
|
2020-08-30 11:53:15 +00:00
|
|
|
Try(p->Evolve(species, forme);)
|
2022-03-26 15:23:24 +00:00
|
|
|
}
|
|
|
|
|
2022-04-02 11:03:11 +00:00
|
|
|
export_func u8 PkmnLib_Pokemon_AttemptCapture(Pokemon* p, PkmnLib::Library::Item* non_null catchItem) {
|
2022-03-26 15:23:24 +00:00
|
|
|
Try(p->AttemptCapture(catchItem);)
|
2020-08-30 11:53:15 +00:00
|
|
|
}
|