Core/Creature: Call SetSpawnHealth after JustReachedHome in HomeMovementGenerator

Fixes issues with quests that rely on this behaviour (eg Free your Mind)

Also updated SetSpawnHealth so it doesn't do anything in case spawn is manual (SetHealth(GetHealth()) does modify things depending on deathstate)
This commit is contained in:
ariel-
2016-10-11 01:43:14 -03:00
committed by Aokromes
parent 947086fb54
commit 3944dc25b9
2 changed files with 10 additions and 12 deletions

View File

@@ -1470,23 +1470,21 @@ void Creature::LoadEquipment(int8 id, bool force /*= true*/)
void Creature::SetSpawnHealth()
{
if (!m_creatureData)
return;
uint32 curhealth;
if (!m_regenHealth)
{
if (m_creatureData)
curhealth = m_creatureData->curhealth;
if (curhealth)
{
curhealth = m_creatureData->curhealth;
if (curhealth)
{
curhealth = uint32(curhealth*_GetHealthMod(GetCreatureTemplate()->rank));
if (curhealth < 1)
curhealth = 1;
}
SetPower(POWER_MANA, m_creatureData->curmana);
curhealth = uint32(curhealth*_GetHealthMod(GetCreatureTemplate()->rank));
if (curhealth < 1)
curhealth = 1;
}
else
curhealth = GetHealth();
SetPower(POWER_MANA, m_creatureData->curmana);
}
else
{

View File

@@ -34,8 +34,8 @@ void HomeMovementGenerator<Creature>::DoFinalize(Creature* owner)
owner->ClearUnitState(UNIT_STATE_EVADE);
owner->SetWalk(true);
owner->LoadCreaturesAddon();
owner->SetSpawnHealth();
owner->AI()->JustReachedHome();
owner->SetSpawnHealth();
}
}