diff --git a/src/ScriptResolving/AngelScript/AngelScriptScript.cpp b/src/ScriptResolving/AngelScript/AngelScriptScript.cpp index 1827dd2..6a29c1d 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptScript.cpp +++ b/src/ScriptResolving/AngelScript/AngelScriptScript.cpp @@ -116,6 +116,16 @@ void AngelScriptScript::ChangeEffectiveness(CreatureLib::Battling::ExecutingAtta ctx->SetArgAddress(3, effectiveness); }) } +void AngelScriptScript::BlockCritical(CreatureLib::Battling::ExecutingAttack* attack, + CreatureLib::Battling::Creature* target, uint8_t hitNumber, bool* blockCritical) { + CALL_HOOK(BlockCritical, { + ctx->SetArgObject(0, (void*)attack); + ctx->SetArgObject(1, (void*)target); + ctx->SetArgByte(2, hitNumber); + ctx->SetArgAddress(3, blockCritical); + }) +} + void AngelScriptScript::PreventSecondaryEffects(const CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, uint8_t hitNumber, bool* outResult) { diff --git a/src/ScriptResolving/AngelScript/AngelScriptScript.hpp b/src/ScriptResolving/AngelScript/AngelScriptScript.hpp index 84a8db7..7c232bc 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptScript.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptScript.hpp @@ -74,6 +74,8 @@ public: void ChangeAttackType(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, uint8_t hitNumber, uint8_t* outType) override; + void BlockCritical(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, + uint8_t hitNumber, bool* blockCritical) override; void ChangeEffectiveness(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, uint8_t hitNumber, float* effectiveness) override; diff --git a/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp b/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp index 16d676b..99bb734 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp @@ -110,6 +110,8 @@ public: SCRIPT_HOOK_FUNCTION( ChangeEffectiveness, "void ChangeEffectiveness(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& effectiveness)"); + SCRIPT_HOOK_FUNCTION(BlockCritical, + "void BlockCritical(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& blockCritical)"); SCRIPT_HOOK_FUNCTION( PreventSecondaryEffects, "void PreventSecondaryEffects(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& outResult)"); @@ -169,7 +171,6 @@ public: SCRIPT_HOOK_FUNCTION(OnFaint, "void OnFaint(Pokemon@ pokemon, DamageSource damageSource)"); SCRIPT_HOOK_FUNCTION(BlockWeather, "void BlockWeather(Battle@ battle, bool& result)"); SCRIPT_HOOK_FUNCTION(OnSwitchIn, "void OnSwitchIn(Pokemon@ pokemon)"); - }; #undef SCRIPT_HOOK_FUNCTION diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp index 4124362..1fd58db 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp @@ -26,6 +26,7 @@ shared abstract class PkmnScript { void OnAttackMiss(ExecutingMove@ attack, Pokemon@ target){}; void ChangeAttackType(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& outType){}; void ChangeEffectiveness(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& effectiveness){}; + void BlockCritical(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& blockCritical){}; void OnIncomingHit(ExecutingMove@ attack, Pokemon@ target, uint8 hit){}; void PreventSecondaryEffects(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& outResult){}; void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit){};