Core/AI: Implemented OnHealthDepleted hook

Port From (https://github.com/TrinityCore/TrinityCore/commit/ea134c0eae83b4cdbb5f0e941ed867a144bb01f6)
This commit is contained in:
hondacrx
2023-09-04 13:07:59 -04:00
parent 66c1b205ef
commit 07a2dd9859
3 changed files with 10 additions and 0 deletions
+4
View File
@@ -2672,6 +2672,10 @@ namespace Game.Entities
else if (victim.IsCreature() && damageTaken >= health && victim.ToCreature().HasFlag(CreatureStaticFlags.Unkillable))
{
damageTaken = health - 1;
// If we had damage (aka health was not 1 already) trigger OnHealthDepleted
if (damageTaken > 0)
victim.ToCreature().GetAI()?.OnHealthDepleted(attacker, false);
}
else if (victim.IsVehicle() && damageTaken >= (health - 1) && victim.GetCharmer() != null && victim.GetCharmer().IsTypeId(TypeId.Player))
{