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:
1 parent
947086fb54
commit
3944dc25b9
2 files changed
+10
-12
No files matched your search
@@ -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
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user