AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
ThreatMgr Class Reference

#include "ThreatMgr.h"

Public Member Functions

 ThreatMgr (Unit *owner)
 
 ~ThreatMgr ()
 
UnitSelectVictim ()
 
UnitGetCurrentVictim () const
 
UnitGetAnyTarget () const
 
void clearReferences ()
 
void AddThreat (Unit *victim, float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
 
void DoAddThreat (Unit *victim, float threat)
 
void ModifyThreatByPercent (Unit *victim, int32 percent)
 
float GetThreat (Unit *victim, bool alsoSearchOfflineList=false)
 
float GetThreatListSize () const
 
float getThreatWithoutTemp (Unit *victim, bool alsoSearchOfflineList=false)
 
bool isThreatListEmpty () const
 
bool areThreatListsEmpty () const
 
Acore::IteratorPair< std::list< ThreatReference * >::const_iterator > GetSortedThreatList () const
 
Acore::IteratorPair< std::list< ThreatReference * >::const_iterator > GetUnsortedThreatList () const
 
void processThreatEvent (ThreatRefStatusChangeEvent *threatRefStatusChangeEvent)
 
bool isNeedUpdateToClient (uint32 time)
 
HostileReferencegetCurrentVictim () const
 
UnitGetOwner () const
 
UnitgetHostileTarget ()
 
void tauntApply (Unit *taunter)
 
void tauntFadeOut (Unit *taunter)
 
void setCurrentVictim (HostileReference *hostileRef)
 
void setDirty (bool isDirty)
 
void ResetThreat (Unit const *who)
 
void ResetAllThreat ()
 
void ClearThreat (Unit const *who)
 
void ClearAllThreat ()
 
template<class PREDICATE >
void resetAggro (PREDICATE predicate)
 
ThreatContainer::StorageType const & GetThreatList () const
 
ThreatContainer::StorageType const & GetOfflineThreatList () const
 
ThreatContainerGetOnlineContainer ()
 
ThreatContainerGetOfflineContainer ()
 

Private Member Functions

HostileReferenceFindReference (Unit const *who, bool includeOffline) const
 
void _addThreat (Unit *victim, float threat)
 

Private Attributes

HostileReferenceiCurrentVictim
 
UnitiOwner
 
uint32 iUpdateTimer
 
ThreatContainer iThreatContainer
 
ThreatContainer iThreatOfflineContainer
 

Friends

class HostileReference
 

Detailed Description

Constructor & Destructor Documentation

◆ ThreatMgr()

ThreatMgr::ThreatMgr ( Unit owner)
explicit
414{
415}
#define THREAT_UPDATE_INTERVAL
Definition: ThreatMgr.h:35
HostileReference * iCurrentVictim
Definition: ThreatMgr.h:283
Unit * iOwner
Definition: ThreatMgr.h:284
uint32 iUpdateTimer
Definition: ThreatMgr.h:285

◆ ~ThreatMgr()

ThreatMgr::~ThreatMgr ( )
inline
209{ clearReferences(); }
void clearReferences()
Definition: ThreatMgr.cpp:426

References clearReferences().

Member Function Documentation

◆ _addThreat()

void ThreatMgr::_addThreat ( Unit victim,
float  threat 
)
private
489{
490 HostileReference* ref = iThreatContainer.AddThreat(victim, threat);
491 // Ref is not in the online refs, search the offline refs next
492 if (!ref)
493 ref = iThreatOfflineContainer.AddThreat(victim, threat);
494
495 if (!ref) // there was no ref => create a new one
496 {
497 // threat has to be 0 here
498 HostileReference* hostileRef = new HostileReference(victim, this, 0);
499 iThreatContainer.addReference(hostileRef);
500 hostileRef->AddThreat(threat); // now we add the real threat
501 if (victim->IsPlayer() && victim->ToPlayer()->IsGameMaster())
502 hostileRef->setOnlineOfflineState(false); // GM is always offline
503 }
504}
Definition: ThreatMgr.h:48
void AddThreat(float modThreat)
Definition: ThreatMgr.cpp:138
void setOnlineOfflineState(bool isOnline)
Definition: ThreatMgr.cpp:214
HostileReference * AddThreat(Unit *victim, float threat)
Definition: ThreatMgr.cpp:286
void addReference(HostileReference *hostileRef)
Definition: ThreatMgr.h:184
ThreatContainer iThreatOfflineContainer
Definition: ThreatMgr.h:287
ThreatContainer iThreatContainer
Definition: ThreatMgr.h:286
friend class HostileReference
Definition: ThreatMgr.h:205
bool IsPlayer() const
Definition: Object.h:200
Player * ToPlayer()
Definition: Object.h:201
bool IsGameMaster() const
Definition: Player.h:1175

References ThreatContainer::addReference(), HostileReference::AddThreat(), ThreatContainer::AddThreat(), HostileReference, Player::IsGameMaster(), Object::IsPlayer(), iThreatContainer, iThreatOfflineContainer, HostileReference::setOnlineOfflineState(), and Object::ToPlayer().

Referenced by DoAddThreat().

◆ AddThreat()

void ThreatMgr::AddThreat ( Unit victim,
float  threat,
SpellSchoolMask  schoolMask = SPELL_SCHOOL_MASK_NORMAL,
SpellInfo const *  threatSpell = nullptr 
)
437{
438 if (!ThreatCalcHelper::isValidProcess(victim, iOwner, threatSpell))
439 return;
440
441 threat = ThreatCalcHelper::calcThreat(victim, threat, schoolMask, threatSpell);
442 if (Creature* hatingCreature = iOwner->ToCreature())
443 {
444 if (hatingCreature->IsAIEnabled)
445 {
446 hatingCreature->AI()->CalculateThreat(victim, threat, threatSpell);
447 }
448 }
449
450 DoAddThreat(victim, threat);
451}
static float calcThreat(Unit *hatedUnit, float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition: ThreatMgr.cpp:34
static bool isValidProcess(Unit *hatedUnit, Unit *hatingUnit, SpellInfo const *threatSpell=nullptr)
Definition: ThreatMgr.cpp:54
void DoAddThreat(Unit *victim, float threat)
Definition: ThreatMgr.cpp:453
Definition: Creature.h:43
Creature * ToCreature()
Definition: Object.h:205

References ThreatCalcHelper::calcThreat(), DoAddThreat(), iOwner, ThreatCalcHelper::isValidProcess(), and Object::ToCreature().

Referenced by HostileReference::AddThreat(), Unit::AddThreat(), ScriptedAI::DoAddThreat(), TemporaryThreatModifierEvent::Execute(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), boss_drakkisath::boss_drakkisathAI::UpdateAI(), boss_grilek::boss_grilekAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), and boss_netherspite::UpdatePortals().

◆ areThreatListsEmpty()

bool ThreatMgr::areThreatListsEmpty ( ) const
inline
bool empty() const
Definition: ThreatMgr.h:163

References ThreatContainer::empty(), iThreatContainer, and iThreatOfflineContainer.

◆ ClearAllThreat()

void ThreatMgr::ClearAllThreat ( )
418{
422}
bool isThreatListEmpty() const
Definition: ThreatMgr.h:224
void SendClearThreatListOpcode()
Definition: Unit.cpp:20119
bool CanHaveThreatList(bool skipAliveCheck=false) const
Definition: Unit.cpp:14614

References Unit::CanHaveThreatList(), clearReferences(), iOwner, isThreatListEmpty(), and Unit::SendClearThreatListOpcode().

Referenced by CreatureAI::_EnterEvadeMode(), Unit::CleanupBeforeRemoveFromMap(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_crystalline_frayer::DamageTaken(), npc_magister_aledis::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), npc_raging_flames::FixateRandomTarget(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), PetAI::HandleReturnMovement(), Unit::Kill(), boss_urom::boss_uromAI::LeaveCombat(), Unit::setDeathState(), spell_putricide_ooze_channel::StartAttack(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), and npc_aeranas::npc_aeranasAI::UpdateAI().

◆ clearReferences()

◆ ClearThreat()

void ThreatMgr::ClearThreat ( Unit const *  who)
inline
251{ if (auto* ref = FindReference(who, true)) ref->removeReference(); }
HostileReference * FindReference(Unit const *who, bool includeOffline) const
Definition: ThreatMgr.h:279

References FindReference().

◆ DoAddThreat()

void ThreatMgr::DoAddThreat ( Unit victim,
float  threat 
)
454{
455 uint32 redirectThreadPct = victim->GetRedirectThreatPercent();
456 Unit* redirectTarget = victim->GetRedirectThreatTarget();
457
458 // Personal Spawns from same summoner can aggro each other
459 if (TempSummon* tempSummonVictim = victim->ToTempSummon())
460 {
461 if (tempSummonVictim->IsVisibleBySummonerOnly())
462 {
463 if (!GetOwner()->ToTempSummon() ||
464 !GetOwner()->ToTempSummon()->IsVisibleBySummonerOnly() ||
465 tempSummonVictim->GetSummonerGUID() != GetOwner()->ToTempSummon()->GetSummonerGUID())
466 {
467 redirectThreadPct = 100;
468 redirectTarget = tempSummonVictim->GetSummonerUnit();
469 }
470 }
471 }
472
473 // must check > 0.0f, otherwise dead loop
474 if (threat > 0.0f && redirectThreadPct)
475 {
476 if (redirectTarget)
477 {
478 float redirectThreat = CalculatePct(threat, redirectThreadPct);
479 threat -= redirectThreat;
480 if (ThreatCalcHelper::isValidProcess(redirectTarget, GetOwner()))
481 _addThreat(redirectTarget, redirectThreat);
482 }
483 }
484
485 _addThreat(victim, threat);
486}
T CalculatePct(T base, U pct)
Definition: Util.h:61
std::uint32_t uint32
Definition: Define.h:107
void _addThreat(Unit *victim, float threat)
Definition: ThreatMgr.cpp:488
Unit * GetOwner() const
Definition: ThreatMgr.h:236
Definition: TemporarySummon.h:40
Definition: Unit.h:630
Unit * GetRedirectThreatTarget() const
Definition: Unit.cpp:19509
TempSummon * ToTempSummon()
Definition: Unit.h:696
uint32 GetRedirectThreatPercent()
Definition: Unit.h:913

References _addThreat(), CalculatePct(), GetOwner(), Unit::GetRedirectThreatPercent(), Unit::GetRedirectThreatTarget(), ThreatCalcHelper::isValidProcess(), and Unit::ToTempSummon().

Referenced by AddThreat(), Spell::EffectTaunt(), and HostileRefMgr::threatAssist().

◆ FindReference()

HostileReference * ThreatMgr::FindReference ( Unit const *  who,
bool  includeOffline 
) const
inlineprivate
279{ if (auto* ref = iThreatContainer.getReferenceByTarget(who)) return ref; if (includeOffline) if (auto* ref = iThreatOfflineContainer.getReferenceByTarget(who)) return ref; return nullptr; }
HostileReference * getReferenceByTarget(Unit const *victim) const
Definition: ThreatMgr.cpp:261

References ThreatContainer::getReferenceByTarget(), iThreatContainer, and iThreatOfflineContainer.

Referenced by ClearThreat(), and ResetThreat().

◆ GetAnyTarget()

Unit * ThreatMgr::GetAnyTarget ( ) const
inline
213{ auto const& list = GetThreatList(); if (!list.empty()) return list.front()->getTarget(); return nullptr; }
ThreatContainer::StorageType const & GetThreatList() const
Definition: ThreatMgr.h:273

References GetThreatList().

◆ GetCurrentVictim()

Unit * ThreatMgr::GetCurrentVictim ( ) const
inline
212{ if (ThreatReference* ref = getCurrentVictim()) return ref->GetVictim(); else return nullptr; }
HostileReference * getCurrentVictim() const
Definition: ThreatMgr.h:234

References getCurrentVictim(), and Unit::GetVictim().

Referenced by NonTankTargetSelector::operator()(), and UnitAI::SelectTargetList().

◆ getCurrentVictim()

HostileReference * ThreatMgr::getCurrentVictim ( ) const
inline

◆ getHostileTarget()

Unit * ThreatMgr::getHostileTarget ( )
516{
519 setCurrentVictim(nextVictim);
520 return getCurrentVictim() != nullptr ? getCurrentVictim()->getTarget() : nullptr;
521}
TO * getTarget() const
Definition: Reference.h:95
void update()
Definition: ThreatMgr.cpp:305
HostileReference * SelectNextVictim(Creature *attacker, HostileReference *currentVictim) const
Definition: ThreatMgr.cpp:317
void setCurrentVictim(HostileReference *hostileRef)
Definition: ThreatMgr.cpp:572

References getCurrentVictim(), GetOwner(), Reference< TO, FROM >::getTarget(), iThreatContainer, ThreatContainer::SelectNextVictim(), setCurrentVictim(), and ThreatContainer::update().

Referenced by SelectVictim(), and Creature::SelectVictim().

◆ GetOfflineContainer()

ThreatContainer & ThreatMgr::GetOfflineContainer ( )
inline

◆ GetOfflineThreatList()

ThreatContainer::StorageType const & ThreatMgr::GetOfflineThreatList ( ) const
inline
StorageType const & GetThreatList() const
Definition: ThreatMgr.h:176

References ThreatContainer::GetThreatList(), and iThreatOfflineContainer.

Referenced by debug_commandscript::HandleDebugThreatListCommand(), and Unit::SetPhaseMask().

◆ GetOnlineContainer()

◆ GetOwner()

◆ GetSortedThreatList()

Acore::IteratorPair< std::list< ThreatReference * >::const_iterator > ThreatMgr::GetSortedThreatList ( ) const
inline
227{ auto& list = iThreatContainer.GetThreatList(); return { list.cbegin(), list.cend() }; }

References ThreatContainer::GetThreatList(), and iThreatContainer.

Referenced by GetUnsortedThreatList(), and UnitAI::SelectTargetList().

◆ GetThreat()

◆ GetThreatList()

ThreatContainer::StorageType const & ThreatMgr::GetThreatList ( ) const
inline

References ThreatContainer::GetThreatList(), and iThreatContainer.

Referenced by boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), boss_ysondre::boss_ysondreAI::DamageTaken(), UnitAI::DoAddAuraToAllHostilePlayers(), UnitAI::DoCastToAllHostilePlayers(), boss_faction_championsAI::EnemiesInRange(), boss_ragnaros::boss_ragnarosAI::EnterEvadeMode(), boss_murmur::EnterEvadeMode(), boss_alar::EnterEvadeMode(), boss_ouro::EnterEvadeMode(), boss_supremus::FindHatefulStrikeTarget(), GetAnyTarget(), SmartScript::GetTargets(), GetThreatListSize(), debug_commandscript::HandleDebugThreatListCommand(), Unit::IsInCombatWith(), boss_blackheart_the_inciter::JustEngagedWith(), SmartScript::ProcessAction(), SmartScript::ProcessEvent(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), boss_faction_championsAI::SelectEnemyCaster(), npc_scholomance_occultist::npc_scholomance_occultistAI::SelectUnitCasting(), Unit::SendChangeCurrentVictimOpcode(), Unit::SendThreatListUpdate(), Unit::SetPhaseMask(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), BossAI::TeleportCheaters(), boss_nefarian::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_taldaram::UpdateAI(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), and boss_the_lurker_below::UpdateAI().

