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
1150 : i_funit(funit), i_enemy(enemy), i_range(range)
1151 {}
Unit *const i_enemy
Definition: GridNotifiers.h:1173
float i_range
Definition: GridNotifiers.h:1174
Unit *const i_funit
Definition: GridNotifiers.h:1172

Member Function Documentation

◆ operator()()

void Acore::CallOfHelpCreatureInRangeDo::operator() ( Creature u)
inline
1153 {
1154 if (u == i_funit)
1155 return;
1156
1157 if (!u->CanAssistTo(i_funit, i_enemy, false))
1158 return;
1159
1160 // too far
1162 return;
1163
1164 // only if see assisted creature's enemy
1165 if (!u->IsWithinLOSInMap(i_enemy))
1166 return;
1167
1168 if (u->AI())
1169 u->AI()->AttackStart(i_enemy);
1170 }
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:27
bool CanAssistTo(Unit const *u, Unit const *enemy, bool checkfaction=true) const
Definition: Creature.cpp:2486
CreatureAI * AI() const
Definition: Creature.h:143
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:1347
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1321

References Creature::AI(), UnitAI::AttackStart(), Creature::CanAssistTo(), i_enemy, i_funit, i_range, WorldObject::IsWithinDistInMap(), and WorldObject::IsWithinLOSInMap().

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