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
524: BasicEvent(), m_victim(victim), m_owner(owner) { }
BasicEvent()=default
ObjectGuid m_victim
Definition: Creature.h:532
Creature * m_owner
Definition: Creature.h:534

◆ AssistDelayEvent() [2/2]

AssistDelayEvent::AssistDelayEvent ( )
private

Member Function Documentation

◆ AddAssistant()

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

References m_assistants.

Referenced by Creature::CallAssistance().

◆ Execute()

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

Reimplemented from BasicEvent.

219{
221 {
222 while (!m_assistants.empty())
223 {
225 m_assistants.pop_front();
226
227 if (assistant && assistant->CanAssistTo(m_owner, victim))
228 {
229 assistant->SetNoCallAssistance(true);
230 assistant->CombatStart(victim);
231 if (assistant->IsAIEnabled)
232 {
233 assistant->AI()->AttackStart(victim);
234
235 // When nearby mobs aggro from another mob's initial call for assistance
236 // their leash timers become linked and attacking one will keep the rest from evading.
237 if (assistant->GetVictim())
239 }
240 }
241 }
242 }
243 return true;
244}
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:199
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:210
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:27
Definition: Creature.h:43
std::shared_ptr< time_t > const & GetLastLeashExtensionTimePtr() const
Definition: Creature.cpp:3689
bool CanAssistTo(Unit const *u, Unit const *enemy, bool checkfaction=true) const
Definition: Creature.cpp:2489
void SetLastLeashExtensionTimePtr(std::shared_ptr< time_t > const &timer)
Definition: Creature.cpp:3696
void SetNoCallAssistance(bool val)
Definition: Creature.h:267
CreatureAI * AI() const
Definition: Creature.h:140
Definition: Unit.h:630
void CombatStart(Unit *target, bool initialAggro=true)
Definition: Unit.cpp:13624
Unit * GetVictim() const
Definition: Unit.h:853
bool IsAIEnabled
Definition: Unit.h:1919

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().