diff --git a/src/ScriptResolving/AngelScript/AngelScriptScript.cpp b/src/ScriptResolving/AngelScript/AngelScriptScript.cpp index 9f787f0..6c8217a 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptScript.cpp +++ b/src/ScriptResolving/AngelScript/AngelScriptScript.cpp @@ -294,3 +294,9 @@ void AngelScriptScript::PreventOpponentSwitch(const CreatureLib::Battling::Switc void AngelScriptScript::OnEndTurn(CreatureLib::Battling::Creature* creature) { CALL_HOOK(OnEndTurn, { ctx->SetArgObject(0, (void*)creature); }) } +void AngelScriptScript::ModifyNumberOfHits(CreatureLib::Battling::AttackTurnChoice* choice, u8* numberOfHits) { + CALL_HOOK(ModifyNumberOfHits, { + ctx->SetArgObject(0, (void*)choice); + ctx->SetArgAddress(1, numberOfHits); + }) +} diff --git a/src/ScriptResolving/AngelScript/AngelScriptScript.hpp b/src/ScriptResolving/AngelScript/AngelScriptScript.hpp index 778214d..2c7950d 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptScript.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptScript.hpp @@ -48,6 +48,7 @@ public: void ChangeAttack(CreatureLib::Battling::AttackTurnChoice* choice, ArbUt::StringView* outAttack) override; + void ModifyNumberOfHits(CreatureLib::Battling::AttackTurnChoice* choice, u8* numberOfHits) override; void PreventAttack(CreatureLib::Battling::ExecutingAttack* attack, bool* outResult) override; void FailAttack(CreatureLib::Battling::ExecutingAttack* attack, bool* outFailed) override; @@ -123,7 +124,6 @@ public: uint32_t* experienceGain) override; void DoesShareExperience(CreatureLib::Battling::Creature* faintedMon, CreatureLib::Battling::Creature* winningMon, bool* shareExperience) override; - }; #undef CALL_HOOK diff --git a/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp b/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp index c40f1b5..23edd50 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp @@ -76,6 +76,7 @@ public: SCRIPT_HOOK_FUNCTION(OnBeforeTurn, "void OnBeforeTurn(BaseTurnChoice@ choice)"); SCRIPT_HOOK_FUNCTION(ChangeAttack, "void ChangeAttack(MoveTurnChoice@ choice, constString& changedMove)"); + SCRIPT_HOOK_FUNCTION(ModifyNumberOfHits, "void ModifyNumberOfHits(MoveTurnChoice@ choice, uint8& result)"); SCRIPT_HOOK_FUNCTION(PreventAttack, "void PreventAttack(ExecutingMove@ attack, bool& result)"); SCRIPT_HOOK_FUNCTION(FailAttack, "void FailAttack(ExecutingMove@ attack, bool& result)"); SCRIPT_HOOK_FUNCTION(StopBeforeAttack, "void StopBeforeAttack(ExecutingMove@ attack, bool& result)"); diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp index 4a6b474..d4f495b 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp @@ -11,6 +11,7 @@ shared abstract class PkmnScript { void OnRemove(){}; void OnBeforeTurn(BaseTurnChoice@ choice){}; void ChangeAttack(MoveTurnChoice@ choice, constString& changedMove){}; + void ModifyNumberOfHits(MoveTurnChoice@ choice, uint8& result){}; void PreventAttack(ExecutingMove@ attack, bool& result){}; void FailAttack(ExecutingMove@ attack, bool& result){}; void StopBeforeAttack(ExecutingMove@ attack, bool& result){};