AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Acore::CallOfHelpCreatureInRangeDo Class Reference

#include "GridNotifiers.h"

Public Member Functions

 CallOfHelpCreatureInRangeDo (Unit *funit, Unit *enemy, float range)
 
void operator() (Creature *u)
 

Private Attributes

Unit *const i_funit
 
Unit *const i_enemy
 
float i_range
 

Detailed Description

Constructor & Destructor Documentation

◆ CallOfHelpCreatureInRangeDo()

Acore::CallOfHelpCreatureInRangeDo::CallOfHelpCreatureInRangeDo ( Unit funit,
Unit enemy,
float  range 
)
inline
1143 : i_funit(funit), i_enemy(enemy), i_range(range)
1144 {}
Unit *const i_enemy
Definition GridNotifiers.h:1167
float i_range
Definition GridNotifiers.h:1168
Unit *const i_funit
Definition GridNotifiers.h:1166

Member Function Documentation

◆ operator()()

void Acore::CallOfHelpCreatureInRangeDo::operator() ( Creature u)
inline
1146 {
1147 if (u == i_funit)
1148 return;
1149
1150 if (!u->CanAssistTo(i_funit, i_enemy, false))
1151 return;
1152
1153 // too far
1155 return;
1156
1157 // only if see assisted creature's enemy
1158 if (!u->IsWithinLOSInMap(i_enemy))
1159 return;
1160
1161 u->SetNoCallForHelp(true); // avoid recursive call for help causing stack overflow
1163 u->SetNoCallForHelp(false);
1164 }
void SetNoCallForHelp(bool val)
Definition Creature.h:270
bool CanAssistTo(Unit const *u, Unit const *enemy, bool checkfaction=true) const
Definition Creature.cpp:2458
void EngageWithTarget(Unit *who)
Definition Unit.cpp:7502
bool IsWithinLOSInMap(WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
Definition Object.cpp:1403
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1377

References Creature::CanAssistTo(), Unit::EngageWithTarget(), i_enemy, i_funit, i_range, WorldObject::IsWithinDistInMap(), WorldObject::IsWithinLOSInMap(), and Creature::SetNoCallForHelp().

Member Data Documentation

◆ i_enemy

Unit* const Acore::CallOfHelpCreatureInRangeDo::i_enemy
private

Referenced by operator()().

◆ i_funit

Unit* const Acore::CallOfHelpCreatureInRangeDo::i_funit
private

Referenced by operator()().

◆ i_range

float Acore::CallOfHelpCreatureInRangeDo::i_range
private

Referenced by operator()().


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