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 * _source
 
bool _playerOnly
 

Additional Inherited Members

- Public Types inherited from Acore::unary_function< Unit *, bool >
typedef Unit * argument_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 * _source
Definition UnitAI.h:129
bool _playerOnly
Definition UnitAI.h:130

Member Function Documentation

◆ operator()()

bool NonTankTargetSelector::operator() ( Unit const *  target) const
538{
539 if (!target)
540 return false;
541
542 if (_playerOnly && !target->IsPlayer())
543 return false;
544
545 if (Unit* currentVictim = _source->GetThreatMgr().GetCurrentVictim())
546 return target != currentVictim;
547
548 return target != _source->GetVictim();
549}
Unit * GetCurrentVictim()
Definition ThreatManager.cpp:266
Definition Unit.h:670
Unit * GetVictim() const
Definition Unit.h:910
ThreatManager & GetThreatMgr()
Definition Unit.h:965

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

Member Data Documentation

◆ _playerOnly

bool NonTankTargetSelector::_playerOnly
private

Referenced by operator()().

◆ _source

Creature* NonTankTargetSelector::_source
private

Referenced by operator()().


The documentation for this struct was generated from the following files: