Implements new standard macro/function for registering getters in Angelscript, to reduce the amount of errors there.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-09-21 22:37:13 +02:00
parent a43dc45665
commit 2e8cf4379b
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
5 changed files with 128 additions and 142 deletions

View File

@ -1,5 +1,6 @@
#include "RegisterBattleLibrary.hpp"
#include "../../../../Battling/Library/BattleLibrary.hpp"
#include "../HelperFile.hpp"
void RegisterBattleLibrary::Register(asIScriptEngine* engine) {
RegisterDamageLibrary(engine);
@ -14,24 +15,18 @@ void RegisterBattleLibrary::RegisterDamageLibrary(asIScriptEngine* engine) {
}
void RegisterBattleLibrary::RegisterLibrary(asIScriptEngine* engine) {
[[maybe_unused]] int r = engine->RegisterObjectType("BattleLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
assert(r >= 0);
r = engine->RegisterObjectMethod("BattleLibrary", "const LibrarySettings@ get_Settings() const property",
asMETHOD(PkmnLib::Battling::BattleLibrary, GetSettings), asCALL_THISCALL);
assert(r >= 0);
r = engine->RegisterObjectMethod("BattleLibrary", "const StaticLibrary@ get_StaticLibrary() const property",
asMETHOD(PkmnLib::Battling::BattleLibrary, GetStaticLib), asCALL_THISCALL);
assert(r >= 0);
r = engine->RegisterObjectMethod("BattleLibrary", "const SpeciesLibrary@ get_SpeciesLibrary() const property",
asMETHOD(PkmnLib::Battling::BattleLibrary, GetSpeciesLibrary), asCALL_THISCALL);
assert(r >= 0);
r = engine->RegisterObjectMethod("BattleLibrary", "const MoveLibrary@ get_MoveLibrary() const property",
asMETHOD(PkmnLib::Battling::BattleLibrary, GetMoveLibrary), asCALL_THISCALL);
assert(r >= 0);
r = engine->RegisterObjectMethod("BattleLibrary", "const ItemLibrary@ get_ItemLibrary() const property",
asMETHOD(PkmnLib::Battling::BattleLibrary, GetItemLibrary), asCALL_THISCALL);
assert(r >= 0);
r = engine->RegisterObjectMethod("BattleLibrary", "const DamageLibrary@ get_DamageLibrary() const property",
asMETHOD(PkmnLib::Battling::BattleLibrary, GetDamageLibrary), asCALL_THISCALL);
assert(r >= 0);
Ensure(engine->RegisterObjectType("BattleLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT) >= 0);
REGISTER_GETTER("BattleLibrary", "const LibrarySettings@ get_Settings() const property",
PkmnLib::Battling::BattleLibrary, GetSettings);
REGISTER_GETTER("BattleLibrary", "const StaticLibrary@ get_StaticLibrary() const property",
PkmnLib::Battling::BattleLibrary, GetStaticLib);
REGISTER_GETTER("BattleLibrary", "const SpeciesLibrary@ get_SpeciesLibrary() const property",
PkmnLib::Battling::BattleLibrary, GetSpeciesLibrary);
REGISTER_GETTER("BattleLibrary", "const MoveLibrary@ get_MoveLibrary() const property",
PkmnLib::Battling::BattleLibrary, GetMoveLibrary);
REGISTER_GETTER("BattleLibrary", "const ItemLibrary@ get_ItemLibrary() const property",
PkmnLib::Battling::BattleLibrary, GetItemLibrary);
REGISTER_GETTER("BattleLibrary", "const DamageLibrary@ get_DamageLibrary() const property",
CreatureLib::Battling::BattleLibrary, GetDamageLibrary);
}

View File

@ -88,17 +88,6 @@ static std::string NicknameWrapper(const PkmnLib::Battling::Pokemon* obj) {
return std::string(obj->GetNickname().value());
}
BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const CreatureLib::Library::CreatureSpecies, GetSpecies);
BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const PkmnLib::Library::PokemonForme, GetForme);
OPTIONAL_BORROWED_PTR_GETTER_FUNC(CreatureLib::Battling::Creature, const CreatureLib::Library::CreatureSpecies,
GetDisplaySpecies);
OPTIONAL_BORROWED_PTR_GETTER_FUNC(CreatureLib::Battling::Creature, const CreatureLib::Library::SpeciesVariant,
GetDisplayVariant);
OPTIONAL_BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const CreatureLib::Library::Item, GetHeldItem);
OPTIONAL_BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, CreatureLib::Battling::Battle, GetBattle);
OPTIONAL_BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, CreatureLib::Battling::BattleSide, GetBattleSide);
static CScriptHandle AddVolatileWrapper(PkmnLib::Battling::Pokemon* obj, const ArbUt::StringView& name) {
auto handle = CScriptHandle();
auto* resolver = static_cast<AngelScriptResolver*>(obj->GetLibrary()->GetScriptResolver().get());
@ -108,32 +97,36 @@ static CScriptHandle AddVolatileWrapper(PkmnLib::Battling::Pokemon* obj, const A
}
void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
[[maybe_unused]] int r = engine->RegisterObjectType("Pokemon", 0, asOBJ_REF | asOBJ_NOCOUNT);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "const Species@ get_Species() const property",
asFUNCTION(GetSpeciesWrapper), asCALL_CDECL_OBJLAST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "const Forme@ get_Forme() const property", asFUNCTION(GetFormeWrapper),
asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "uint8 get_Level() const property",
asMETHOD(PkmnLib::Battling::Pokemon, GetLevel), asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "uint32 get_Experience() const property",
asMETHOD(PkmnLib::Battling::Pokemon, GetExperience), asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "Gender get_Gender() const property", asFUNCTION(Pkmn_GenderWrapper),
asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "uint8 get_Coloring() const property",
asMETHOD(PkmnLib::Battling::Pokemon, GetColoring), asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "bool get_Shiny() const property",
asMETHOD(PkmnLib::Battling::Pokemon, IsShiny), asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "const Item@ get_HeldItem() const property",
asFUNCTION(GetHeldItemWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
int r;
Ensure(engine->RegisterObjectType("Pokemon", 0, asOBJ_REF | asOBJ_NOCOUNT) >= 0);
REGISTER_GETTER("Pokemon", "const Species@ get_Species() const property", CreatureLib::Battling::Creature,
GetSpecies);
REGISTER_GETTER("Pokemon", "const Forme@ get_Forme() const property", CreatureLib::Battling::Creature, GetVariant);
REGISTER_GETTER("Pokemon", "uint8 get_Level() const property", CreatureLib::Battling::Creature, GetLevel);
REGISTER_GETTER("Pokemon", "uint32 get_Experience() const property", CreatureLib::Battling::Creature,
GetExperience);
REGISTER_GETTER("Pokemon", "Gender get_Gender() const property", CreatureLib::Battling::Creature, GetGender);
REGISTER_GETTER("Pokemon", "uint8 get_Coloring() const property", CreatureLib::Battling::Creature, GetColoring);
REGISTER_GETTER("Pokemon", "bool get_Shiny() const property", PkmnLib::Battling::Pokemon, IsShiny);
REGISTER_GETTER("Pokemon", "const Item@ get_HeldItem() const property", CreatureLib::Battling::Creature,
GetHeldItem);
REGISTER_GETTER("Pokemon", "uint32 get_CurrentHealth() const property", CreatureLib::Battling::Creature,
GetCurrentHealth);
REGISTER_GETTER("Pokemon", "const constString& get_ActiveAbility() const property", CreatureLib::Battling::Creature,
GetActiveTalent);
REGISTER_GETTER("Pokemon", "bool get_IsFainted() const property", CreatureLib::Battling::Creature, IsFainted);
REGISTER_GETTER("Pokemon", "uint32 get_MaxHealth() const property", CreatureLib::Battling::Creature, GetMaxHealth);
REGISTER_GETTER("Pokemon", "const Species@ get_DisplaySpecies() const property", CreatureLib::Battling::Creature,
GetDisplaySpecies);
REGISTER_GETTER("Pokemon", "const Species@ get_DisplayForme() const property", CreatureLib::Battling::Creature,
GetDisplayVariant);
REGISTER_GETTER("Pokemon", "Battle@ get_Battle() const property", CreatureLib::Battling::Creature, GetBattle);
REGISTER_GETTER("Pokemon", "BattleSide@ get_BattleSide() const property", CreatureLib::Battling::Creature,
GetBattleSide);
REGISTER_GETTER("Pokemon", "const constString& get_Status() const property", CreatureLib::Battling::Creature,
GetStatusName);
r = engine->RegisterObjectMethod("Pokemon", "bool HasHeldItem(const constString &in name) const",
asFUNCTION(HasHeldItem), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
@ -145,24 +138,12 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
(const ArbUt::BorrowedPtr<const CreatureLib::Library::Item>&), void),
asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "uint32 get_CurrentHealth() const property",
asMETHOD(PkmnLib::Battling::Pokemon, GetCurrentHealth), asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "string get_Nickname() const property", asFUNCTION(NicknameWrapper),
asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "const constString& get_ActiveAbility() const property",
asMETHOD(PkmnLib::Battling::Pokemon, GetActiveTalent), asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "bool get_IsFainted() const property",
asMETHOD(PkmnLib::Battling::Pokemon, IsFainted), asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "bool HasType(uint8 type) const",
asMETHOD(PkmnLib::Battling::Pokemon, HasType), asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "uint32 get_MaxHealth() const property",
asMETHOD(PkmnLib::Battling::Pokemon, GetMaxHealth), asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "void Damage(uint32 type, DamageSource source)",
asMETHOD(PkmnLib::Battling::Pokemon, Damage), asCALL_THISCALL);
Ensure(r >= 0);
@ -178,12 +159,6 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
r = engine->RegisterObjectMethod("Pokemon", "void ChangeStatBoost(Statistic stat, int8 amount)",
asMETHOD(PkmnLib::Battling::Pokemon, ChangeStatBoost), asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "const Species@ get_DisplaySpecies() const property",
asFUNCTION(GetDisplaySpeciesWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "const Species@ get_DisplayForme() const property",
asFUNCTION(GetDisplayVariantWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "uint32 GetFlatStat(Statistic stat) const",
asMETHOD(PkmnLib::Battling::Pokemon, GetFlatStat), asCALL_THISCALL);
Ensure(r >= 0);
@ -205,15 +180,6 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "Battle@ get_Battle() const property", asFUNCTION(GetBattleWrapper),
asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "BattleSide@ get_BattleSide() const property",
asFUNCTION(GetBattleSideWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "const constString& get_Status() const property",
asMETHOD(PkmnLib::Battling::Pokemon, GetStatusName), asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "void ClearStatus() const",
asMETHOD(PkmnLib::Battling::Pokemon, ClearStatus), asCALL_THISCALL);
Ensure(r >= 0);

View File

@ -17,3 +17,51 @@
// 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) \
int32_t name(type* obj) { return static_cast<int32_t>(obj->func()); }
template <typename Test, template <typename...> class Ref> struct is_specialization : std::false_type {};
template <template <typename...> class Ref, typename... Args>
struct is_specialization<Ref<Args...>, Ref> : std::true_type {};
template <template <typename...> class Ref, typename... Args>
struct is_specialization<const Ref<Args...>&, Ref> : std::true_type {};
template <template <typename...> class Ref, typename... Args>
struct is_specialization<Ref<Args...>&, Ref> : std::true_type {};
template <typename T, typename R, R (T::*Method)() const>
void RegisterGetter(asIScriptEngine* engine, const char* asType, const char* asDef) {
if constexpr (std::is_enum<R>()) {
auto l = [](const T* p) { return (i32)(p->*Method)(); };
Ensure(engine->RegisterObjectMethod(asType, asDef, asFUNCTIONPR(l, (const T*), i32), asCALL_CDECL_OBJFIRST) >=
0);
} else if constexpr (is_specialization<R, ArbUt::BorrowedPtr>::value) {
auto l = [](const T* p) { return (void*)(p->*Method)().GetRaw(); };
Ensure(engine->RegisterObjectMethod(asType, asDef, asFUNCTIONPR(l, (const T*), void*), asCALL_CDECL_OBJFIRST) >=
0);
} else if constexpr (is_specialization<R, std::unique_ptr>::value) {
auto l = [](const T* p) { return (void*)(p->*Method)().get(); };
Ensure(engine->RegisterObjectMethod(asType, asDef, asFUNCTIONPR(l, (const T*), void*), asCALL_CDECL_OBJFIRST) >=
0);
} else if constexpr (is_specialization<R, ArbUt::OptionalBorrowedPtr>::value) {
auto l = [](const T* p) {
auto v = (p->*Method)();
if (v.HasValue()) {
return (void*)v.GetValue();
}
return (void*)nullptr;
};
Ensure(engine->RegisterObjectMethod(asType, asDef, asFUNCTIONPR(l, (const T*), void*), asCALL_CDECL_OBJFIRST) >=
0);
} else if constexpr (std::is_reference<R>::value) {
static_assert(!std::is_enum<R>());
auto l = [](const T* p) { return (void*)&(p->*Method)(); };
Ensure(engine->RegisterObjectMethod(asType, asDef, asFUNCTIONPR(l, (const T*), void*), asCALL_CDECL_OBJFIRST) >=
0);
} else {
static_assert(!std::is_enum<R>());
auto l = [](const T* p) { return (p->*Method)(); };
Ensure(engine->RegisterObjectMethod(asType, asDef, asFUNCTIONPR(l, (const T*), R), asCALL_CDECL_OBJFIRST) >= 0);
}
}
#define REGISTER_GETTER(asType, asDef, cType, cFunc) \
RegisterGetter<cType, std::result_of<decltype (&cType::cFunc)(cType)>::type, &cType::cFunc>(engine, asType, asDef);

View File

@ -8,44 +8,27 @@ void RegisterStaticLibraryTypes::Register(asIScriptEngine* engine) {
}
void RegisterStaticLibraryTypes::RegisterLibrarySettingsType(asIScriptEngine* engine) {
[[maybe_unused]] int r = engine->RegisterObjectType("LibrarySettings", 0, asOBJ_REF | asOBJ_NOCOUNT);
r = engine->RegisterObjectMethod("LibrarySettings", "uint8 get_MaximalLevel() const property",
asMETHOD(PkmnLib::Library::LibrarySettings, GetMaximalLevel), asCALL_THISCALL);
assert(r >= 0);
r = engine->RegisterObjectMethod("LibrarySettings", "uint8 get_MaximalMoves() const property",
asMETHOD(PkmnLib::Library::LibrarySettings, GetMaximalAttacks), asCALL_THISCALL);
assert(r >= 0);
r = engine->RegisterObjectMethod("LibrarySettings", "uint16 get_ShinyRate() const property",
asMETHOD(PkmnLib::Library::LibrarySettings, GetShinyRate), asCALL_THISCALL);
assert(r >= 0);
Ensure(engine->RegisterObjectType("LibrarySettings", 0, asOBJ_REF | asOBJ_NOCOUNT) >= 0);
REGISTER_GETTER("LibrarySettings", "uint8 get_MaximalLevel() const property", CreatureLib::Library::LibrarySettings,
GetMaximalLevel);
REGISTER_GETTER("LibrarySettings", "uint8 get_MaximalMoves() const property", CreatureLib::Library::LibrarySettings,
GetMaximalAttacks);
REGISTER_GETTER("LibrarySettings", "uint16 get_ShinyRate() const property", PkmnLib::Library::LibrarySettings,
GetShinyRate);
}
UNIQUE_PTR_GETTER_FUNC(PkmnLib::Library::PokemonLibrary, const PkmnLib::Library::LibrarySettings, GetSettings);
UNIQUE_PTR_GETTER_FUNC(PkmnLib::Library::PokemonLibrary, const PkmnLib::Library::SpeciesLibrary, GetSpeciesLibrary);
UNIQUE_PTR_GETTER_FUNC(PkmnLib::Library::PokemonLibrary, const PkmnLib::Library::MoveLibrary, GetMoveLibrary);
UNIQUE_PTR_GETTER_FUNC(PkmnLib::Library::PokemonLibrary, const PkmnLib::Library::ItemLibrary, GetItemLibrary);
UNIQUE_PTR_GETTER_FUNC(PkmnLib::Library::PokemonLibrary, const CreatureLib::Library::GrowthRateLibrary, GetGrowthRates);
UNIQUE_PTR_GETTER_FUNC(PkmnLib::Library::PokemonLibrary, const CreatureLib::Library::TypeLibrary, GetTypeLibrary);
void RegisterStaticLibraryTypes::RegisterLibraryType(asIScriptEngine* engine) {
[[maybe_unused]] int r = engine->RegisterObjectType("StaticLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
assert(r >= 0);
r = engine->RegisterObjectMethod("StaticLibrary", "const LibrarySettings@ get_Settings() const property",
asFUNCTION(GetSettingsWrapper), asCALL_CDECL_OBJLAST);
assert(r >= 0);
r = engine->RegisterObjectMethod("StaticLibrary", "const SpeciesLibrary@ get_SpeciesLibrary() const property",
asFUNCTION(GetSpeciesLibraryWrapper), asCALL_CDECL_OBJLAST);
assert(r >= 0);
r = engine->RegisterObjectMethod("StaticLibrary", "const MoveLibrary@ get_MoveLibrary() const property",
asFUNCTION(GetMoveLibraryWrapper), asCALL_CDECL_OBJLAST);
assert(r >= 0);
r = engine->RegisterObjectMethod("StaticLibrary", "const ItemLibrary@ get_ItemLibrary() const property",
asFUNCTION(GetItemLibraryWrapper), asCALL_CDECL_OBJLAST);
assert(r >= 0);
r = engine->RegisterObjectMethod("StaticLibrary", "const GrowthRateLibrary@ get_GrowthRateLibrary() const property",
asFUNCTION(GetGrowthRatesWrapper), asCALL_CDECL_OBJLAST);
assert(r >= 0);
r = engine->RegisterObjectMethod("StaticLibrary", "const TypeLibrary@ get_TypeLibrary() const property",
asFUNCTION(GetTypeLibraryWrapper), asCALL_CDECL_OBJLAST);
assert(r >= 0);
Ensure(engine->RegisterObjectType("StaticLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT) >= 0);
REGISTER_GETTER("StaticLibrary", "const LibrarySettings@ get_Settings() const property",
CreatureLib::Library::DataLibrary, GetSettings);
REGISTER_GETTER("StaticLibrary", "const SpeciesLibrary@ get_SpeciesLibrary() const property",
CreatureLib::Library::DataLibrary, GetSpeciesLibrary);
REGISTER_GETTER("StaticLibrary", "const MoveLibrary@ get_MoveLibrary() const property",
CreatureLib::Library::DataLibrary, GetAttackLibrary);
REGISTER_GETTER("StaticLibrary", "const ItemLibrary@ get_ItemLibrary() const property",
CreatureLib::Library::DataLibrary, GetItemLibrary);
REGISTER_GETTER("StaticLibrary", "const GrowthRateLibrary@ get_GrowthRateLibrary() const property",
CreatureLib::Library::DataLibrary, GetGrowthRates);
REGISTER_GETTER("StaticLibrary", "const TypeLibrary@ get_TypeLibrary() const property",
CreatureLib::Library::DataLibrary, GetTypeLibrary);
}

View File

@ -187,21 +187,21 @@ TEST_CASE("Validate Pokemon CurrentHealth in Script") {
}
TEST_CASE("Validate Pokemon Nickname in Script") {
auto mainLib = TestLibrary::GetLibrary();
auto data = GetScript(mainLib, "testNickname"_cnc);
auto mainLib = TestLibrary::GetLibrary();
auto data = GetScript(mainLib, "testNickname"_cnc);
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
.WithForme("default"_cnc)
.WithGender(CreatureLib::Library::Gender::Male)
.WithNickname("foobar")
.Build();
data.Context->SetArgObject(0, (void*)mon);
auto name = std::string(mon->GetNickname().value());
data.Context->SetArgAddress(1, &name);
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies"_cnc, 30)
.WithForme("default"_cnc)
.WithGender(CreatureLib::Library::Gender::Male)
.WithNickname("foobar")
.Build();
data.Context->SetArgObject(0, (void*)mon);
auto name = std::string(mon->GetNickname().value());
data.Context->SetArgAddress(1, &name);
REQUIRE(data.Context->Execute() == asEXECUTION_FINISHED);
REQUIRE((bool)data.Context->GetReturnWord());
delete mon;
REQUIRE(data.Context->Execute() == asEXECUTION_FINISHED);
REQUIRE((bool)data.Context->GetReturnWord());
delete mon;
}
TEST_CASE("Validate Pokemon Active Ability in Script") {
@ -339,9 +339,7 @@ TEST_CASE("Validate Pokemon HasHeldItem in Script") {
TEST_CASE("Test Pokemon SetHeldItem in Script") {
auto mainLib = TestLibrary::GetLibrary();
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
.WithForme("default"_cnc)
.Build();
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30).WithForme("default"_cnc).Build();
auto data = GetScript(mainLib, "testSetHeldItem"_cnc);
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
@ -357,9 +355,7 @@ TEST_CASE("Test Pokemon SetHeldItem in Script") {
TEST_CASE("Test Pokemon SetHeldItem2 in Script") {
auto mainLib = TestLibrary::GetLibrary();
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30)
.WithForme("default"_cnc)
.Build();
auto mon = PkmnLib::Battling::CreatePokemon(mainLib, "testSpecies3"_cnc, 30).WithForme("default"_cnc).Build();
auto data = GetScript(mainLib, "testSetHeldItem2"_cnc);
data.Context->SetArgObject(0, const_cast<PkmnLib::Battling::Pokemon*>(mon));
@ -369,6 +365,4 @@ TEST_CASE("Test Pokemon SetHeldItem2 in Script") {
delete mon;
}
#endif