Core/Creatures: Implemented unkillable flag (prevent health from going below 1)

Port From (https://github.com/TrinityCore/TrinityCore/commit/7ea438ebdca93874776e02e9985db1da0a53f2fb)
This commit is contained in:
hondacrx
2023-03-14 02:09:28 -04:00
parent 4d1337eed9
commit 89a3cb971a
2 changed files with 12 additions and 0 deletions
+4
View File
@@ -2591,6 +2591,10 @@ namespace Game.Entities
duel_hasEnded = true;
}
else if (victim.IsCreature() && damageTaken >= health && victim.ToCreature().HasFlag(CreatureStaticFlags.Unkillable))
{
damageTaken = health - 1;
}
else if (victim.IsVehicle() && damageTaken >= (health - 1) && victim.GetCharmer() != null && victim.GetCharmer().IsTypeId(TypeId.Player))
{
Player victimRider = victim.GetCharmer().ToPlayer();