diff --git a/src/Battling/Models/Creature.cpp b/src/Battling/Models/Creature.cpp index 266b344..5f2e05f 100644 --- a/src/Battling/Models/Creature.cpp +++ b/src/Battling/Models/Creature.cpp @@ -210,11 +210,9 @@ namespace CreatureLib::Battling { if (battle.HasValue()) { battle.GetValue()->TriggerEventListener(this, source, _currentHealth, newHealth); battle.GetValue()->RegisterHistoryElement(this, damage, source); + HOOK(OnDamage, this, this, source, _currentHealth, newHealth); } _currentHealth = newHealth; - if (battle.HasValue()) { - HOOK(OnDamage, this, this, source); - } if (IsFainted() && damage > 0 && battle != nullptr) { OnFaint(source); diff --git a/src/Battling/ScriptHandling/BattleScript.hpp b/src/Battling/ScriptHandling/BattleScript.hpp index d24349f..8ab21dc 100644 --- a/src/Battling/ScriptHandling/BattleScript.hpp +++ b/src/Battling/ScriptHandling/BattleScript.hpp @@ -114,7 +114,8 @@ namespace CreatureLib::Battling { [[maybe_unused]] bool* result){}; virtual void OnEndTurn(){}; - virtual void OnDamage(Creature*, DamageSource){}; + virtual void OnDamage(Creature*, DamageSource, [[maybe_unused]] u32 oldHealth, + [[maybe_unused]] u32 newHealth){}; virtual void OnFaint(Creature*, DamageSource){}; virtual void OnSwitchIn(Creature*){}; };