◆ GetThreatListSize()

◆ getThreatWithoutTemp()

float ThreatMgr::getThreatWithoutTemp ( Unit victim,
bool  alsoSearchOfflineList = false 
)
539{
540 float threat = 0.0f;
542 if (!ref && alsoSearchOfflineList)
544 if (ref)
545 threat = ref->GetThreat() - ref->getTempThreatModifier();
546 return threat;
547}
float getTempThreatModifier()
Definition: ThreatMgr.h:93

References ThreatContainer::getReferenceByTarget(), HostileReference::getTempThreatModifier(), HostileReference::GetThreat(), iThreatContainer, and iThreatOfflineContainer.

Referenced by boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI().

◆ GetUnsortedThreatList()

Acore::IteratorPair< std::list< ThreatReference * >::const_iterator > ThreatMgr::GetUnsortedThreatList ( ) const
inline
228{ return GetSortedThreatList(); }
Acore::IteratorPair< std::list< ThreatReference * >::const_iterator > GetSortedThreatList() const
Definition: ThreatMgr.h:227

References GetSortedThreatList().

Referenced by boss_attumen::IsSummonedBy(), and UnitAI::SelectTargetList().

◆ isNeedUpdateToClient()

bool ThreatMgr::isNeedUpdateToClient ( uint32  time)
637{
638 if (isThreatListEmpty())
639 return false;
640
641 if (time >= iUpdateTimer)
642 {
644 return true;
645 }
646 iUpdateTimer -= time;
647 return false;
648}

