AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
NonTankTargetSelector Struct Reference

#include "UnitAI.h"

Inheritance diagram for NonTankTargetSelector:
Acore::unary_function< Unit *, bool >

Public Member Functions

 NonTankTargetSelector (Creature *source, bool playerOnly=true)
 
bool operator() (Unit const *target) const
 

Private Attributes

Creature const * _source
 
bool _playerOnly
 

Additional Inherited Members

- Public Types inherited from Acore::unary_function< Unit *, bool >
typedef Unitargument_type
 
typedef bool result_type
 

Detailed Description

Constructor & Destructor Documentation

◆ NonTankTargetSelector()

NonTankTargetSelector::NonTankTargetSelector ( Creature source,
bool  playerOnly = true 
)
inline
125: _source(source), _playerOnly(playerOnly) { }
Creature const * _source
Definition: UnitAI.h:129
bool _playerOnly
Definition: UnitAI.h:130

Member Function Documentation

◆ operator()()

bool NonTankTargetSelector::operator() ( Unit const *  target) const
426{
427 if (!target)
428 return false;
429
430 if (_playerOnly && !target->IsPlayer())
431 return false;
432
433 if (Unit* currentVictim = _source->GetThreatMgr().GetCurrentVictim())
434 return target != currentVictim;
435
436 return target != _source->GetVictim();
437}
Unit * GetCurrentVictim() const
Definition: ThreatMgr.h:213
Definition: Unit.h:630
Unit * GetVictim() const
Definition: Unit.h:789
ThreatMgr & GetThreatMgr()
Definition: Unit.h:839

References _playerOnly, _source, ThreatMgr::GetCurrentVictim(), Unit::GetThreatMgr(), Unit::GetVictim(), and Object::IsPlayer().

Member Data Documentation

◆ _playerOnly

bool NonTankTargetSelector::_playerOnly
private

Referenced by operator()().

◆ _source

Creature const* NonTankTargetSelector::_source
private

Referenced by operator()().