PkmnLib/CInterface/Battling/Pokemon.cpp

43 lines
2.6 KiB
C++

#include "../../src/Battling/Pokemon/Pokemon.hpp"
#include "../Core.hpp"
using namespace PkmnLib::Battling;
export Pokemon* PkmnLib_Pokemon_Construct(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) {
std::string nick(nickname);
std::vector<CreatureLib::Battling::LearnedAttack*> cMoves(moves, moves + moveCount);
return new Pokemon(library, species, forme, level, experience, uid, gender, coloring, heldItem, nick,
CreatureLib::Library::TalentIndex(hiddenAbility, abilityIndex), cMoves,
CreatureLib::Library::StatisticSet<uint8_t>(hpIv, attIv, defIv, sAtIv, sDeIv, spIv),
CreatureLib::Library::StatisticSet<uint8_t>(hpEv, attEv, defEv, sAtEv, sDeEv, spEv), nature);
};
export void PkmnLib_Pokemon_Destruct(const Pokemon* p) { delete p; }
#define SIMPLE_GET_FUNC(type, name, returnType) \
export returnType PkmnLib_##type##_##name(const PkmnLib::Battling::type* p) { return p->name(); }
#define SIMPLE_GET_FUNC_SMART_PTR(type, name, returnType) \
export returnType PkmnLib_##type##_##name(const PkmnLib::Battling::type* p) { return p->name().operator->(); }
SIMPLE_GET_FUNC(Pokemon, IsShiny, bool)
SIMPLE_GET_FUNC_SMART_PTR(Pokemon, GetNature, const PkmnLib::Library::Nature*)
#undef SIMPLE_GET_FUNC
export uint8_t PkmnLib_Pokemon_GetIndividualValue(const Pokemon* p, CreatureLib::Library::Statistic stat) {
return p->GetIndividualValue(stat);
}
export uint8_t PkmnLib_Pokemon_GetEffortValue(const Pokemon* p, CreatureLib::Library::Statistic stat) {
return p->GetEffortValue(stat);
}
#undef SIMPLE_GET_FUNC
#undef SIMPLE_GET_FUNC_SMART_PTR