Style Fixes
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
d5ef7a33f8
commit
5a082c5995
|
@ -56,8 +56,7 @@ export void PkmnLib_Pokemon_ChangeFriendship(Pokemon* p, i8 amount) { p->ChangeF
|
||||||
SIMPLE_GET_FUNC(Pokemon, IsEgg, bool)
|
SIMPLE_GET_FUNC(Pokemon, IsEgg, bool)
|
||||||
export void PkmnLib_Pokemon_SetIsEgg(Pokemon* p, bool value) { p->SetIsEgg(value); }
|
export void PkmnLib_Pokemon_SetIsEgg(Pokemon* p, bool value) { p->SetIsEgg(value); }
|
||||||
|
|
||||||
|
|
||||||
export u8 PkmnLib_Pokemon_Evolve(Pokemon* p, const PkmnLib::Library::PokemonSpecies* species,
|
export 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);)
|
Try(p->Evolve(species, forme);)
|
||||||
}
|
}
|
|
@ -7,13 +7,8 @@ export const SpeciesLibrary* PkmnLib_SpeciesLibrary_Construct(size_t initialCapa
|
||||||
};
|
};
|
||||||
|
|
||||||
export u8 PkmnLib_SpeciesLibrary_FindPreEvolution(const PokemonSpecies*& out, const SpeciesLibrary* p,
|
export u8 PkmnLib_SpeciesLibrary_FindPreEvolution(const PokemonSpecies*& out, const SpeciesLibrary* p,
|
||||||
const PokemonSpecies* species) {
|
const PokemonSpecies* species) {
|
||||||
Try(
|
Try(
|
||||||
auto v = p->FindPreEvolution(species);
|
auto v = p->FindPreEvolution(species);
|
||||||
if (!v.has_value()){
|
if (!v.has_value()) { out = nullptr; } else { out = v.value().GetRaw(); })
|
||||||
out = nullptr;
|
|
||||||
} else {
|
|
||||||
out = v.value().GetRaw();
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
|
@ -65,10 +65,9 @@ bool PkmnLib::Battling::MiscLibrary::CanEvolveFromLevelUp(
|
||||||
case Library::EvolutionMethod::IsGenderAndLevel:
|
case Library::EvolutionMethod::IsGenderAndLevel:
|
||||||
return pokemon->GetLevel() >= evolution->GetData(1)->AsInt() &&
|
return pokemon->GetLevel() >= evolution->GetData(1)->AsInt() &&
|
||||||
pokemon->GetGender() == (CreatureLib::Library::Gender)evolution->GetData(0)->AsInt();
|
pokemon->GetGender() == (CreatureLib::Library::Gender)evolution->GetData(0)->AsInt();
|
||||||
case Library::EvolutionMethod::Custom:
|
case Library::EvolutionMethod::Custom: {
|
||||||
{
|
|
||||||
auto script = dynamic_cast<ScriptResolver*>(pokemon->GetLibrary()->GetScriptResolver().get())
|
auto script = dynamic_cast<ScriptResolver*>(pokemon->GetLibrary()->GetScriptResolver().get())
|
||||||
->LoadEvolutionScript(evolution->GetData(0)->AsString());
|
->LoadEvolutionScript(evolution->GetData(0)->AsString());
|
||||||
if (!script.HasValue()) {
|
if (!script.HasValue()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace PkmnLib::Battling {
|
||||||
CreatureLib::Battling::CreatureIndex target) const override;
|
CreatureLib::Battling::CreatureIndex target) const override;
|
||||||
|
|
||||||
bool CanEvolveFromLevelUp(const ArbUt::BorrowedPtr<const PkmnLib::Library::EvolutionData>& evolution,
|
bool CanEvolveFromLevelUp(const ArbUt::BorrowedPtr<const PkmnLib::Library::EvolutionData>& evolution,
|
||||||
const ArbUt::BorrowedPtr<const Pokemon>& pokemon);
|
const ArbUt::BorrowedPtr<const Pokemon>& pokemon);
|
||||||
|
|
||||||
inline PkmnLib::Library::TimeOfDay GetTime() const noexcept { return _getTime(); }
|
inline PkmnLib::Library::TimeOfDay GetTime() const noexcept { return _getTime(); }
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
namespace PkmnLib::Library {
|
namespace PkmnLib::Library {
|
||||||
ENUM(EvolutionMethod, uint8_t, Level, HighFriendship, HighFriendshipTime, KnownMove, LocationBased, TimeBased,
|
ENUM(EvolutionMethod, uint8_t, Level, HighFriendship, HighFriendshipTime, KnownMove, LocationBased, TimeBased,
|
||||||
HoldsItem, HoldsItemTime, IsGenderAndLevel, EvolutionItemUse, EvolutionItemUseWithGender, Trade, TradeWithHeldItem,
|
HoldsItem, HoldsItemTime, IsGenderAndLevel, EvolutionItemUse, EvolutionItemUseWithGender, Trade,
|
||||||
TradeWithSpecificPokemon, Custom)
|
TradeWithHeldItem, TradeWithSpecificPokemon, Custom)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // PKMNLIB_EVOLUTIONMETHOD_HPP
|
#endif // PKMNLIB_EVOLUTIONMETHOD_HPP
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace PkmnLib::Library {
|
||||||
}
|
}
|
||||||
for (const auto& s : _values) {
|
for (const auto& s : _values) {
|
||||||
const auto* pkmn = dynamic_cast<const PokemonSpecies*>(s.second.get());
|
const auto* pkmn = dynamic_cast<const PokemonSpecies*>(s.second.get());
|
||||||
if (pkmn == nullptr){
|
if (pkmn == nullptr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (const auto& evo : pkmn->GetEvolutions()) {
|
for (const auto& evo : pkmn->GetEvolutions()) {
|
||||||
|
|
|
@ -34,8 +34,7 @@ private:
|
||||||
static i32 IncludeCallback(const char* include, const char* from, CScriptBuilder* builder, void* userParam);
|
static i32 IncludeCallback(const char* include, const char* from, CScriptBuilder* builder, void* userParam);
|
||||||
|
|
||||||
void RegisterTypes();
|
void RegisterTypes();
|
||||||
void
|
void InitializeByteCode(const ArbUt::Dictionary<i16, ArbUt::Dictionary<ArbUt::StringView, uint32_t>>& types);
|
||||||
InitializeByteCode(const ArbUt::Dictionary<i16, ArbUt::Dictionary<ArbUt::StringView, uint32_t>>& types);
|
|
||||||
void RegisterScriptType(asITypeInfo* typeInfo, const ArbUt::StringView& metadataKind,
|
void RegisterScriptType(asITypeInfo* typeInfo, const ArbUt::StringView& metadataKind,
|
||||||
const ArbUt::StringView& effectName);
|
const ArbUt::StringView& effectName);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "RegisterParty.hpp"
|
#include "RegisterParty.hpp"
|
||||||
|
#include <CreatureLib/Battling/Models/BattleParty.hpp>
|
||||||
#include "../../../../Battling/Pokemon/PokemonParty.hpp"
|
#include "../../../../Battling/Pokemon/PokemonParty.hpp"
|
||||||
#include "../HelperFile.hpp"
|
#include "../HelperFile.hpp"
|
||||||
#include <CreatureLib/Battling/Models/BattleParty.hpp>
|
|
||||||
|
|
||||||
void RegisterParty::Register(asIScriptEngine* engine) {
|
void RegisterParty::Register(asIScriptEngine* engine) {
|
||||||
RegisterPartyClass(engine);
|
RegisterPartyClass(engine);
|
||||||
|
|
|
@ -45,8 +45,8 @@ void RegisterTurnChoices::RegisterMoveTurnChoice(asIScriptEngine* engine) {
|
||||||
r = engine->RegisterObjectMethod("MoveTurnChoice", "TurnChoiceKind get_Kind() const property",
|
r = engine->RegisterObjectMethod("MoveTurnChoice", "TurnChoiceKind get_Kind() const property",
|
||||||
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetKind), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetKind), asCALL_THISCALL);
|
||||||
Ensure(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveTurnChoice", "Pokemon@ get_User() const property",
|
r = engine->RegisterObjectMethod("MoveTurnChoice", "Pokemon@ get_User() const property", asFUNCTION(GetUserWrapper),
|
||||||
asFUNCTION(GetUserWrapper), asCALL_CDECL_OBJFIRST);
|
asCALL_CDECL_OBJFIRST);
|
||||||
Ensure(r >= 0);
|
Ensure(r >= 0);
|
||||||
r = engine->RegisterObjectMethod("MoveTurnChoice", "LearnedMove@ get_Move() const property",
|
r = engine->RegisterObjectMethod("MoveTurnChoice", "LearnedMove@ get_Move() const property",
|
||||||
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetAttack), asCALL_THISCALL);
|
asMETHOD(CreatureLib::Battling::AttackTurnChoice, GetAttack), asCALL_THISCALL);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#define UNIQUE_PTR_GETTER_FUNC(o, returns, funcName) \
|
#define UNIQUE_PTR_GETTER_FUNC(o, returns, funcName) \
|
||||||
static returns* funcName##Wrapper(o* obj) { return obj->funcName().get(); }
|
static returns* funcName##Wrapper(o* obj) { return obj->funcName().get(); }
|
||||||
|
|
||||||
#define REGISTER_ENUM(enumName, asName) \
|
#define REGISTER_ENUM(enumName, asName) \
|
||||||
{ \
|
{ \
|
||||||
auto __r = engine->RegisterEnum(asName); \
|
auto __r = engine->RegisterEnum(asName); \
|
||||||
Ensure(__r >= 0); \
|
Ensure(__r >= 0); \
|
||||||
|
@ -16,5 +16,4 @@
|
||||||
}
|
}
|
||||||
// Hack to handle AngelScript not recognizing different sized enums on fields, and returning invalid values due to it.
|
// Hack to handle AngelScript not recognizing different sized enums on fields, and returning invalid values due to it.
|
||||||
#define ENUM__SIZE_WRAPPER(name, type, func) \
|
#define ENUM__SIZE_WRAPPER(name, type, func) \
|
||||||
int32_t name(type* obj) { return static_cast<int32_t>(obj->func()); }
|
int32_t name(type* obj) { return static_cast<int32_t>(obj->func()); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue