fix(Core/Creature): Fix kill credit for some mobs after UpdateEntry (#5746)

Co-authored-by: Yehonal <yehonal.azeroth@gmail.com
This commit is contained in:
Raelorasz
2021-05-11 19:11:54 +02:00
committed by GitHub
parent 05780f2c50
commit e5582b3443

View File

@@ -454,13 +454,22 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele
SetAttackTime(RANGED_ATTACK, cInfo->RangeAttackTime);
uint32 previousHealth = GetHealth();
uint32 previousMaxHealth = GetMaxHealth();
uint32 previousPlayerDamageReq = m_PlayerDamageReq;
SelectLevel(changelevel);
if (previousHealth > 0)
{
SetHealth(previousHealth);
m_PlayerDamageReq = previousPlayerDamageReq;
if (previousMaxHealth && previousMaxHealth > GetMaxHealth())
{
m_PlayerDamageReq = (uint32)(previousPlayerDamageReq * GetMaxHealth() / previousMaxHealth);
}
else
{
m_PlayerDamageReq = previousPlayerDamageReq;
}
}
SetMeleeDamageSchool(SpellSchools(cInfo->dmgschool));