TrinityCore
PlayerAI Class Reference

#include <PlayerAI.h>

+ Inheritance diagram for PlayerAI:

Classes

struct  TargetedSpell
 

Public Member Functions

 PlayerAI (Player *player)
 
CreatureGetCharmer () const
 
ChrSpecialization GetSpec (Player const *who=nullptr) const
 
bool IsHealer (Player const *who=nullptr) const
 
bool IsRangedAttacker (Player const *who=nullptr) const
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void AttackStart (Unit *victim)
 
virtual void UpdateAI (uint32 diff)=0
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool isNew)
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid const &, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectTargetMethod targetType, uint32 offset, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 offset, PREDICATE const &predicate)
 
virtual void JustEnteredCombat (Unit *)
 
virtual void JustExitedCombat ()
 
virtual void OnDespawn ()
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellInfo const *)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void HealDone (Unit *, uint32 &)
 
virtual void SpellInterrupted (uint32, uint32)
 
void AttackStartCaster (Unit *victim, float dist)
 
SpellCastResult DoCast (uint32 spellId)
 
SpellCastResult DoCast (Unit *victim, uint32 spellId, CastSpellExtraArgs const &args={})
 
SpellCastResult DoCastSelf (uint32 spellId, CastSpellExtraArgs const &args={})
 
SpellCastResult DoCastVictim (uint32 spellId, CastSpellExtraArgs const &args={})
 
SpellCastResult DoCastAOE (uint32 spellId, CastSpellExtraArgs const &args={})
 
bool DoSpellAttackIfReady (uint32 spellId)
 
virtual void OnGameEvent (bool, uint16)
 
virtual std::string GetDebugInfo () const
 

Static Public Member Functions

static bool IsPlayerHealer (Player const *who)
 
static bool IsPlayerRangedAttacker (Player const *who)
 
- Static Public Member Functions inherited from UnitAI
static void FillAISpellInfo ()
 

Protected Types

enum  SpellTarget { TARGET_NONE , TARGET_VICTIM , TARGET_CHARMER , TARGET_SELF }
 
typedef std::pair< TargetedSpell, uint32PossibleSpell
 
typedef std::vector< PossibleSpellPossibleSpellVector
 

Protected Member Functions

void SetIsRangedAttacker (bool state)
 
TargetedSpell VerifySpellCast (uint32 spellId, Unit *target)
 
TargetedSpell VerifySpellCast (uint32 spellId, SpellTarget target)
 
template<typename T >
void VerifyAndPushSpellCast (PossibleSpellVector &spells, uint32 spellId, T target, uint32 weight)
 
TargetedSpell SelectSpellCast (PossibleSpellVector &spells)
 
void DoCastAtTarget (TargetedSpell spell)
 
virtual UnitSelectAttackTarget () const
 
void DoRangedAttackIfReady ()
 
void DoAutoAttackIfReady ()
 
void CancelAllShapeshifts ()
 

Protected Attributes

Player *const me
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Private Attributes

ChrSpecialization const _selfSpec
 
bool const _isSelfHealer
 
bool _isSelfRangedAttacker
 

Additional Inherited Members

- Static Public Attributes inherited from UnitAI
static std::unordered_map< std::pair< uint32, Difficulty >, AISpellInfoTypeAISpellInfo
 

Detailed Description

Definition at line 27 of file PlayerAI.h.

Member Typedef Documentation

◆ PossibleSpell

typedef std::pair<TargetedSpell, uint32> PlayerAI::PossibleSpell
protected

Definition at line 48 of file PlayerAI.h.

◆ PossibleSpellVector

typedef std::vector<PossibleSpell> PlayerAI::PossibleSpellVector
protected

Definition at line 49 of file PlayerAI.h.

Member Enumeration Documentation

◆ SpellTarget

enum PlayerAI::SpellTarget
protected
Enumerator
TARGET_NONE 
TARGET_VICTIM 
TARGET_CHARMER 
TARGET_SELF 

