mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
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)
(cherry picked from commit b8a1a18a5a)
This commit is contained in:
@@ -1485,23 +1485,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