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

#include "GridNotifiers.h"

Public Member Functions

 MostHPPercentMissingInRange (Unit const *obj, float range, uint32 minHpPct, uint32 maxHpPct)
 
bool operator() (Unit *u)
 

Private Attributes

Unit const * i_obj
 
float i_range
 
float i_minHpPct
 
float i_maxHpPct
 
float i_hpPct
 

Detailed Description

Constructor & Destructor Documentation

◆ MostHPPercentMissingInRange()

Acore::MostHPPercentMissingInRange::MostHPPercentMissingInRange ( Unit const *  obj,
float  range,
uint32  minHpPct,
uint32  maxHpPct 
)
inline
796 :
797 i_obj(obj), i_range(range), i_minHpPct(minHpPct), i_maxHpPct(maxHpPct), i_hpPct(101.f) { }
float i_range
Definition: GridNotifiers.h:813
float i_minHpPct
Definition: GridNotifiers.h:814
float i_hpPct
Definition: GridNotifiers.h:814
Unit const * i_obj
Definition: GridNotifiers.h:812
float i_maxHpPct
Definition: GridNotifiers.h:814

Member Function Documentation

◆ operator()()

bool Acore::MostHPPercentMissingInRange::operator() ( Unit u)
inline
800 {
801 if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
802 i_minHpPct <= u->GetHealthPct() && u->GetHealthPct() <= i_maxHpPct && u->GetHealthPct() < i_hpPct)
803 {
804 i_hpPct = u->GetHealthPct();
805 return true;
806 }
807
808 return false;
809 }
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1332
float GetHealthPct() const
Definition: Unit.h:1031
bool IsAlive() const
Definition: Unit.h:1654
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:10236
bool IsInCombat() const
Definition: Unit.h:884

References Unit::GetHealthPct(), i_hpPct, i_maxHpPct, i_obj, i_range, Unit::IsAlive(), Unit::IsHostileTo(), Unit::IsInCombat(), and WorldObject::IsWithinDistInMap().

Member Data Documentation

◆ i_hpPct

float Acore::MostHPPercentMissingInRange::i_hpPct
private

Referenced by operator()().

◆ i_maxHpPct

float Acore::MostHPPercentMissingInRange::i_maxHpPct
private

Referenced by operator()().

◆ i_minHpPct

float Acore::MostHPPercentMissingInRange::i_minHpPct
private

◆ i_obj

Unit const* Acore::MostHPPercentMissingInRange::i_obj
private

Referenced by operator()().

◆ i_range

float Acore::MostHPPercentMissingInRange::i_range
private

Referenced by operator()().