References isThreatListEmpty(), iUpdateTimer, and THREAT_UPDATE_INTERVAL.

◆ isThreatListEmpty()

◆ ModifyThreatByPercent()

◆ processThreatEvent()

void ThreatMgr::processThreatEvent ( ThreatRefStatusChangeEvent threatRefStatusChangeEvent)
586{
587 threatRefStatusChangeEvent->setThreatMgr(this); // now we can set the threat manager
588
589 HostileReference* hostileRef = threatRefStatusChangeEvent->getReference();
590
591 switch (threatRefStatusChangeEvent->getType())
592 {
594 if ((getCurrentVictim() == hostileRef && threatRefStatusChangeEvent->getFValue() < 0.0f) ||
595 (getCurrentVictim() != hostileRef && threatRefStatusChangeEvent->getFValue() > 0.0f))
596 setDirty(true); // the order in the threat list might have changed
597 break;
599 if (!hostileRef->IsOnline())
600 {
601 if (hostileRef == getCurrentVictim())
602 {
603 setCurrentVictim(nullptr);
604 setDirty(true);
605 }
606 if (GetOwner() && GetOwner()->IsInWorld())
607 if (Unit* target = ObjectAccessor::GetUnit(*GetOwner(), hostileRef->getUnitGuid()))
608 if (GetOwner()->IsInMap(target))
610 iThreatContainer.remove(hostileRef);
612 }
613 else
614 {
615 if (getCurrentVictim() && hostileRef->GetThreat() > (1.1f * getCurrentVictim()->GetThreat()))
616 setDirty(true);
617 iThreatContainer.addReference(hostileRef);
619 }
620 break;
622 if (hostileRef == getCurrentVictim())
623 {
624 setCurrentVictim(nullptr);
625 setDirty(true);
626 }
628 if (hostileRef->IsOnline())
629 iThreatContainer.remove(hostileRef);
630 else
632 break;
633 }
634}
@ UEV_THREAT_REF_THREAT_CHANGE
Definition: UnitEvents.h:36
@ UEV_THREAT_REF_ONLINE_STATUS
Definition: UnitEvents.h:33
@ UEV_THREAT_REF_REMOVE_FROM_LIST
Definition: UnitEvents.h:39
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:199
ObjectGuid getUnitGuid() const
Definition: ThreatMgr.h:106
bool IsOnline() const
Definition: ThreatMgr.h:66
void remove(HostileReference *hostileRef)
Definition: ThreatMgr.h:179
void setDirty(bool isDirty)
Definition: ThreatMgr.h:245
float GetThreat(Unit *victim, bool alsoSearchOfflineList=false)
Definition: ThreatMgr.cpp:525
uint32 getType() const
Definition: UnitEvents.h:75
float getFValue() const
Definition: UnitEvents.h:105
void setThreatMgr(ThreatMgr *pThreatMgr)
Definition: UnitEvents.h:113
HostileReference * getReference() const
Definition: UnitEvents.h:111
void SendRemoveFromThreatListOpcode(HostileReference *pHostileReference)
Definition: Unit.cpp:20127

