From 316ac12a01ba47d484ec8f7f8a7b4cca88b34881 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 29 Oct 2021 18:24:46 +0200 Subject: [PATCH] Adds script hook for overriding incoming damage. Signed-off-by: Deukhoofd --- src/Battling/Library/DamageLibrary.cpp | 1 + src/Battling/ScriptHandling/BattleScript.hpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/Battling/Library/DamageLibrary.cpp b/src/Battling/Library/DamageLibrary.cpp index 7a689e2..b764197 100644 --- a/src/Battling/Library/DamageLibrary.cpp +++ b/src/Battling/Library/DamageLibrary.cpp @@ -13,6 +13,7 @@ uint32_t DamageLibrary::GetDamage(ExecutingAttack* attack, Creature* target, uin uint32_t damage = static_cast((((levelMod * static_cast(bp) * statMod) / 50) + 2) * GetDamageModifier(attack, target, hitIndex, hitData)); HOOK(OverrideDamage, attack, attack, target, hitIndex, &damage); + HOOK(OverrideIncomingDamage, target, attack, target, hitIndex, &damage); return damage; } diff --git a/src/Battling/ScriptHandling/BattleScript.hpp b/src/Battling/ScriptHandling/BattleScript.hpp index 32608d6..a8cbf22 100644 --- a/src/Battling/ScriptHandling/BattleScript.hpp +++ b/src/Battling/ScriptHandling/BattleScript.hpp @@ -63,6 +63,8 @@ namespace CreatureLib::Battling { [[maybe_unused]] u8 hitIndex, [[maybe_unused]] float* modifier){}; virtual void OverrideDamage([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target, [[maybe_unused]] u8 hitIndex, [[maybe_unused]] u32* damage){}; + virtual void OverrideIncomingDamage([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target, + [[maybe_unused]] u8 hitIndex, [[maybe_unused]] u32* damage){}; virtual void PreventSecondaryEffects([[maybe_unused]] const ExecutingAttack* attack, [[maybe_unused]] Creature* target, [[maybe_unused]] u8 hitNumber,