Adds ModifyNumberOfHits Angelscript script hook.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-03-28 19:58:08 +02:00
parent c89c572aa2
commit 14016837d9
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
4 changed files with 9 additions and 1 deletions

View File

@ -294,3 +294,9 @@ void AngelScriptScript::PreventOpponentSwitch(const CreatureLib::Battling::Switc
void AngelScriptScript::OnEndTurn(CreatureLib::Battling::Creature* creature) { void AngelScriptScript::OnEndTurn(CreatureLib::Battling::Creature* creature) {
CALL_HOOK(OnEndTurn, { ctx->SetArgObject(0, (void*)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);
})
}

View File

@ -48,6 +48,7 @@ public:
void ChangeAttack(CreatureLib::Battling::AttackTurnChoice* choice, ArbUt::StringView* outAttack) override; 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 PreventAttack(CreatureLib::Battling::ExecutingAttack* attack, bool* outResult) override;
void FailAttack(CreatureLib::Battling::ExecutingAttack* attack, bool* outFailed) override; void FailAttack(CreatureLib::Battling::ExecutingAttack* attack, bool* outFailed) override;
@ -123,7 +124,6 @@ public:
uint32_t* experienceGain) override; uint32_t* experienceGain) override;
void DoesShareExperience(CreatureLib::Battling::Creature* faintedMon, CreatureLib::Battling::Creature* winningMon, void DoesShareExperience(CreatureLib::Battling::Creature* faintedMon, CreatureLib::Battling::Creature* winningMon,
bool* shareExperience) override; bool* shareExperience) override;
}; };
#undef CALL_HOOK #undef CALL_HOOK

View File

@ -76,6 +76,7 @@ public:
SCRIPT_HOOK_FUNCTION(OnBeforeTurn, "void OnBeforeTurn(BaseTurnChoice@ choice)"); SCRIPT_HOOK_FUNCTION(OnBeforeTurn, "void OnBeforeTurn(BaseTurnChoice@ choice)");
SCRIPT_HOOK_FUNCTION(ChangeAttack, "void ChangeAttack(MoveTurnChoice@ choice, constString& changedMove)"); 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(PreventAttack, "void PreventAttack(ExecutingMove@ attack, bool& result)");
SCRIPT_HOOK_FUNCTION(FailAttack, "void FailAttack(ExecutingMove@ attack, bool& result)"); SCRIPT_HOOK_FUNCTION(FailAttack, "void FailAttack(ExecutingMove@ attack, bool& result)");
SCRIPT_HOOK_FUNCTION(StopBeforeAttack, "void StopBeforeAttack(ExecutingMove@ attack, bool& result)"); SCRIPT_HOOK_FUNCTION(StopBeforeAttack, "void StopBeforeAttack(ExecutingMove@ attack, bool& result)");

View File

@ -11,6 +11,7 @@ shared abstract class PkmnScript {
void OnRemove(){}; void OnRemove(){};
void OnBeforeTurn(BaseTurnChoice@ choice){}; void OnBeforeTurn(BaseTurnChoice@ choice){};
void ChangeAttack(MoveTurnChoice@ choice, constString& changedMove){}; void ChangeAttack(MoveTurnChoice@ choice, constString& changedMove){};
void ModifyNumberOfHits(MoveTurnChoice@ choice, uint8& result){};
void PreventAttack(ExecutingMove@ attack, bool& result){}; void PreventAttack(ExecutingMove@ attack, bool& result){};
void FailAttack(ExecutingMove@ attack, bool& result){}; void FailAttack(ExecutingMove@ attack, bool& result){};
void StopBeforeAttack(ExecutingMove@ attack, bool& result){}; void StopBeforeAttack(ExecutingMove@ attack, bool& result){};