diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterBattleClass.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterBattleClass.cpp index 5cb91d6..df5117e 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterBattleClass.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterBattleClass.cpp @@ -77,6 +77,10 @@ static u8 GetPokemonIndexWrapper(CreatureLib::Battling::BattleSide* obj, PkmnLib return obj->GetCreatureIndex(pokemon); } +static PkmnLib::Battling::Pokemon* GetPokemonWrapper(CreatureLib::Battling::BattleSide* obj, u8 index) { + return dynamic_cast(obj->GetCreature(index).GetValue()); +} + void RegisterBattleClass::RegisterBattleSide(asIScriptEngine* engine) { int r = engine->RegisterObjectMethod( "BattleSide", "bool SwapPositions(uint8 a, uint8 b)", @@ -88,6 +92,9 @@ void RegisterBattleClass::RegisterBattleSide(asIScriptEngine* engine) { r = engine->RegisterObjectMethod("BattleSide", "uint8 GetPokemonIndex(const Pokemon@ pokemon) const", asFUNCTION(GetPokemonIndexWrapper), asCALL_CDECL_OBJFIRST); Ensure(r >= 0); + r = engine->RegisterObjectMethod("BattleSide", "Pokemon@ GetPokemon(uint8 index) const", + asFUNCTION(GetPokemonWrapper), asCALL_CDECL_OBJFIRST); + Ensure(r >= 0); } void RegisterBattleClass::RegisterBattle(asIScriptEngine* engine) {