Adds ChangeSpeed script hook to Angelscript
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2022-02-19 16:21:29 +01:00
parent f7c881b4e7
commit 817bf387ac
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
4 changed files with 10 additions and 3 deletions

View File

@ -440,3 +440,9 @@ void AngelScriptScript::OnAfterHeldItemConsume(CreatureLib::Battling::Creature*
ctx->SetArgObject(1, (void*)item); ctx->SetArgObject(1, (void*)item);
}); });
} }
void AngelScriptScript::ChangeSpeed(CreatureLib::Battling::BaseTurnChoice* choice, uint32_t* speed) {
CALL_HOOK(ChangeSpeed, {
ctx->SetArgObject(0, (void*)choice);
ctx->SetArgAddress(1, (void*)speed);
});
}

View File

@ -121,6 +121,7 @@ public:
void OverrideIncomingDamage(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, void OverrideIncomingDamage(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target,
uint8_t hitIndex, uint32_t* damage) override; uint8_t hitIndex, uint32_t* damage) override;
void ChangeSpeed(CreatureLib::Battling::BaseTurnChoice* choice, uint32_t* speed) override;
void ChangePriority(CreatureLib::Battling::AttackTurnChoice* choice, int8_t* priority) override; void ChangePriority(CreatureLib::Battling::AttackTurnChoice* choice, int8_t* priority) override;
void OnFail(CreatureLib::Battling::Creature* target) override; void OnFail(CreatureLib::Battling::Creature* target) override;
void OnOpponentFail(CreatureLib::Battling::Creature* target) override; void OnOpponentFail(CreatureLib::Battling::Creature* target) override;

View File

@ -169,6 +169,7 @@ public:
SCRIPT_HOOK_FUNCTION(DoesShareExperience, SCRIPT_HOOK_FUNCTION(DoesShareExperience,
"void DoesShareExperience(Pokemon@ faintedMon, Pokemon@ winningMon, bool& shareExperience)"); "void DoesShareExperience(Pokemon@ faintedMon, Pokemon@ winningMon, bool& shareExperience)");
SCRIPT_HOOK_FUNCTION(ChangeSpeed, "void ChangeSpeed(BaseTurnChoice@ choice, uint32& speed)");
SCRIPT_HOOK_FUNCTION(ChangePriority, "void ChangePriority(MoveTurnChoice@ choice, int8& priority)"); SCRIPT_HOOK_FUNCTION(ChangePriority, "void ChangePriority(MoveTurnChoice@ choice, int8& priority)");
SCRIPT_HOOK_FUNCTION(OnFail, "void OnFail(Pokemon@ user)"); SCRIPT_HOOK_FUNCTION(OnFail, "void OnFail(Pokemon@ user)");
SCRIPT_HOOK_FUNCTION(OnOpponentFail, "void OnOpponentFail(Pokemon@ user)"); SCRIPT_HOOK_FUNCTION(OnOpponentFail, "void OnOpponentFail(Pokemon@ user)");
@ -190,9 +191,7 @@ public:
SCRIPT_HOOK_FUNCTION( SCRIPT_HOOK_FUNCTION(
ModifyDefensiveStatValue, ModifyDefensiveStatValue,
"void ModifyDefensiveStatValue(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& defensiveStatValue)"); "void ModifyDefensiveStatValue(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& defensiveStatValue)");
SCRIPT_HOOK_FUNCTION( SCRIPT_HOOK_FUNCTION(OnAfterHeldItemConsume, "void OnAfterHeldItemConsume(Pokemon@ target, const Item@ item)");
OnAfterHeldItemConsume,
"void OnAfterHeldItemConsume(Pokemon@ target, const Item@ item)");
}; };
#undef SCRIPT_HOOK_FUNCTION #undef SCRIPT_HOOK_FUNCTION

View File

@ -48,6 +48,7 @@ shared abstract class PkmnScript {
void OverrideDamage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint& damage){}; void OverrideDamage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint& damage){};
void OverrideIncomingDamage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint& damage){}; void OverrideIncomingDamage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint& damage){};
void ChangeSpeed(BaseTurnChoice@ choice, uint32& speed){};
void ChangePriority(MoveTurnChoice@ choice, int8& priority){}; void ChangePriority(MoveTurnChoice@ choice, int8& priority){};
void OnFail(Pokemon@ user){}; void OnFail(Pokemon@ user){};
void OnOpponentFail(Pokemon@ user){}; void OnOpponentFail(Pokemon@ user){};