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

#include "Creature.h"

Inheritance diagram for AssistDelayEvent:
BasicEvent

Public Member Functions

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

Private Member Functions

 AssistDelayEvent ()
 

Private Attributes

ObjectGuid m_victim
 
GuidList m_assistants
 
Creaturem_owner
 

Detailed Description

Constructor & Destructor Documentation

◆ AssistDelayEvent() [1/2]

AssistDelayEvent::AssistDelayEvent ( ObjectGuid  victim,
Creature owner 
)
inline
525: BasicEvent(), m_victim(victim), m_owner(owner) { }
BasicEvent()=default
ObjectGuid m_victim
Definition: Creature.h:533
Creature * m_owner
Definition: Creature.h:535

◆ AssistDelayEvent() [2/2]

AssistDelayEvent::AssistDelayEvent ( )
private

Member Function Documentation

◆ AddAssistant()

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

References m_assistants.

Referenced by Creature::CallAssistance().

◆ Execute()

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

Reimplemented from BasicEvent.

220{
222 {
223 while (!m_assistants.empty())
224 {
226 m_assistants.pop_front();
227
228 if (assistant && assistant->CanAssistTo(m_owner, victim))
229 {
230 assistant->SetNoCallAssistance(true);
231 assistant->CombatStart(victim);
232 if (assistant->IsAIEnabled)
233 {
234 assistant->AI()->AttackStart(victim);
235
236 // When nearby mobs aggro from another mob's initial call for assistance
237 // their leash timers become linked and attacking one will keep the rest from evading.
238 if (assistant->GetVictim())
240 }
241 }
242 }
243 }
244 return true;
245}
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:202
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:213
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:27
Definition: Creature.h:46
std::shared_ptr< time_t > const & GetLastLeashExtensionTimePtr() const
Definition: Creature.cpp:3678
bool CanAssistTo(Unit const *u, Unit const *enemy, bool checkfaction=true) const
Definition: Creature.cpp:2486
void SetLastLeashExtensionTimePtr(std::shared_ptr< time_t > const &timer)
Definition: Creature.cpp:3685
void SetNoCallAssistance(bool val)
Definition: Creature.h:268
CreatureAI * AI() const
Definition: Creature.h:143
Definition: Unit.h:630
void CombatStart(Unit *target, bool initialAggro=true)
Definition: Unit.cpp:13586
Unit * GetVictim() const
Definition: Unit.h:789
bool IsAIEnabled
Definition: Unit.h:1801

References Creature::AI(), UnitAI::AttackStart(), Creature::CanAssistTo(), Unit::CombatStart(), ObjectAccessor::GetCreature(), Creature::GetLastLeashExtensionTimePtr(), ObjectAccessor::GetUnit(), Unit::GetVictim(), Unit::IsAIEnabled, m_assistants, m_owner, m_victim, Creature::SetLastLeashExtensionTimePtr(), and Creature::SetNoCallAssistance().

Member Data Documentation

◆ m_assistants

GuidList AssistDelayEvent::m_assistants
private

Referenced by AddAssistant(), and Execute().

◆ m_owner

Creature* AssistDelayEvent::m_owner
private

Referenced by Execute().

◆ m_victim

ObjectGuid AssistDelayEvent::m_victim
private

Referenced by Execute().