28 if (threatEntry->pctMod != 1.0f)
29 pctMod = threatEntry->pctMod;
31 bool hasEnergizeEffect =
false;
36 hasEnergizeEffect =
true;
42 threat = calculation.
threat;
62 if (!hatedUnit || !hatingUnit)
66 if (hatedUnit == hatingUnit)
98 link(refUnit, threatManager);
144 if (modThreat != 0.0f)
150 if (
isValid() && modThreat >= 0.0f)
153 if (victimOwner && victimOwner->
IsAlive())
161 AddPct(tmpThreat, percent);
171 bool accessible =
false;
321 bool noPriorityTargetFound =
false;
323 ThreatContainer::StorageType::const_iterator lastRef =
iThreatList.end();
326 for (ThreatContainer::StorageType::const_iterator iter =
iThreatList.begin(); iter !=
iThreatList.end() && !found;)
328 currentRef = (*iter);
339 if (currentRef == currentVictim)
340 currentVictim = NULL;
347 noPriorityTargetFound =
true;
358 if (currentVictim == currentRef || currentRef->
getThreat() <= 1.1f * currentVictim->
getThreat())
361 currentRef = currentVictim;
420 if (threat > 0.0f && redirectThreadPct)
424 float redirectThreat =
CalculatePct(threat, redirectThreadPct);
425 threat -= redirectThreat;
474 if (!ref && alsoSearchOfflineList)
508 iOwner->SendChangeCurrentVictimOpcode(pHostileReference);
523 switch (threatRefStatusChangeEvent->
getType())
538 iOwner->SendRemoveFromThreatListOpcode(hostilRef);
556 iOwner->SendRemoveFromThreatListOpcode(hostilRef);
583 if (threatList.empty())
586 for (ThreatContainer::StorageType::iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
587 (*itr)->setThreat(0);
#define MAX_SPELL_EFFECTS
@ SPELL_AURA_PERIODIC_ENERGIZE
#define THREAT_UPDATE_INTERVAL
@ AURA_INTERRUPT_FLAG_TAKE_DAMAGE
@ UEV_THREAT_REF_THREAT_CHANGE
@ UEV_THREAT_REF_ONLINE_STATUS
@ UEV_THREAT_REF_REMOVE_FROM_LIST
@ UEV_THREAT_REF_ASSECCIBLE_STATUS
T CalculatePct(T base, U pct)
SpellSchoolMask GetMeleeDamageSchoolMask() const OVERRIDE
bool CanCreatureAttack(Unit const *victim, bool force=true) const
void updateOnlineStatus()
HostileReference(Unit *refUnit, ThreatManager *threatManager, float threat)
void setOnlineOfflineState(bool isOnline)
void sourceObjectDestroyLink()
void targetObjectBuildLink()
void setAccessibleState(bool isAccessible)
void setTempThreat(float threat)
bool isAccessible() const
void addThreat(float modThreat)
uint64 getUnitGuid() const
void fireStatusChanged(ThreatRefStatusChangeEvent &threatRefStatusChangeEvent)
void addThreatPercent(int32 percent)
void targetObjectDestroyLink()
float getTempThreatModifier() const
float iTempThreatModifier
static Unit * GetUnit(WorldObject const &, uint64 guid)
bool IsGameMaster() const
void link(Unit *toObj, ThreatManager *fromObj)
ThreatManager * GetSource() const
SpellEffectInfo Effects[MAX_SPELL_EFFECTS]
HostileReference * getReferenceByTarget(Unit *victim) const
HostileReference * addThreat(Unit *victim, float threat)
void modifyThreatPercent(Unit *victim, int32 percent)
std::list< HostileReference * > StorageType
HostileReference * selectNextVictim(Creature *attacker, HostileReference *currentVictim) const
ThreatManager(Unit *owner)
void tauntFadeOut(Unit *taunter)
float getThreat(Unit *victim, bool alsoSearchOfflineList=false)
void setDirty(bool isDirty)
HostileReference * getCurrentVictim() const
ThreatContainer iThreatOfflineContainer
ThreatContainer iThreatContainer
void modifyThreatPercent(Unit *victim, int32 percent)
HostileReference * iCurrentVictim
void addThreat(Unit *victim, float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=NULL)
void setCurrentVictim(HostileReference *hostileRef)
bool isThreatListEmpty() const
void processThreatEvent(ThreatRefStatusChangeEvent *threatRefStatusChangeEvent)
void tauntApply(Unit *taunter)
void _addThreat(Unit *victim, float threat)
friend class HostileReference
bool isNeedUpdateToClient(uint32 time)
void doAddThreat(Unit *victim, float threat)
void setThreatManager(ThreatManager *pThreatManager)
HostileReference * getReference() const
Player * GetSpellModOwner() const
float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL)
bool IsWithinCombatRange(const Unit *obj, float dist2compare) const
bool isInAccessiblePlaceFor(Creature const *c) const
Unit * GetRedirectThreatTarget()
Unit * GetCharmerOrOwner() const
uint32 GetRedirectThreatPercent() const
void removeHatedBy(HostileReference *)
bool IsWithinMeleeRange(const Unit *obj, float dist=MELEE_RANGE) const
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const
void addHatedBy(HostileReference *pHostileReference)
bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid=0) const
bool InSamePhase(WorldObject const *obj) const
bool IsInMap(WorldObject const *obj) const
bool ignoresUnitModifiers
static float calcThreat(Unit *hatedUnit, Unit *hatingUnit, float threat, uint32 schoolMask=NormalSchoolMask, SpellInfo const *threatSpell=NULL)
static bool isValidProcess(Unit *hatedUnit, Unit *hatingUnit, SpellInfo const *threatSpell=NULL)
static SpellThreatCalculation ApplySpellThreatModifiers(float threat, float pctMod, bool hasEnergizeEffect)