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

#include "GridNotifiers.h"

Public Member Functions

 MostHPMissingInRange (Unit const *obj, float range, uint32 hp)
 
bool operator() (Unit *u)
 

Private Attributes

Unit const * i_obj
 
float i_range
 
uint32 i_hp
 

Detailed Description

Constructor & Destructor Documentation

◆ MostHPMissingInRange()

Acore::MostHPMissingInRange::MostHPMissingInRange ( Unit const *  obj,
float  range,
uint32  hp 
)
inline
777: i_obj(obj), i_range(range), i_hp(hp) {}
uint32 i_hp
Definition: GridNotifiers.h:790
Unit const * i_obj
Definition: GridNotifiers.h:788
float i_range
Definition: GridNotifiers.h:789

Member Function Documentation

◆ operator()()

bool Acore::MostHPMissingInRange::operator() ( Unit u)
inline
779 {
780 if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
781 {
782 i_hp = u->GetMaxHealth() - u->GetHealth();
783 return true;
784 }
785 return false;
786 }
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1332
uint32 GetMaxHealth() const
Definition: Unit.h:1030
bool IsAlive() const
Definition: Unit.h:1654
uint32 GetHealth() const
Definition: Unit.h:1029
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:10236
bool IsInCombat() const
Definition: Unit.h:884

References Unit::GetHealth(), Unit::GetMaxHealth(), i_hp, i_obj, i_range, Unit::IsAlive(), Unit::IsHostileTo(), Unit::IsInCombat(), and WorldObject::IsWithinDistInMap().

Member Data Documentation

◆ i_hp

uint32 Acore::MostHPMissingInRange::i_hp
private

Referenced by operator()().

◆ i_obj

Unit const* Acore::MostHPMissingInRange::i_obj
private

Referenced by operator()().

◆ i_range

float Acore::MostHPMissingInRange::i_range
private

Referenced by operator()().