TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Trinity::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
 

Constructor & Destructor Documentation

Trinity::CallOfHelpCreatureInRangeDo::CallOfHelpCreatureInRangeDo ( Unit funit,
Unit enemy,
float  range 
)
inline
964  : i_funit(funit), i_enemy(enemy), i_range(range)
965  { }
float i_range
Definition: GridNotifiers.h:988
Unit *const i_enemy
Definition: GridNotifiers.h:987
Unit *const i_funit
Definition: GridNotifiers.h:986

Member Function Documentation

void Trinity::CallOfHelpCreatureInRangeDo::operator() ( Creature u)
inline
967  {
968  if (u == i_funit)
969  return;
970 
971  if (!u->CanAssistTo(i_funit, i_enemy, false))
972  return;
973 
974  // too far
976  return;
977 
978  // only if see assisted creature's enemy
979  if (!u->IsWithinLOSInMap(i_enemy))
980  return;
981 
982  if (u->AI())
983  u->AI()->AttackStart(i_enemy);
984  }
float i_range
Definition: GridNotifiers.h:988
Unit *const i_enemy
Definition: GridNotifiers.h:987
bool IsWithinLOSInMap(WorldObject const *obj) const
Definition: Object.cpp:1584
bool CanAssistTo(const Unit *u, const Unit *enemy, bool checkfaction=true) const
Definition: Creature.cpp:2078
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.cpp:1663
CreatureAI * AI() const
Definition: Creature.h:525
Unit *const i_funit
Definition: GridNotifiers.h:986
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:29

+ Here is the call graph for this function:

Member Data Documentation

Unit* const Trinity::CallOfHelpCreatureInRangeDo::i_enemy
private
Unit* const Trinity::CallOfHelpCreatureInRangeDo::i_funit
private
float Trinity::CallOfHelpCreatureInRangeDo::i_range
private

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