References ThreatContainer::addReference(), getCurrentVictim(), ThreatRefStatusChangeEvent::getFValue(), GetOwner(), ThreatRefStatusChangeEvent::getReference(), HostileReference::GetThreat(), GetThreat(), UnitBaseEvent::getType(), ObjectAccessor::GetUnit(), HostileReference::getUnitGuid(), iOwner, HostileReference::IsOnline(), iThreatContainer, iThreatOfflineContainer, ThreatContainer::remove(), Unit::SendRemoveFromThreatListOpcode(), setCurrentVictim(), setDirty(), ThreatRefStatusChangeEvent::setThreatMgr(), UEV_THREAT_REF_ONLINE_STATUS, UEV_THREAT_REF_REMOVE_FROM_LIST, and UEV_THREAT_REF_THREAT_CHANGE.

Referenced by HostileReference::fireStatusChanged().

◆ resetAggro()

template<class PREDICATE >
void ThreatMgr::resetAggro ( PREDICATE  predicate)
inline
256 {
258 if (threatList.empty())
259 return;
260
261 for (auto& ref : threatList)
262 {
263 if (predicate(ref->getTarget()))
264 {
265 ref->SetThreat(0);
266 setDirty(true);
267 }
268 }
269 }
StorageType iThreatList
Definition: ThreatMgr.h:194
std::list< HostileReference * > StorageType
Definition: ThreatMgr.h:147

