From ea3bc7ee337de328a42e7bfe1cac419e56c52b43 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 19 Nov 2021 13:10:30 +0100 Subject: [PATCH] Adds GetLastUsedAttackOnTargetWrapper wrapper function to Angelscript. --- .../TypeRegistry/Battling/RegisterBattleHistory.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterBattleHistory.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterBattleHistory.cpp index a904b76..71d5ee4 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterBattleHistory.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/Battling/RegisterBattleHistory.cpp @@ -61,6 +61,10 @@ const HistoryElement* GetLastUsedAttackWrapper(const HistoryHolder* holder, u32 return holder->GetLastUsedAttack(maxTurns).GetValue(); } +const HistoryElement* GetLastUsedAttackOnTargetWrapper(const HistoryHolder* holder, Creature* target, u32 maxTurns) { + return holder->GetLastUsedAttackOnTarget(target, maxTurns).GetValue(); +} + const HistoryElement* GetLastDamageOnTargetWrapper(const HistoryHolder* holder, const Creature* c, u32 maxTurns) { return holder->GetLastDamageOnTarget(c, maxTurns).GetValue(); } @@ -72,6 +76,10 @@ void RegisterBattleHistory::RegisterHistoryHolder(asIScriptEngine* engine) { Ensure(engine->RegisterObjectMethod("BattleHistory", "const AttackUseHistory@ GetLastUsedAttack(uint maxTurns = 0) const", asFunctionPtr(GetLastUsedAttackWrapper), asCALL_CDECL_OBJFIRST) >= 0); + Ensure(engine->RegisterObjectMethod( + "BattleHistory", + "const AttackUseHistory@ GetLastUsedAttackOnTarget(Pokemon@ target, uint maxTurns = 0) const", + asFunctionPtr(GetLastUsedAttackOnTargetWrapper), asCALL_CDECL_OBJFIRST) >= 0); Ensure(engine->RegisterObjectMethod( "BattleHistory", "const DamageHistory@ GetLastDamageOnTarget(Pokemon@ target, uint maxTurns = 0) const", asFunctionPtr(GetLastDamageOnTargetWrapper), asCALL_CDECL_OBJFIRST) >= 0);