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
793 :
794 i_obj(obj), i_range(range), i_minHpPct(minHpPct), i_maxHpPct(maxHpPct), i_hpPct(101.f) { }
float i_range
Definition: GridNotifiers.h:810
float i_minHpPct
Definition: GridNotifiers.h:811
float i_hpPct
Definition: GridNotifiers.h:811
Unit const * i_obj
Definition: GridNotifiers.h:809
float i_maxHpPct
Definition: GridNotifiers.h:811

Member Function Documentation

◆ operator()()

bool Acore::MostHPPercentMissingInRange::operator() ( Unit u)
inline
797 {
798 if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
799 i_minHpPct <= u->GetHealthPct() && u->GetHealthPct() <= i_maxHpPct && u->GetHealthPct() < i_hpPct)
800 {
801 i_hpPct = u->GetHealthPct();
802 return true;
803 }
804
805 return false;
806 }
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1321
float GetHealthPct() const
Definition: Unit.h:1448
bool IsAlive() const
Definition: Unit.h:1808
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:10209
bool IsInCombat() const
Definition: Unit.h:1688

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