References iThreatContainer, ThreatContainer::iThreatList, and setDirty().

Referenced by boss_gothik::boss_gothikAI::UpdateAI().

◆ ResetAllThreat()

◆ ResetThreat()

void ThreatMgr::ResetThreat ( Unit const *  who)
inline
248{ if (auto* ref = FindReference(who, true)) ref->SetThreat(0.0f); }

References FindReference().

Referenced by ScriptedAI::DoResetThreat(), and spell_kaelthas_mind_control::HandleEffect().

◆ SelectVictim()

Unit * ThreatMgr::SelectVictim ( )
inline
211{ return getHostileTarget(); }
Unit * getHostileTarget()
Definition: ThreatMgr.cpp:515

References getHostileTarget().

◆ setCurrentVictim()

void ThreatMgr::setCurrentVictim ( HostileReference hostileRef)
573{
574 if (pHostileReference && pHostileReference != iCurrentVictim)
575 {
576 iOwner->SendChangeCurrentVictimOpcode(pHostileReference);
577 }
578 iCurrentVictim = pHostileReference;
579}
void SendChangeCurrentVictimOpcode(HostileReference *pHostileReference)
Definition: Unit.cpp:20098

References iCurrentVictim, iOwner, and Unit::SendChangeCurrentVictimOpcode().

