Changes prevent statboostchange interface in angelscript in line with creaturelib update
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2022-03-12 11:37:06 +01:00
parent 2c678756c7
commit d4c6ba372e
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
5 changed files with 11 additions and 9 deletions

View File

@ -3,7 +3,7 @@
#include <CreatureLib/Battling/ScriptHandling/ScriptResolver.hpp> #include <CreatureLib/Battling/ScriptHandling/ScriptResolver.hpp>
#include <mutex> #include <mutex>
#ifdef ANGELSCRIPT_DEBUGGER #if ANGELSCRIPT_DEBUGGER
#include <AngelscriptDebuggerServer/AngelscriptDebugger.hpp> #include <AngelscriptDebuggerServer/AngelscriptDebugger.hpp>
#endif #endif
#include <scriptbuilder/scriptbuilder.h> #include <scriptbuilder/scriptbuilder.h>

View File

@ -55,13 +55,12 @@ void AngelScriptScript::SetAngelscriptOwner(CScriptHandle* owner) {
} }
AngelScriptScript::~AngelScriptScript() { AngelScriptScript::~AngelScriptScript() {
if (_ownerHandle != nullptr){ if (_ownerHandle != nullptr) {
delete _ownerHandle; delete _ownerHandle;
} }
_obj->Release(); _obj->Release();
} }
void AngelScriptScript::OnInitialize(const CreatureLib::Battling::BattleLibrary* library, void AngelScriptScript::OnInitialize(const CreatureLib::Battling::BattleLibrary* library,
const ArbUt::List<CreatureLib::Library::EffectParameter*>& parameters) { const ArbUt::List<CreatureLib::Library::EffectParameter*>& parameters) {
CALL_HOOK(OnInitialize, { CALL_HOOK(OnInitialize, {
@ -155,12 +154,14 @@ void AngelScriptScript::BlockCritical(CreatureLib::Battling::ExecutingAttack* at
} }
void AngelScriptScript::PreventStatBoostChange(CreatureLib::Battling::Creature* target, void AngelScriptScript::PreventStatBoostChange(CreatureLib::Battling::Creature* target,
CreatureLib::Library::Statistic stat, int8_t diffAmount, bool* prevent) { CreatureLib::Library::Statistic stat, int8_t diffAmount,
bool selfInflicted, bool* prevent) {
CALL_HOOK(PreventStatBoostChange, { CALL_HOOK(PreventStatBoostChange, {
ctx->SetArgObject(0, (void*)target); ctx->SetArgObject(0, (void*)target);
ctx->SetArgDWord(1, (i32)stat); ctx->SetArgDWord(1, (i32)stat);
ctx->SetArgByte(2, diffAmount); ctx->SetArgByte(2, diffAmount);
ctx->SetArgAddress(3, prevent); ctx->SetArgByte(3, selfInflicted);
ctx->SetArgAddress(4, prevent);
}) })
} }

View File

@ -83,7 +83,7 @@ public:
uint8_t hitNumber, float* effectiveness) override; uint8_t hitNumber, float* effectiveness) override;
void PreventStatBoostChange(CreatureLib::Battling::Creature* target, CreatureLib::Library::Statistic stat, void PreventStatBoostChange(CreatureLib::Battling::Creature* target, CreatureLib::Library::Statistic stat,
int8_t diffAmount, bool* prevent) override; int8_t diffAmount, bool selfInflicted, bool* prevent) override;
void ModifyStatBoostChange(CreatureLib::Battling::Creature* target, CreatureLib::Library::Statistic stat, void ModifyStatBoostChange(CreatureLib::Battling::Creature* target, CreatureLib::Library::Statistic stat,
int8_t* diffAmount) override; int8_t* diffAmount) override;
void PreventSecondaryEffects(const CreatureLib::Battling::ExecutingAttack* attack, void PreventSecondaryEffects(const CreatureLib::Battling::ExecutingAttack* attack,

View File

@ -126,8 +126,9 @@ 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(PreventStatBoostChange, SCRIPT_HOOK_FUNCTION(
"void PreventStatBoostChange(Pokemon@ target, Statistic stat, int8 amount, bool& prevent)"); PreventStatBoostChange,
"void PreventStatBoostChange(Pokemon@ target, Statistic stat, int8 amount, bool selfInflicted, bool& prevent)");
SCRIPT_HOOK_FUNCTION(ModifyStatBoostChange, SCRIPT_HOOK_FUNCTION(ModifyStatBoostChange,
"void ModifyStatBoostChange(Pokemon@ target, Statistic stat, int8& amount)"); "void ModifyStatBoostChange(Pokemon@ target, Statistic stat, int8& amount)");
SCRIPT_HOOK_FUNCTION( SCRIPT_HOOK_FUNCTION(

View File

@ -30,7 +30,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 PreventStatBoostChange(Pokemon@ target, Statistic stat, int8 amount, bool& prevent){}; void PreventStatBoostChange(Pokemon@ target, Statistic stat, int8 amount, bool selfInflicted, bool& prevent){};
void ModifyStatBoostChange(Pokemon@ target, Statistic stat, int8& amount){}; 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){};