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

#include "Creature.h"

Inheritance diagram for TemporaryThreatModifierEvent:
BasicEvent

Public Member Functions

 TemporaryThreatModifierEvent (Creature &owner, ObjectGuid threatVictimGUID, float threatValue)
 
bool Execute (uint64 e_time, uint32 p_time) override
 
- Public Member Functions inherited from BasicEvent
 BasicEvent ()=default
 
virtual ~BasicEvent ()=default
 
virtual bool IsDeletable () const
 
virtual void Abort (uint64)
 
void ScheduleAbort ()
 

Private Attributes

Creaturem_owner
 
ObjectGuid m_threatVictimGUID
 
float m_threatValue
 

Detailed Description

Constructor & Destructor Documentation

◆ TemporaryThreatModifierEvent()

TemporaryThreatModifierEvent::TemporaryThreatModifierEvent ( Creature owner,
ObjectGuid  threatVictimGUID,
float  threatValue 
)
inline
560: BasicEvent(), m_owner(owner), m_threatVictimGUID(threatVictimGUID), m_threatValue(threatValue) { }
BasicEvent()=default
float m_threatValue
Definition Creature.h:566
Creature & m_owner
Definition Creature.h:564
ObjectGuid m_threatVictimGUID
Definition Creature.h:565

Member Function Documentation

◆ Execute()

bool TemporaryThreatModifierEvent::Execute ( uint64  e_time,
uint32  p_time 
)
overridevirtual

Reimplemented from BasicEvent.

259{
261 {
262 if (m_owner.IsInCombatWith(victim))
263 {
264 m_owner.GetThreatMgr().ModifyThreatByPercent(victim, -100); // Reset threat to zero.
265 m_owner.GetThreatMgr().AddThreat(victim, m_threatValue); // Set to the previous value it had, first before modification.
266 }
267 }
268
269 return true;
270}
void ModifyThreatByPercent(Unit *victim, int32 percent)
Definition ThreatMgr.cpp:508
void AddThreat(Unit *victim, float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition ThreatMgr.cpp:436
Definition Unit.h:636
bool IsInCombatWith(Unit const *who) const
Definition Unit.cpp:21088
ThreatMgr & GetThreatMgr()
Definition Unit.h:912
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition ObjectAccessor.cpp:199

References ThreatMgr::AddThreat(), Unit::GetThreatMgr(), ObjectAccessor::GetUnit(), Unit::IsInCombatWith(), m_owner, m_threatValue, m_threatVictimGUID, and ThreatMgr::ModifyThreatByPercent().

Member Data Documentation

◆ m_owner

Creature& TemporaryThreatModifierEvent::m_owner
private

Referenced by Execute().

◆ m_threatValue

float TemporaryThreatModifierEvent::m_threatValue
private

Referenced by Execute().

◆ m_threatVictimGUID

ObjectGuid TemporaryThreatModifierEvent::m_threatVictimGUID
private

Referenced by Execute().


The documentation for this class was generated from the following files: