Several fixes and improvements.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -10,7 +10,7 @@ export uint8_t PkmnLib_Battle_Construct(Battle*& out, const BattleLibrary* libra
|
||||
Try(out = new Battle(library, partiesList, canFlee, numberOfSides, creaturesPerSide, randomSeed));
|
||||
}
|
||||
|
||||
export void PkmnLib_Battle_Destruct(Battle* p) { delete p; }
|
||||
export void PkmnLib_Battle_Destruct(Battle* p) { p->~Battle(); }
|
||||
export uint8_t PkmnLib_Battle_SetWeather(Battle* p, const char* name) { Try(p->SetWeather(ArbUt::StringView(name))); };
|
||||
export uint8_t PkmnLib_Battle_ClearWeather(Battle* p) { Try(p->ClearWeather()); };
|
||||
export const char* PkmnLib_Battle_GetWeatherName(Battle* p) { return p->GetWeatherName().c_str(); }
|
||||
@@ -2,23 +2,26 @@
|
||||
#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);
|
||||
export 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) {
|
||||
Try({
|
||||
if (nickname == nullptr) {
|
||||
nickname = "";
|
||||
}
|
||||
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::ClampedStatisticSet<uint8_t, 0, 31>(hpIv, attIv, defIv, sAtIv, sDeIv, spIv),
|
||||
CreatureLib::Library::ClampedStatisticSet<uint8_t, 0, 252>(hpEv, attEv, defEv, sAtEv, sDeEv, spEv), nature);
|
||||
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),
|
||||
CreatureLib::Library::ClampedStatisticSet<uint8_t, 0, 252>(hpEv, attEv, defEv, sAtEv, sDeEv, spEv), nature);
|
||||
})
|
||||
};
|
||||
|
||||
export void PkmnLib_Pokemon_Destruct(const Pokemon* p) { delete p; }
|
||||
|
||||
Reference in New Issue
Block a user