Style fixes
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
e4b818c799
commit
a05a9ac76d
|
@ -5,52 +5,56 @@ export_func AngelScriptResolver* PkmnLib_AngelScriptResolver_Construct() { retur
|
|||
export_func uint8_t PkmnLib_AngelScriptResolver_Destruct(AngelScriptResolver* p) { Try(delete p;) }
|
||||
|
||||
export_func uint8_t PkmnLib_AngelScriptResolver_Initialize(AngelScriptResolver* p,
|
||||
CreatureLib::Battling::BattleLibrary* lib) {
|
||||
CreatureLib::Battling::BattleLibrary* lib) {
|
||||
Try(p->Initialize(lib);)
|
||||
}
|
||||
|
||||
export_func uint8_t PkmnLib_AngelScriptResolver_CreateScript(AngelScriptResolver* p, const char* name, const char* script) {
|
||||
export_func uint8_t PkmnLib_AngelScriptResolver_CreateScript(AngelScriptResolver* p, const char* name,
|
||||
const char* script) {
|
||||
Try(p->CreateScript(name, script);)
|
||||
}
|
||||
export_func uint8_t PkmnLib_AngelScriptResolver_FinalizeModule(AngelScriptResolver* p) { Try(p->FinalizeModule();) }
|
||||
export_func uint8_t PkmnLib_AngelScriptResolver_LoadScript(CreatureLib::Battling::BattleScript*& out, AngelScriptResolver* p,
|
||||
void* owner, ScriptCategory category, const char* scriptName) {
|
||||
export_func uint8_t PkmnLib_AngelScriptResolver_LoadScript(CreatureLib::Battling::BattleScript*& out,
|
||||
AngelScriptResolver* p, void* owner, ScriptCategory category,
|
||||
const char* scriptName) {
|
||||
Try(out = p->LoadScript(owner, category, ArbUt::StringView(scriptName)).TakeOwnership();)
|
||||
}
|
||||
export_func uint8_t PkmnLib_AngelScriptResolver_LoadEvolutionScript(PkmnLib::Battling::EvolutionScript const*& out,
|
||||
AngelScriptResolver* p, const char* scriptName) {
|
||||
AngelScriptResolver* p, const char* scriptName) {
|
||||
Try(
|
||||
auto s = p->LoadEvolutionScript(ArbUt::StringView(scriptName));
|
||||
if (!s.HasValue()) { out = nullptr; } else { out = s.GetValue(); })
|
||||
}
|
||||
|
||||
export_func uint8_t PkmnLib_AngelScriptResolver_WriteByteCodeToFile(AngelScriptResolver* p, const char* file,
|
||||
bool stripDebugInfo) {
|
||||
bool stripDebugInfo) {
|
||||
Try(p->WriteByteCodeToFile(file, stripDebugInfo);)
|
||||
}
|
||||
export_func uint8_t PkmnLib_AngelScriptResolver_LoadByteCodeFromFile(AngelScriptResolver* p, const char* file) {
|
||||
Try(p->LoadByteCodeFromFile(file);)
|
||||
}
|
||||
export_func uint8_t PkmnLib_AngelScriptResolver_WriteByteCodeToMemory(AngelScriptResolver* p, bool stripDebugInfo,
|
||||
size_t& size, uint8_t*& out) {
|
||||
size_t& size, uint8_t*& out) {
|
||||
Try(out = p->WriteByteCodeToMemory(size, stripDebugInfo);)
|
||||
}
|
||||
export_func uint8_t PkmnLib_AngelScriptResolver_LoadByteCodeFromMemory(AngelScriptResolver* p, uint8_t* memory,
|
||||
size_t size) {
|
||||
size_t size) {
|
||||
Try(p->LoadByteCodeFromMemory(memory, size);)
|
||||
}
|
||||
export_func uint8_t PkmnLib_AngelScriptResolver_RegisterType(AngelScriptResolver* p, const char* typeName) {
|
||||
Try(p->RegisterType(typeName);)
|
||||
}
|
||||
export_func uint8_t PkmnLib_AngelScriptResolver_RegisterTypeMethod(AngelScriptResolver* p, const char* typeName,
|
||||
const char* decl, void*(func)(void*)) {
|
||||
const char* decl, void*(func)(void*)) {
|
||||
Try(p->RegisterTypeMethod(typeName, decl, func);)
|
||||
}
|
||||
export_func uint8_t PkmnLib_AngelScriptResolver_RegisterGlobalMethod(AngelScriptResolver* p, const char* decl,
|
||||
void*(func)(void*)) {
|
||||
void*(func)(void*)) {
|
||||
Try(p->RegisterGlobalMethod(decl, func);)
|
||||
}
|
||||
export_func void PkmnLib_AngelScriptResolver_DefineWord(AngelScriptResolver* p, const char* word) { p->DefineWord(word); }
|
||||
export_func void PkmnLib_AngelScriptResolver_DefineWord(AngelScriptResolver* p, const char* word) {
|
||||
p->DefineWord(word);
|
||||
}
|
||||
|
||||
#ifdef ANGELSCRIPT_DEBUGGER
|
||||
export_func void PkmnLib_AngelScriptResolver_AddDebugger(AngelScriptResolver* p, u16 port) {
|
||||
|
|
|
@ -3,14 +3,16 @@
|
|||
using namespace PkmnLib::Battling;
|
||||
|
||||
export_func uint8_t PkmnLib_Battle_Construct(Battle*& out, const BattleLibrary* library,
|
||||
CreatureLib::Battling::BattleParty* const* parties, size_t partiesCount,
|
||||
bool canFlee, uint8_t numberOfSides, uint8_t creaturesPerSide,
|
||||
uint_fast32_t randomSeed) {
|
||||
CreatureLib::Battling::BattleParty* const* parties, size_t partiesCount,
|
||||
bool canFlee, uint8_t numberOfSides, uint8_t creaturesPerSide,
|
||||
uint_fast32_t randomSeed) {
|
||||
ArbUt::List<CreatureLib::Battling::BattleParty*> partiesList(parties, parties + partiesCount);
|
||||
Try(out = new Battle(library, partiesList, canFlee, numberOfSides, creaturesPerSide, randomSeed));
|
||||
}
|
||||
|
||||
export_func void PkmnLib_Battle_Destruct(Battle* p) { p->~Battle(); }
|
||||
export_func uint8_t PkmnLib_Battle_SetWeather(Battle* p, const char* name) { Try(p->SetWeather(ArbUt::StringView(name))); };
|
||||
export_func uint8_t PkmnLib_Battle_SetWeather(Battle* p, const char* name) {
|
||||
Try(p->SetWeather(ArbUt::StringView(name)));
|
||||
};
|
||||
export_func uint8_t PkmnLib_Battle_ClearWeather(Battle* p) { Try(p->ClearWeather()); };
|
||||
export_func const char* PkmnLib_Battle_GetWeatherName(Battle* p) { return p->GetWeatherName().c_str(); }
|
|
@ -3,10 +3,10 @@
|
|||
using namespace PkmnLib::Battling;
|
||||
|
||||
export_func uint8_t PkmnLib_BattleLibrary_Construct(BattleLibrary*& out, PkmnLib::Library::PokemonLibrary* staticLib,
|
||||
StatCalculator* statCalculator, DamageLibrary* damageLibrary,
|
||||
ExperienceLibrary* experienceLibrary,
|
||||
PkmnLib::Battling::ScriptResolver* scriptResolver,
|
||||
MiscLibrary* miscLibrary, CaptureLibrary* captureLibrary) {
|
||||
StatCalculator* statCalculator, DamageLibrary* damageLibrary,
|
||||
ExperienceLibrary* experienceLibrary,
|
||||
PkmnLib::Battling::ScriptResolver* scriptResolver,
|
||||
MiscLibrary* miscLibrary, CaptureLibrary* captureLibrary) {
|
||||
Try(out = new BattleLibrary(staticLib, statCalculator, damageLibrary, experienceLibrary, scriptResolver,
|
||||
miscLibrary, captureLibrary));
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ using namespace PkmnLib::Battling;
|
|||
export_func ExperienceLibrary* PkmnLib_ExperienceLibrary_Construct() { return new ExperienceLibrary(); }
|
||||
|
||||
export_func uint8_t PkmnLib_ExperienceLibrary_HandleExperienceGain(ExperienceLibrary* p,
|
||||
CreatureLib::Battling::Creature* faintedMon,
|
||||
CreatureLib::Battling::Creature* const* opponents,
|
||||
size_t numberOfOpponents) {
|
||||
CreatureLib::Battling::Creature* faintedMon,
|
||||
CreatureLib::Battling::Creature* const* opponents,
|
||||
size_t numberOfOpponents) {
|
||||
Try(p->HandleExperienceGain(faintedMon, std::unordered_set<ArbUt::BorrowedPtr<CreatureLib::Battling::Creature>>(
|
||||
opponents, opponents + numberOfOpponents));)
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ export_func MiscLibrary* PkmnLib_MiscLibrary_Construct(PkmnLib::Library::TimeOfD
|
|||
export_func void PkmnLib_MiscLibrary_Destruct(MiscLibrary* p) { delete p; }
|
||||
|
||||
export_func u8 PkmnLib_MiscLibrary_CanEvolveFromLevelUp(bool& out, MiscLibrary* p,
|
||||
const PkmnLib::Library::EvolutionData* evoData,
|
||||
const Pokemon* pokemon) {
|
||||
const PkmnLib::Library::EvolutionData* evoData,
|
||||
const Pokemon* pokemon) {
|
||||
Try(out = p->CanEvolveFromLevelUp(evoData, pokemon))
|
||||
}
|
|
@ -5,14 +5,14 @@
|
|||
using namespace PkmnLib::Battling;
|
||||
|
||||
export_func uint8_t PkmnLib_PkmnScript_ModifyCriticalStage(PkmnScript* script,
|
||||
CreatureLib::Battling::ExecutingAttack* attack,
|
||||
CreatureLib::Battling::Creature* target, uint8_t hit,
|
||||
uint8_t* critStage) {
|
||||
CreatureLib::Battling::ExecutingAttack* attack,
|
||||
CreatureLib::Battling::Creature* target, uint8_t hit,
|
||||
uint8_t* critStage) {
|
||||
Try(script->ModifyCriticalStage(attack, target, hit, critStage);)
|
||||
}
|
||||
|
||||
export_func u8 PkmnLib_EvolutionScript_DoesEvolveFromLevelUp(EvolutionScript* script,
|
||||
const PkmnLib::Library::EvolutionData* evoData,
|
||||
const Pokemon* pokemon, bool* out) {
|
||||
const PkmnLib::Library::EvolutionData* evoData,
|
||||
const Pokemon* pokemon, bool* out) {
|
||||
Try(script->DoesEvolveFromLevelUp(evoData, pokemon, out));
|
||||
}
|
|
@ -2,15 +2,14 @@
|
|||
#include "../Core.hpp"
|
||||
using namespace PkmnLib::Battling;
|
||||
|
||||
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) {
|
||||
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) {
|
||||
Try({
|
||||
if (nickname == nullptr) {
|
||||
nickname = "";
|
||||
|
@ -54,7 +53,7 @@ SIMPLE_GET_FUNC(Pokemon, IsEgg, bool)
|
|||
export_func void PkmnLib_Pokemon_SetIsEgg(Pokemon* p, bool value) { p->SetIsEgg(value); }
|
||||
|
||||
export_func u8 PkmnLib_Pokemon_Evolve(Pokemon* p, const PkmnLib::Library::PokemonSpecies* species,
|
||||
const PkmnLib::Library::PokemonForme* forme) {
|
||||
const PkmnLib::Library::PokemonForme* forme) {
|
||||
Try(p->Evolve(species, forme);)
|
||||
}
|
||||
|
||||
|
|
|
@ -4,4 +4,6 @@ std::string ExceptionHandler::_pkmnLibLastException = "";
|
|||
std::string ExceptionHandler::_pkmnLibLastExceptionStacktrace = "Unset";
|
||||
|
||||
export_func const char* PkmnLib_C_GetLastException() { return ExceptionHandler::GetLastException(); }
|
||||
export_func const char* PkmnLib_C_GetLastExceptionStacktrace() { return ExceptionHandler::GetLastExceptionStacktrace(); }
|
||||
export_func const char* PkmnLib_C_GetLastExceptionStacktrace() {
|
||||
return ExceptionHandler::GetLastExceptionStacktrace();
|
||||
}
|
|
@ -6,59 +6,62 @@ export_func const EvolutionData* PkmnLib_EvolutionData_CreateLevelEvolution(uint
|
|||
return EvolutionData::CreateLevelEvolution(level, into);
|
||||
}
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipEvolution(uint8_t friendship,
|
||||
const PokemonSpecies* into) {
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateFriendshipEvolution(friendship, into);
|
||||
}
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipTimeEvolution(uint8_t friendship, TimeOfDay startTime,
|
||||
TimeOfDay endTime,
|
||||
const PokemonSpecies* into) {
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipTimeEvolution(uint8_t friendship,
|
||||
TimeOfDay startTime,
|
||||
TimeOfDay endTime,
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateFriendshipTimeEvolution(friendship, startTime, endTime, into);
|
||||
}
|
||||
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateKnownMoveEvolution(const MoveData* move,
|
||||
const PokemonSpecies* into) {
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateKnownMoveEvolution(move, into);
|
||||
}
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateLocationEvolution(const char* location,
|
||||
const PokemonSpecies* into) {
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateLocationEvolution(ArbUt::StringView(location), into);
|
||||
}
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateTimeEvolution(TimeOfDay startTime, TimeOfDay endTime,
|
||||
const PokemonSpecies* into) {
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateTimeEvolution(startTime, endTime, into);
|
||||
}
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemEvolution(const Item* item,
|
||||
const PokemonSpecies* into) {
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateHeldItemEvolution(item, into);
|
||||
}
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemTimeEvolution(const Item* item, TimeOfDay startTime,
|
||||
TimeOfDay endTime,
|
||||
const PokemonSpecies* into) {
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemTimeEvolution(const Item* item,
|
||||
TimeOfDay startTime,
|
||||
TimeOfDay endTime,
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateHeldItemTimeEvolution(item, startTime, endTime, into);
|
||||
}
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateGenderBasedEvolution(CreatureLib::Library::Gender gender,
|
||||
uint8_t level,
|
||||
const PokemonSpecies* into) {
|
||||
uint8_t level,
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateGenderBasedEvolution(gender, level, into);
|
||||
}
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateItemUseEvolution(const Item* item, const PokemonSpecies* into) {
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateItemUseEvolution(const Item* item,
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateItemUseEvolution(item, into);
|
||||
}
|
||||
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateItemUseWithGenderEvolution(const Item* item,
|
||||
CreatureLib::Library::Gender gender,
|
||||
const PokemonSpecies* into) {
|
||||
export_func const EvolutionData*
|
||||
PkmnLib_EvolutionData_CreateItemUseWithGenderEvolution(const Item* item, CreatureLib::Library::Gender gender,
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateItemUseWithGenderEvolution(item, gender, into);
|
||||
}
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateTradeEvolution(const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateTradeEvolution(into);
|
||||
}
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateTradeWithItemEvolution(const Item* item,
|
||||
const PokemonSpecies* into) {
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateTradeWithItemEvolution(item, into);
|
||||
}
|
||||
export_func const EvolutionData* PkmnLib_EvolutionData_CreateTradeWithSpeciesEvolution(const PokemonSpecies* traded,
|
||||
const PokemonSpecies* into) {
|
||||
const PokemonSpecies* into) {
|
||||
return EvolutionData::CreateTradeWithSpeciesEvolution(traded, into);
|
||||
}
|
||||
export_func const EvolutionData*
|
||||
|
@ -74,6 +77,6 @@ export_func const PokemonSpecies* PkmnLib_EvolutionData_GetNewSpecies(const Evol
|
|||
}
|
||||
export_func size_t PkmnLib_EvolutionData_GetDataCount(const EvolutionData* data) { return data->GetDataCount(); }
|
||||
export_func uint8_t PkmnLib_EvolutionData_GetDataAt(const EvolutionData* data, size_t index,
|
||||
const CreatureLib::Library::EffectParameter*& out) {
|
||||
const CreatureLib::Library::EffectParameter*& out) {
|
||||
Try(out = data->GetDataAt(index).GetRaw());
|
||||
}
|
||||
|
|
|
@ -4,12 +4,13 @@
|
|||
using namespace PkmnLib::Library;
|
||||
|
||||
export_func Item* PkmnLib_Item_Construct(const char* name, CreatureLib::Library::ItemCategory category,
|
||||
CreatureLib::Library::BattleItemCategory battleCategory, int32_t price,
|
||||
const char* effectName, CreatureLib::Library::EffectParameter* effectParameters[],
|
||||
size_t effectParameterCount, const char* battleTriggerEffectName,
|
||||
CreatureLib::Library::EffectParameter* battleTriggerEffectParameters[],
|
||||
size_t battleTriggerEffectParameterCount, const char* flags[], size_t flagsCount,
|
||||
uint8_t flingPower) {
|
||||
CreatureLib::Library::BattleItemCategory battleCategory, int32_t price,
|
||||
const char* effectName,
|
||||
CreatureLib::Library::EffectParameter* effectParameters[],
|
||||
size_t effectParameterCount, const char* battleTriggerEffectName,
|
||||
CreatureLib::Library::EffectParameter* battleTriggerEffectParameters[],
|
||||
size_t battleTriggerEffectParameterCount, const char* flags[],
|
||||
size_t flagsCount, uint8_t flingPower) {
|
||||
std::unordered_set<uint32_t> conversedFlags(flagsCount);
|
||||
for (size_t i = 0; i < flagsCount; i++) {
|
||||
conversedFlags.insert(ArbUt::StringView::CalculateHash(flags[i]));
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
using namespace PkmnLib::Library;
|
||||
|
||||
export_func const LibrarySettings* PkmnLib_LibrarySettings_Construct(uint8_t maximalLevel, uint8_t maximalMoves,
|
||||
uint16_t shinyRate) {
|
||||
uint16_t shinyRate) {
|
||||
return new LibrarySettings(maximalLevel, maximalMoves, shinyRate);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
using namespace PkmnLib::Library;
|
||||
|
||||
export_func Nature* PkmnLib_Nature_Construct(CreatureLib::Library::Statistic increasedStat,
|
||||
CreatureLib::Library::Statistic decreasedStat, float increasedModifier,
|
||||
float decreasedModifier) {
|
||||
CreatureLib::Library::Statistic decreasedStat, float increasedModifier,
|
||||
float decreasedModifier) {
|
||||
return new Nature(increasedStat, decreasedStat, increasedModifier, decreasedModifier);
|
||||
}
|
||||
export_func void PkmnLib_Nature_Destruct(const Nature* p) { delete p; }
|
||||
|
@ -15,6 +15,6 @@ SIMPLE_GET_FUNC(Nature, GetIncreasedStat, CreatureLib::Library::Statistic)
|
|||
SIMPLE_GET_FUNC(Nature, GetDecreasedStat, CreatureLib::Library::Statistic)
|
||||
|
||||
export_func float PkmnLib_Nature_GetStatModifier(const PkmnLib::Library::Nature* nature,
|
||||
CreatureLib::Library::Statistic stat) {
|
||||
CreatureLib::Library::Statistic stat) {
|
||||
return nature->GetStatModifier(stat);
|
||||
}
|
|
@ -3,11 +3,11 @@
|
|||
using namespace PkmnLib::Library;
|
||||
|
||||
export_func uint8_t PkmnLib_PokemonLibrary_Construct(PokemonLibrary*& out, PkmnLib::Library::LibrarySettings* settings,
|
||||
SpeciesLibrary* species, MoveLibrary* moves, ItemLibrary* items,
|
||||
CreatureLib::Library::GrowthRateLibrary* growthRates,
|
||||
CreatureLib::Library::TypeLibrary* typeLibrary,
|
||||
CreatureLib::Library::TalentLibrary* talentLibrary,
|
||||
NatureLibrary* natures) {
|
||||
SpeciesLibrary* species, MoveLibrary* moves, ItemLibrary* items,
|
||||
CreatureLib::Library::GrowthRateLibrary* growthRates,
|
||||
CreatureLib::Library::TypeLibrary* typeLibrary,
|
||||
CreatureLib::Library::TalentLibrary* talentLibrary,
|
||||
NatureLibrary* natures) {
|
||||
Try(out = new PokemonLibrary(settings, species, moves, items, growthRates, typeLibrary, talentLibrary, natures));
|
||||
}
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
using namespace PkmnLib::Library;
|
||||
|
||||
export_func 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* const* eggGroupsRaw, size_t eggGroupsLength,
|
||||
const char* flags[], size_t flagsCount) {
|
||||
const PokemonForme* defaultForme, float genderRatio,
|
||||
const char* growthRate, uint8_t captureRate, uint8_t baseHappiness,
|
||||
const char* const* eggGroupsRaw, size_t eggGroupsLength,
|
||||
const char* flags[], size_t flagsCount) {
|
||||
|
||||
Try(
|
||||
std::unordered_set<uint32_t> conversedFlags(flagsCount); for (size_t i = 0; i < flagsCount; i++) {
|
||||
|
@ -25,9 +25,12 @@ export_func void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { dele
|
|||
SIMPLE_GET_FUNC(PokemonSpecies, GetBaseHappiness, uint8_t);
|
||||
export_func void PkmnLib_PokemonSpecies_AddEvolution(PokemonSpecies* p, EvolutionData* evo) { p->AddEvolution(evo); }
|
||||
|
||||
export_func size_t PkmnLib_PokemonSpecies_GetEvolutionCount(const PokemonSpecies* p) { return p->GetEvolutions().Count(); }
|
||||
export_func size_t PkmnLib_PokemonSpecies_GetEvolutionCount(const PokemonSpecies* p) {
|
||||
return p->GetEvolutions().Count();
|
||||
}
|
||||
|
||||
export_func uint8_t PkmnLib_PokemonSpecies_GetEvolution(const PokemonSpecies* p, size_t index, const EvolutionData*& out) {
|
||||
export_func uint8_t PkmnLib_PokemonSpecies_GetEvolution(const PokemonSpecies* p, size_t index,
|
||||
const EvolutionData*& out) {
|
||||
Try(out = p->GetEvolutions().At(index).GetRaw());
|
||||
}
|
||||
|
||||
|
@ -35,7 +38,9 @@ export_func uint8_t PkmnLib_PokemonSpecies_GetEvolutions(const PokemonSpecies* p
|
|||
Try(out = p->GetEvolutions().RawData());
|
||||
}
|
||||
|
||||
export_func size_t PkmnLib_PokemonSpecies_GetEggGroupCount(const PokemonSpecies* p) { return p->GetEggGroups().Count(); }
|
||||
export_func size_t PkmnLib_PokemonSpecies_GetEggGroupCount(const PokemonSpecies* p) {
|
||||
return p->GetEggGroups().Count();
|
||||
}
|
||||
export_func const char* PkmnLib_PokemonSpecies_GetEggGroup(const PokemonSpecies* p, size_t index) {
|
||||
return p->GetEggGroups()[index].c_str();
|
||||
}
|
|
@ -7,7 +7,7 @@ export_func const SpeciesLibrary* PkmnLib_SpeciesLibrary_Construct(size_t initia
|
|||
};
|
||||
|
||||
export_func u8 PkmnLib_SpeciesLibrary_FindPreEvolution(const PokemonSpecies*& out, const SpeciesLibrary* p,
|
||||
const PokemonSpecies* species) {
|
||||
const PokemonSpecies* species) {
|
||||
Try(
|
||||
auto v = p->FindPreEvolution(species);
|
||||
if (!v.has_value()) { out = nullptr; } else { out = v.value().GetRaw(); })
|
||||
|
|
|
@ -95,7 +95,6 @@ float PkmnLib::Battling::DamageLibrary::GetStatModifier(CreatureLib::Battling::E
|
|||
PKMN_HOOK(ModifyOffensiveStatValue, attack, attack, target, hit, &offensiveValue);
|
||||
PKMN_HOOK(ModifyDefensiveStatValue, attack, attack, target, hit, &defensiveValue);
|
||||
|
||||
|
||||
return offensiveValue / defensiveValue;
|
||||
}
|
||||
float PkmnLib::Battling::DamageLibrary::GetDamageModifier(CreatureLib::Battling::ExecutingAttack*,
|
||||
|
|
|
@ -83,8 +83,7 @@ void PkmnLib::Battling::Pokemon::AttemptCapture(PkmnLib::Library::Item* catchIte
|
|||
Ensure(_battleData.Side.HasValue());
|
||||
Ensure(!IsFainted());
|
||||
Ensure(IsUsable());
|
||||
auto captureLibrary =
|
||||
GetLibrary().ForceAs<const BattleLibrary>()->GetCaptureLibrary();
|
||||
auto captureLibrary = GetLibrary().ForceAs<const BattleLibrary>()->GetCaptureLibrary();
|
||||
auto result = captureLibrary->TryCatch(this, catchItem, _battleData.Battle.GetValue()->GetRandom());
|
||||
_battleData.Battle.GetValue()->TriggerEventListener<CaptureAttemptEvent>(this, result);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace PkmnLib::Battling {
|
|||
public:
|
||||
PokemonParty(ArbUt::List<CreatureLib::Battling::Creature * nullable> party)
|
||||
: CreatureLib::Battling::CreatureParty(std::move(party)) {}
|
||||
PokemonParty(std::initializer_list<CreatureLib::Battling::Creature* nullable> party)
|
||||
PokemonParty(std::initializer_list<CreatureLib::Battling::Creature * nullable> party)
|
||||
: CreatureLib::Battling::CreatureParty(party) {}
|
||||
PokemonParty(size_t size) : CreatureLib::Battling::CreatureParty(size) {}
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ namespace PkmnLib::Library {
|
|||
MoveData(const ArbUt::StringView& name, u8 type, PkmnLib::Library::MoveCategory category, u8 power, u8 accuracy,
|
||||
u8 baseUsage, CreatureLib::Library::AttackTarget target, i8 priority,
|
||||
const CreatureLib::Library::SecondaryEffect* nullable effect, std::unordered_set<u32> flags)
|
||||
: AttackData(name, type, static_cast<CreatureLib::Library::AttackCategory>(category), power, accuracy, baseUsage,
|
||||
target, priority, effect, std::move(flags)) {};
|
||||
: AttackData(name, type, static_cast<CreatureLib::Library::AttackCategory>(category), power, accuracy,
|
||||
baseUsage, target, priority, effect, std::move(flags)){};
|
||||
|
||||
inline PkmnLib::Library::MoveCategory GetCategory() const {
|
||||
return static_cast<PkmnLib::Library::MoveCategory>(AttackData::GetCategory());
|
||||
|
|
|
@ -25,9 +25,7 @@ namespace PkmnLib::Library {
|
|||
return _items.Get(name);
|
||||
}
|
||||
|
||||
inline ArbUt::BorrowedPtr<const Nature> GetNatureByHash(u32 hash) const {
|
||||
return _items.GetFromHash(hash);
|
||||
}
|
||||
inline ArbUt::BorrowedPtr<const Nature> GetNatureByHash(u32 hash) const { return _items.GetFromHash(hash); }
|
||||
|
||||
inline const ArbUt::StringView& GetRandomNatureName(ArbUt::Random rand = ArbUt::Random()) const {
|
||||
auto i = rand.Get(_items.Count());
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace PkmnLib::Library {
|
|||
return tryGet->get();
|
||||
}
|
||||
for (const auto& s : _values) {
|
||||
const auto* pkmn = dynamic_cast<const PokemonSpecies* nullable>(s.second.get());
|
||||
const auto* pkmn = dynamic_cast<const PokemonSpecies * nullable>(s.second.get());
|
||||
if (pkmn == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -33,9 +33,7 @@ namespace PkmnLib::Library {
|
|||
return CreatureLib::Library::SpeciesLibrary::GetByHash(hashedKey).As<const PokemonSpecies>();
|
||||
}
|
||||
|
||||
ArbUt::BorrowedPtr<const PokemonSpecies> operator[](const ArbUt::StringView& name) const {
|
||||
return Get(name);
|
||||
}
|
||||
ArbUt::BorrowedPtr<const PokemonSpecies> operator[](const ArbUt::StringView& name) const { return Get(name); }
|
||||
|
||||
std::optional<ArbUt::BorrowedPtr<const PokemonSpecies>>
|
||||
FindPreEvolution(const ArbUt::BorrowedPtr<const PokemonSpecies>& species) const noexcept;
|
||||
|
|
|
@ -72,8 +72,7 @@ private:
|
|||
|
||||
#define ITEM_USE_SCRIPT_HOOK_FUNCTION(name, decl) FunctionInfo __##name = Initialize(decl)
|
||||
|
||||
ITEM_USE_SCRIPT_HOOK_FUNCTION(
|
||||
OnInitialize, "void OnInitialize(const narray<EffectParameter@>@ parameters)");
|
||||
ITEM_USE_SCRIPT_HOOK_FUNCTION(OnInitialize, "void OnInitialize(const narray<EffectParameter@>@ parameters)");
|
||||
ITEM_USE_SCRIPT_HOOK_FUNCTION(IsItemUsable, "bool IsItemUsable()");
|
||||
ITEM_USE_SCRIPT_HOOK_FUNCTION(IsPokemonUseItem, "bool IsPokemonUseItem()");
|
||||
ITEM_USE_SCRIPT_HOOK_FUNCTION(IsUseValidForPokemon, "bool IsUseValidForPokemon(Pokemon@ target)");
|
||||
|
|
|
@ -13,10 +13,11 @@ protected:
|
|||
IPkmnBinaryStream(size_t angelScriptBound) : _angelScriptBound(angelScriptBound) {}
|
||||
|
||||
public:
|
||||
virtual void WriteTypes(
|
||||
const ArbUt::Dictionary<ScriptCategory, ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo* non_null>>& types,
|
||||
const ArbUt::Dictionary<ArbUt::StringView, asITypeInfo* non_null>& itemUseTypes,
|
||||
const ArbUt::Dictionary<ArbUt::StringView, asITypeInfo* non_null>& evolutionTypes) {
|
||||
virtual void
|
||||
WriteTypes(const ArbUt::Dictionary<ScriptCategory,
|
||||
ArbUt::Dictionary<ArbUt::StringView, AngelScriptTypeInfo * non_null>>& types,
|
||||
const ArbUt::Dictionary<ArbUt::StringView, asITypeInfo * non_null>& itemUseTypes,
|
||||
const ArbUt::Dictionary<ArbUt::StringView, asITypeInfo * non_null>& evolutionTypes) {
|
||||
// We serialize our types in the format
|
||||
// "[category(byte)][name(str)]\2[decl(str)]\2[name(str)]\2[decl(str)]\1[category(byte)]...."
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ static bool GetMove(const PkmnLib::Library::MoveLibrary* obj, const ArbUt::Basic
|
|||
return obj->Get(str);
|
||||
}
|
||||
|
||||
|
||||
void RegisterMoveTypes::RegisterMoveType(asIScriptEngine* engine) {
|
||||
int r = engine->RegisterObjectType("MoveData", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||
Ensure(r >= 0);
|
||||
|
@ -51,7 +50,7 @@ void RegisterMoveTypes::RegisterMoveLibrary(asIScriptEngine* engine) {
|
|||
int r = engine->RegisterObjectType("MoveLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
|
||||
Ensure(r >= 0);
|
||||
r = engine->RegisterObjectMethod("MoveLibrary", "const MoveData@ Get(const constString &in name) const",
|
||||
asFUNCTION(GetMove), asCALL_CDECL_OBJFIRST);
|
||||
asFUNCTION(GetMove), asCALL_CDECL_OBJFIRST);
|
||||
Ensure(r >= 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
class WebAssemblyScriptResolver;
|
||||
class LibraryMethods {
|
||||
public:
|
||||
static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs,
|
||||
WebAssemblyScriptResolver* resolver);
|
||||
static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs, WebAssemblyScriptResolver* resolver);
|
||||
};
|
||||
|
||||
#endif // PKMNLIB_LIBRARYMETHODS_H
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
class WebAssemblyScriptResolver;
|
||||
class WASMItemRegistry {
|
||||
public:
|
||||
static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs,
|
||||
WebAssemblyScriptResolver* resolver);
|
||||
static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs, WebAssemblyScriptResolver* resolver);
|
||||
};
|
||||
|
||||
#endif // PKMNLIB_WASMITEMREGISTRY_H
|
||||
|
|
|
@ -8,9 +8,7 @@ using namespace CreatureLib::Library;
|
|||
|
||||
wasm_func_t* MoveData_HasFlagByHash(WebAssemblyScriptResolver* resolver) {
|
||||
return WasmHelpers::CreateFunc<bool, AttackData*, u32>(
|
||||
resolver, {[](WebAssemblyScriptResolver*, AttackData* move, u32 flag) -> bool {
|
||||
return move->HasFlag(flag);
|
||||
}});
|
||||
resolver, {[](WebAssemblyScriptResolver*, AttackData* move, u32 flag) -> bool { return move->HasFlag(flag); }});
|
||||
}
|
||||
|
||||
void WASMMoveDataRegistry::Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs,
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
class WebAssemblyScriptResolver;
|
||||
class WASMMoveDataRegistry {
|
||||
public:
|
||||
static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs,
|
||||
WebAssemblyScriptResolver* resolver);
|
||||
static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs, WebAssemblyScriptResolver* resolver);
|
||||
};
|
||||
|
||||
#endif // PKMNLIB_WASMMOVEDATAREGISTRY_H
|
||||
|
|
|
@ -37,7 +37,6 @@ wasm_func_t* Species_HasEggGroupByHash(WebAssemblyScriptResolver* resolver) {
|
|||
}});
|
||||
}
|
||||
|
||||
|
||||
void WASMSpeciesRegistry::Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs,
|
||||
WebAssemblyScriptResolver* resolver) {
|
||||
REGISTER_GETTER("species_get_id", CreatureSpecies, GetId, resolver)
|
||||
|
|
|
@ -7,8 +7,7 @@ class WebAssemblyScriptResolver;
|
|||
|
||||
class WASMSpeciesRegistry {
|
||||
public:
|
||||
static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs,
|
||||
WebAssemblyScriptResolver* resolver);
|
||||
static void Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs, WebAssemblyScriptResolver* resolver);
|
||||
};
|
||||
|
||||
#endif // PKMNLIB_WASMSPECIESREGISTRY_HPP
|
||||
|
|
|
@ -39,7 +39,7 @@ wasm_func_t* CreatePrintFunc(WebAssemblyScriptResolver* resolver) {
|
|||
}
|
||||
|
||||
void WASMCoreMethods::Register(ArbUt::Dictionary<std::string, wasm_func_t*>& externs,
|
||||
WebAssemblyScriptResolver* resolver) {
|
||||
WebAssemblyScriptResolver* resolver) {
|
||||
externs.Insert("_error", CreateErrorFunc(resolver));
|
||||
externs.Insert("_print", CreatePrintFunc(resolver));
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ public:
|
|||
WasmExternRef(T* ptr) : _ptr(ptr) {}
|
||||
|
||||
[[nodiscard]] inline T* GetPtr() const noexcept { return _ptr; }
|
||||
|
||||
private:
|
||||
T* _ptr;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue