refactor(Core/Combat): Code style and improvement of ThreatMgr (#12992)

This commit is contained in:
Maelthyr
2022-09-25 20:20:34 +02:00
committed by GitHub
parent ddcf0e79b6
commit 1f472bddd3
61 changed files with 212 additions and 196 deletions

View File

@@ -207,8 +207,8 @@ bool TemporaryThreatModifierEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
if (m_owner.IsInCombatWith(victim))
{
m_owner.GetThreatMgr().modifyThreatPercent(victim, -100); // Reset threat to zero.
m_owner.GetThreatMgr().addThreat(victim, m_threatValue); // Set to the previous value it had, first before modification.
m_owner.GetThreatMgr().ModifyThreatByPercent(victim, -100); // Reset threat to zero.
m_owner.GetThreatMgr().AddThreat(victim, m_threatValue); // Set to the previous value it had, first before modification.
}
}
@@ -839,13 +839,13 @@ void Creature::Update(uint32 diff)
}
};
if (GetThreatMgr().getThreatList().size() <= 1)
if (GetThreatMgr().GetThreatListSize() <= 1)
{
EnterEvade();
}
else
{
if (HostileReference* ref = GetThreatMgr().getOnlineContainer().getReferenceByTarget(m_cannotReachTarget))
if (HostileReference* ref = GetThreatMgr().GetOnlineContainer().getReferenceByTarget(m_cannotReachTarget))
{
ref->removeReference();
SetCannotReachTarget();
@@ -3626,11 +3626,11 @@ void Creature::ModifyThreatPercentTemp(Unit* victim, int32 percent, Milliseconds
{
if (victim)
{
float currentThreat = GetThreatMgr().getThreat(victim);
float currentThreat = GetThreatMgr().GetThreat(victim);
if (percent != 0.0f)
{
GetThreatMgr().modifyThreatPercent(victim, percent);
GetThreatMgr().ModifyThreatByPercent(victim, percent);
}
TemporaryThreatModifierEvent* pEvent = new TemporaryThreatModifierEvent(*this, victim->GetGUID(), currentThreat);