Referenced by Spell::EffectTaunt(), getHostileTarget(), and processThreatEvent().

◆ setDirty()

void ThreatMgr::setDirty ( bool  isDirty)
inline
245{ iThreatContainer.setDirty(isDirty); }
void setDirty(bool isDirty)
Definition: ThreatMgr.h:159

References iThreatContainer, and ThreatContainer::setDirty().

Referenced by processThreatEvent(), resetAggro(), and ResetAllThreat().

◆ tauntApply()

void ThreatMgr::tauntApply ( Unit taunter)

◆ tauntFadeOut()

void ThreatMgr::tauntFadeOut ( Unit taunter)
564{
566 if (ref)
567 ref->resetTempThreat();
568}
void resetTempThreat()
Definition: ThreatMgr.h:84

References ThreatContainer::getReferenceByTarget(), iThreatContainer, and HostileReference::resetTempThreat().

Friends And Related Function Documentation

◆ HostileReference

friend class HostileReference
friend

Referenced by _addThreat().

Member Data Documentation

◆ iCurrentVictim

HostileReference* ThreatMgr::iCurrentVictim
private

◆ iOwner

Unit* ThreatMgr::iOwner
private

◆ iThreatContainer

◆ iThreatOfflineContainer

◆ iUpdateTimer

uint32 ThreatMgr::iUpdateTimer
private