Adds new Angelscript script hooks.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-03-28 18:53:08 +02:00
parent 4e215895b7
commit c89c572aa2
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
5 changed files with 17 additions and 1 deletions

View File

@ -285,3 +285,12 @@ void AngelScriptScript::PreventOpponentRunAway(const CreatureLib::Battling::Flee
ctx->SetArgAddress(1, result); ctx->SetArgAddress(1, result);
}) })
} }
void AngelScriptScript::PreventOpponentSwitch(const CreatureLib::Battling::SwitchTurnChoice* choice, bool* outResult) {
CALL_HOOK(PreventOpponentSwitch, {
ctx->SetArgObject(0, (void*)choice);
ctx->SetArgAddress(1, outResult);
})
}
void AngelScriptScript::OnEndTurn(CreatureLib::Battling::Creature* creature) {
CALL_HOOK(OnEndTurn, { ctx->SetArgObject(0, (void*)creature); })
}

View File

@ -105,6 +105,8 @@ public:
void PreventRunAway(const CreatureLib::Battling::FleeTurnChoice* choice, bool* result) override; void PreventRunAway(const CreatureLib::Battling::FleeTurnChoice* choice, bool* result) override;
void PreventOpponentRunAway(const CreatureLib::Battling::FleeTurnChoice* choice, bool* result) override; void PreventOpponentRunAway(const CreatureLib::Battling::FleeTurnChoice* choice, bool* result) override;
void PreventOpponentSwitch(const CreatureLib::Battling::SwitchTurnChoice* choice, bool* outResult) override;
void OnEndTurn(CreatureLib::Battling::Creature* creature) override;
//////////////////// ////////////////////
// PkmnLib methods// // PkmnLib methods//
@ -121,6 +123,7 @@ 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

@ -1 +0,0 @@
#include "AngelScriptTypeInfo.hpp"

View File

@ -139,6 +139,9 @@ public:
SCRIPT_HOOK_FUNCTION(PreventRunAway, "void PreventRunAway(FleeTurnChoice@ choice, bool& result)"); SCRIPT_HOOK_FUNCTION(PreventRunAway, "void PreventRunAway(FleeTurnChoice@ choice, bool& result)");
SCRIPT_HOOK_FUNCTION(PreventOpponentRunAway, "void PreventOpponentRunAway(FleeTurnChoice@ choice, bool& result)"); SCRIPT_HOOK_FUNCTION(PreventOpponentRunAway, "void PreventOpponentRunAway(FleeTurnChoice@ choice, bool& result)");
SCRIPT_HOOK_FUNCTION(PreventOpponentSwitch, "void PreventOpponentSwitch(SwitchTurnChoice@ choice, bool& result)");
SCRIPT_HOOK_FUNCTION(OnEndTurn, "void OnEndTurn(Pokemon@ pokemon)");
}; };
#undef SCRIPT_HOOK_FUNCTION #undef SCRIPT_HOOK_FUNCTION

View File

@ -42,6 +42,8 @@ shared abstract class PkmnScript {
void PreventRunAway(FleeTurnChoice@ choice, bool& result){}; void PreventRunAway(FleeTurnChoice@ choice, bool& result){};
void PreventOpponentRunAway(FleeTurnChoice@ choice, bool& result){}; void PreventOpponentRunAway(FleeTurnChoice@ choice, bool& result){};
void PreventOpponentSwitch(SwitchTurnChoice@ choice, bool& result){};
void OnEndTurn(Pokemon@ pokemon){};
// PkmnLib methods // PkmnLib methods
void ModifyCriticalStage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& critStage){}; void ModifyCriticalStage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& critStage){};