Definition at line 54 of file PlayerAI.h.

Constructor & Destructor Documentation

◆ PlayerAI()

PlayerAI::PlayerAI ( Player player)
explicit

Definition at line 395 of file PlayerAI.cpp.

Member Function Documentation

◆ CancelAllShapeshifts()

void PlayerAI::CancelAllShapeshifts ( )
protected

Definition at line 596 of file PlayerAI.cpp.

+ Here is the call graph for this function:

◆ DoAutoAttackIfReady()

void PlayerAI::DoAutoAttackIfReady ( )
protected

Definition at line 590 of file PlayerAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoCastAtTarget()

void PlayerAI::DoCastAtTarget ( TargetedSpell  spell)
protected

Definition at line 529 of file PlayerAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoRangedAttackIfReady()

void PlayerAI::DoRangedAttackIfReady ( )
protected

Definition at line 536 of file PlayerAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCharmer()

Creature * PlayerAI::GetCharmer ( ) const

Definition at line 402 of file PlayerAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSpec()

ChrSpecialization PlayerAI::GetSpec ( Player const *  who = nullptr) const

Definition at line 409 of file PlayerAI.cpp.

+ Here is the call graph for this function:

◆ IsHealer()

bool PlayerAI::IsHealer ( Player const *  who = nullptr) const
inline

Definition at line 37 of file PlayerAI.h.

◆ IsPlayerHealer()

bool PlayerAI::IsPlayerHealer ( Player const *  who)
static

Definition at line 414 of file PlayerAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsPlayerRangedAttacker()

bool PlayerAI::IsPlayerRangedAttacker ( Player const *  who)
static

Definition at line 423 of file PlayerAI.cpp.

+ Here is the call graph for this function:

◆ IsRangedAttacker()

bool PlayerAI::IsRangedAttacker ( Player const *  who = nullptr) const
inline

Definition at line 39 of file PlayerAI.h.

+ Here is the caller graph for this function:

◆ SelectAttackTarget()

Unit * PlayerAI::SelectAttackTarget ( ) const
protectedvirtual

Reimplemented in SimpleCharmedPlayerAI, and KelThuzadCharmedPlayerAI.

Definition at line 619 of file PlayerAI.cpp.

+ Here is the call graph for this function:

◆ SelectSpellCast()

PlayerAI::TargetedSpell PlayerAI::SelectSpellCast ( PossibleSpellVector spells)
protected

Definition at line 497 of file PlayerAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetIsRangedAttacker()

void PlayerAI::SetIsRangedAttacker ( bool  state)
inlineprotected

Definition at line 52 of file PlayerAI.h.

◆ VerifyAndPushSpellCast()

template<typename T >
void PlayerAI::VerifyAndPushSpellCast ( PossibleSpellVector spells,
uint32  spellId,
target,
uint32  weight 
)
inlineprotected

Definition at line 69 of file PlayerAI.h.

◆ VerifySpellCast() [1/2]

PlayerAI::TargetedSpell PlayerAI::VerifySpellCast ( uint32  spellId,
SpellTarget  target 
)
protected

Definition at line 472 of file PlayerAI.cpp.

+ Here is the call graph for this function:

◆ VerifySpellCast() [2/2]

PlayerAI::TargetedSpell PlayerAI::VerifySpellCast ( uint32  spellId,
Unit target 
)
protected

Definition at line 432 of file PlayerAI.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _isSelfHealer

bool const PlayerAI::_isSelfHealer
private

Definition at line 90 of file PlayerAI.h.

◆ _isSelfRangedAttacker

bool PlayerAI::_isSelfRangedAttacker
private

Definition at line 91 of file PlayerAI.h.

◆ _selfSpec

ChrSpecialization const PlayerAI::_selfSpec
private

Definition at line 89 of file PlayerAI.h.

◆ me

Player* const PlayerAI::me
protected

Definition at line 51 of file PlayerAI.h.


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