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
114: _source(source), _playerOnly(playerOnly) { }
Creature const * _source
Definition: UnitAI.h:118
bool _playerOnly
Definition: UnitAI.h:119

Member Function Documentation

◆ operator()()

bool NonTankTargetSelector::operator() ( Unit const *  target) const
424{
425 if (!target)
426 return false;
427
428 if (_playerOnly && target->GetTypeId() != TYPEID_PLAYER)
429 return false;
430
431 if (Unit* currentVictim = _source->GetThreatMgr().GetCurrentVictim())
432 return target != currentVictim;
433
434 return target != _source->GetVictim();
435}
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
Unit * GetCurrentVictim() const
Definition: ThreatMgr.h:213
Definition: Unit.h:1302
Unit * GetVictim() const
Definition: Unit.h:1398
ThreatMgr & GetThreatMgr()
Definition: Unit.h:2157

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

Member Data Documentation

◆ _playerOnly

bool NonTankTargetSelector::_playerOnly
private

Referenced by operator()().

◆ _source

Creature const* NonTankTargetSelector::_source
private

Referenced by operator()().