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
586: BasicEvent(), m_owner(owner), m_threatVictimGUID(threatVictimGUID), m_threatValue(threatValue) { }
BasicEvent()=default
float m_threatValue
Definition Creature.h:592
Creature & m_owner
Definition Creature.h:590
ObjectGuid m_threatVictimGUID
Definition Creature.h:591

Member Function Documentation

◆ Execute()

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

Reimplemented from BasicEvent.

248{
250 {
251 if (m_owner.IsInCombatWith(victim))
252 {
253 m_owner.GetThreatMgr().ModifyThreatByPercent(victim, -100); // Reset threat to zero.
254 m_owner.GetThreatMgr().AddThreat(victim, m_threatValue); // Set to the previous value it had, first before modification.
255 }
256 }
257
258 return true;
259}
void ModifyThreatByPercent(Unit *target, int32 percent)
Definition ThreatManager.h:150
void AddThreat(Unit *target, float amount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false, bool ignoreRedirects=false)
== AFFECT MY THREAT LIST ==
Definition ThreatManager.cpp:388
Definition Unit.h:664
bool IsInCombatWith(Unit const *who) const
Definition Unit.cpp:17045
ThreatManager & GetThreatMgr()
Definition Unit.h:951
Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:199

References ThreatManager::AddThreat(), Unit::GetThreatMgr(), ObjectAccessor::GetUnit(), Unit::IsInCombatWith(), m_owner, m_threatValue, m_threatVictimGUID, and ThreatManager::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: