Adds Angelscript script hook to modify stat boost changes
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2022-02-12 15:24:50 +01:00
parent a7e582a712
commit 8983ba7251
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
4 changed files with 14 additions and 0 deletions

View File

@ -126,6 +126,15 @@ void AngelScriptScript::BlockCritical(CreatureLib::Battling::ExecutingAttack* at
}) })
} }
void AngelScriptScript::ModifyStatBoostChange(CreatureLib::Battling::Creature* target,
CreatureLib::Library::Statistic stat, int8_t* diffAmount) {
CALL_HOOK(ModifyStatBoostChange, {
ctx->SetArgObject(0, (void*)target);
ctx->SetArgByte(1, (u8)stat);
ctx->SetArgAddress(2, diffAmount);
})
}
void AngelScriptScript::PreventSecondaryEffects(const CreatureLib::Battling::ExecutingAttack* attack, void AngelScriptScript::PreventSecondaryEffects(const CreatureLib::Battling::ExecutingAttack* attack,
CreatureLib::Battling::Creature* target, uint8_t hitNumber, CreatureLib::Battling::Creature* target, uint8_t hitNumber,
bool* outResult) { bool* outResult) {

View File

@ -79,6 +79,8 @@ public:
void ChangeEffectiveness(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, void ChangeEffectiveness(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target,
uint8_t hitNumber, float* effectiveness) override; uint8_t hitNumber, float* effectiveness) override;
void ModifyStatBoostChange(CreatureLib::Battling::Creature* target, CreatureLib::Library::Statistic stat,
int8_t* diffAmount) override;
void PreventSecondaryEffects(const CreatureLib::Battling::ExecutingAttack* attack, void PreventSecondaryEffects(const CreatureLib::Battling::ExecutingAttack* attack,
CreatureLib::Battling::Creature* target, uint8_t hitNumber, bool* outResult) override; CreatureLib::Battling::Creature* target, uint8_t hitNumber, bool* outResult) override;

View File

@ -112,6 +112,8 @@ public:
"void ChangeEffectiveness(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& effectiveness)"); "void ChangeEffectiveness(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& effectiveness)");
SCRIPT_HOOK_FUNCTION(BlockCritical, SCRIPT_HOOK_FUNCTION(BlockCritical,
"void BlockCritical(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& blockCritical)"); "void BlockCritical(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& blockCritical)");
SCRIPT_HOOK_FUNCTION(ModifyStatBoostChange,
"void ModifyStatBoostChange(Pokemon@ target, Statistic stat, int8& amount)");
SCRIPT_HOOK_FUNCTION( SCRIPT_HOOK_FUNCTION(
PreventSecondaryEffects, PreventSecondaryEffects,
"void PreventSecondaryEffects(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& outResult)"); "void PreventSecondaryEffects(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& outResult)");

View File

@ -29,6 +29,7 @@ shared abstract class PkmnScript {
void BlockCritical(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& blockCritical){}; void BlockCritical(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& blockCritical){};
void OnIncomingHit(ExecutingMove@ attack, Pokemon@ target, uint8 hit){}; void OnIncomingHit(ExecutingMove@ attack, Pokemon@ target, uint8 hit){};
void OnFaintingOpponent(ExecutingMove@ attack, Pokemon@ target, uint8 hit){}; void OnFaintingOpponent(ExecutingMove@ attack, Pokemon@ target, uint8 hit){};
void ModifyStatBoostChange(Pokemon@ target, Statistic stat, int8& amount){};
void PreventSecondaryEffects(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& outResult){}; void PreventSecondaryEffects(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& outResult){};
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit){}; void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit){};
void OnAfterHits(ExecutingMove@ attack, Pokemon@ target){}; void OnAfterHits(ExecutingMove@ attack, Pokemon@ target){};