TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AssistDelayEvent Class Reference

#include <Creature.h>

Public Member Functions

 AssistDelayEvent (ObjectGuid victim, Unit &owner)
 
bool Execute (uint64 e_time, uint32 p_time) override
 
void AddAssistant (ObjectGuid guid)
 
- Public Member Functions inherited from BasicEvent
 BasicEvent ()
 
virtual ~BasicEvent ()
 
virtual bool IsDeletable () const
 
virtual void Abort (uint64)
 

Private Member Functions

 AssistDelayEvent ()
 

Private Attributes

ObjectGuid m_victim
 
GuidList m_assistants
 
Unitm_owner
 

Additional Inherited Members

- Public Attributes inherited from BasicEvent
bool to_Abort
 
uint64 m_addTime
 
uint64 m_execTime
 

Constructor & Destructor Documentation

AssistDelayEvent::AssistDelayEvent ( ObjectGuid  victim,
Unit owner 
)
inline
793 : BasicEvent(), m_victim(victim), m_owner(owner) { }
ObjectGuid m_victim
Definition: Creature.h:800
BasicEvent()
Definition: EventProcessor.h:31
Unit & m_owner
Definition: Creature.h:802
AssistDelayEvent::AssistDelayEvent ( )
private

Member Function Documentation

void AssistDelayEvent::AddAssistant ( ObjectGuid  guid)
inline
796 { m_assistants.push_back(guid); }
GuidList m_assistants
Definition: Creature.h:801

+ Here is the caller graph for this function:

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

Reimplemented from BasicEvent.

151 {
153  {
154  while (!m_assistants.empty())
155  {
157  m_assistants.pop_front();
158 
159  if (assistant && assistant->CanAssistTo(&m_owner, victim))
160  {
161  assistant->SetNoCallAssistance(true);
162  assistant->CombatStart(victim);
163  if (assistant->IsAIEnabled)
164  assistant->AI()->AttackStart(victim);
165  }
166  }
167  }
168  return true;
169 }
ObjectGuid m_victim
Definition: Creature.h:800
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
void SetNoCallAssistance(bool val)
Definition: Creature.h:618
Unit & m_owner
Definition: Creature.h:802
Definition: Creature.h:467
bool IsAIEnabled
Definition: Unit.h:2161
bool CanAssistTo(const Unit *u, const Unit *enemy, bool checkfaction=true) const
Definition: Creature.cpp:2078
CreatureAI * AI() const
Definition: Creature.h:525
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
void CombatStart(Unit *target, bool initialAggro=true)
Definition: Unit.cpp:9862
GuidList m_assistants
Definition: Creature.h:801
Definition: Unit.h:1305
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:29

+ Here is the call graph for this function:

Member Data Documentation

GuidList AssistDelayEvent::m_assistants
private
Unit& AssistDelayEvent::m_owner
private
ObjectGuid AssistDelayEvent::m_victim
private

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