* Fix creatures spawning with less than max health if curhealth field in

* creature is != maxhealth in creature_template and the creature is supposed
* to regenerate health.
* Patch courtesy of Visagalis
* Thanks for taking the time to fix this LONG outstanding bug

--HG--
branch : trunk
This commit is contained in:
Brian
2010-06-28 06:42:01 -06:00
parent 6531cbcb21
commit d2f6ae6f77
+16 -6
View File
@@ -1262,16 +1262,26 @@ bool Creature::LoadFromDB(uint32 guid, Map *map)
}
}
uint32 curhealth = data->curhealth;
if (curhealth)
uint32 curhealth;
if (!m_regenHealth)
{
curhealth = uint32(curhealth*_GetHealthMod(GetCreatureInfo()->rank));
if (curhealth < 1)
curhealth = 1;
curhealth = data->curhealth;
if (curhealth)
{
curhealth = uint32(curhealth*_GetHealthMod(GetCreatureInfo()->rank));
if (curhealth < 1)
curhealth = 1;
}
SetPower(POWER_MANA,data->curmana);
}
else
{
curhealth = GetMaxHealth();
SetPower(POWER_MANA,GetMaxPower(POWER_MANA));
}
SetHealth(m_deathState == ALIVE ? curhealth : 0);
SetPower(POWER_MANA,data->curmana);
// checked at creature_template loading
m_defaultMovementType = MovementGeneratorType(data->movementType);