refactor(Cote/Unit): cleanup - part2 (#19821)

* fix(Core/AI): remove an unused variable

* Move variables at the end of each sections

* reorder several methods

* remove few inline defintions

* few codestyle fixes
This commit is contained in:
Grimdhex
2024-09-11 16:50:24 +02:00
committed by GitHub
parent 30e77ae880
commit 56d2cc7b4c
2 changed files with 284 additions and 243 deletions

View File

@@ -738,6 +738,20 @@ bool Unit::GetRandomContactPoint(Unit const* obj, float& x, float& y, float& z,
return true;
}
Unit* Unit::getAttackerForHelper() const
{
if (GetVictim() != nullptr)
return GetVictim();
if (!IsEngaged())
return nullptr;
if (!m_attackers.empty())
return *(m_attackers.begin());
return nullptr;
}
void Unit::UpdateInterruptMask()
{
m_interruptMask = 0;
@@ -17222,6 +17236,17 @@ void Unit::SetContestedPvP(Player* attackedPlayer, bool lookForNearContestedGuar
}
}
void Unit::SetCantProc(bool apply)
{
if (apply)
++m_procDeep;
else
{
ASSERT(m_procDeep);
--m_procDeep;
}
}
void Unit::AddPetAura(PetAura const* petSpell)
{
if (!IsPlayer())