diff --git a/src/ScriptResolving/AngelScript/AngelScriptScript.cpp b/src/ScriptResolving/AngelScript/AngelScriptScript.cpp index 4f16fe2..d03ef5d 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptScript.cpp +++ b/src/ScriptResolving/AngelScript/AngelScriptScript.cpp @@ -342,11 +342,13 @@ CreatureLib::Battling::BattleScript* AngelScriptScript::Clone(const ArbUt::Optio return new AngelScriptScript(owner, GetAngelscriptOwner()->GetType(), _resolver, _type, obj, _ctxPool); } -void AngelScriptScript::OnDamage(CreatureLib::Battling::Creature* creature, - CreatureLib::Battling::DamageSource source) { +void AngelScriptScript::OnDamage(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source, + [[maybe_unused]] u32 oldHealth, [[maybe_unused]] u32 newHealth) { CALL_HOOK(OnDamage, { ctx->SetArgObject(0, (void*)creature); ctx->SetArgDWord(1, (i32)source); + ctx->SetArgDWord(2, oldHealth); + ctx->SetArgDWord(3, newHealth); }) } void AngelScriptScript::OnFaint(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source) { diff --git a/src/ScriptResolving/AngelScript/AngelScriptScript.hpp b/src/ScriptResolving/AngelScript/AngelScriptScript.hpp index 6f6e5f8..db2ca77 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptScript.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptScript.hpp @@ -75,15 +75,15 @@ public: uint8_t hitNumber, uint8_t* outType) override; void BlockCritical(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, - uint8_t hitNumber, bool* blockCritical) override; + uint8_t hitNumber, bool* blockCritical) override; void ChangeEffectiveness(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, uint8_t hitNumber, float* effectiveness) override; void PreventSecondaryEffects(const CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, uint8_t hitNumber, bool* outResult) override; - void OnIncomingHit(const CreatureLib::Battling::ExecutingAttack* attack, - CreatureLib::Battling::Creature* target, uint8_t hitNumber) override; + void OnIncomingHit(const CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, + uint8_t hitNumber) override; void OnFaintingOpponent(const CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, u8 hitNumber) override; void OnSecondaryEffect(const CreatureLib::Battling::ExecutingAttack* attack, @@ -124,7 +124,8 @@ public: void PreventOpponentRunAway(const CreatureLib::Battling::FleeTurnChoice* choice, bool* result) override; void PreventOpponentSwitch(const CreatureLib::Battling::SwitchTurnChoice* choice, bool* outResult) override; void OnEndTurn() override; - void OnDamage(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source) override; + void OnDamage(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source, + [[maybe_unused]] u32 oldHealth, [[maybe_unused]] u32 newHealth) override; void OnFaint(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source) override; void OnSwitchIn(CreatureLib::Battling::Creature* creature) override; diff --git a/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp b/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp index fbaef51..3e2924a 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptTypeInfo.hpp @@ -170,7 +170,8 @@ public: SCRIPT_HOOK_FUNCTION(PreventOpponentSwitch, "void PreventOpponentSwitch(SwitchTurnChoice@ choice, bool& result)"); SCRIPT_HOOK_FUNCTION(OnEndTurn, "void OnEndTurn()"); - SCRIPT_HOOK_FUNCTION(OnDamage, "void OnDamage(Pokemon@ pokemon, DamageSource damageSource)"); + SCRIPT_HOOK_FUNCTION(OnDamage, + "void OnDamage(Pokemon@ pokemon, DamageSource damageSource, uint oldHealth, uint newHealth)"); SCRIPT_HOOK_FUNCTION(OnFaint, "void OnFaint(Pokemon@ pokemon, DamageSource damageSource)"); SCRIPT_HOOK_FUNCTION(BlockWeather, "void BlockWeather(Battle@ battle, bool& result)"); SCRIPT_HOOK_FUNCTION(OnSwitchIn, "void OnSwitchIn(Pokemon@ pokemon)"); diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp index 159674c..2cb1cab 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/BasicScriptClass.cpp @@ -54,7 +54,7 @@ shared abstract class PkmnScript { void PreventOpponentRunAway(FleeTurnChoice@ choice, bool& result){}; void PreventOpponentSwitch(SwitchTurnChoice@ choice, bool& result){}; void OnEndTurn(){}; - void OnDamage(Pokemon@ pokemon, DamageSource damageSource){}; + void OnDamage(Pokemon@ pokemon, DamageSource damageSource, uint oldHealth, uint newHealth){}; void OnFaint(Pokemon@ pokemon, DamageSource damageSource){}; // PkmnLib methods