AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Acore::WorldObjectSpellAreaTargetCheck Struct Reference

#include "Spell.h"

Inheritance diagram for Acore::WorldObjectSpellAreaTargetCheck:
Acore::WorldObjectSpellTargetCheck Acore::WorldObjectSpellConeTargetCheck Acore::WorldObjectSpellTrajTargetCheck

Public Member Functions

 WorldObjectSpellAreaTargetCheck (float range, Position const *position, WorldObject *caster, WorldObject *referer, SpellInfo const *spellInfo, SpellTargetCheckTypes selectionType, ConditionList *condList, Acore::WorldObjectSpellAreaTargetSearchReason searchReason=Acore::WorldObjectSpellAreaTargetSearchReason::Area, SpellTargetReferenceTypes referenceType=TARGET_REFERENCE_TYPE_CASTER)
 
bool operator() (WorldObject *target)
 
- Public Member Functions inherited from Acore::WorldObjectSpellTargetCheck
 WorldObjectSpellTargetCheck (WorldObject *caster, WorldObject *referer, SpellInfo const *spellInfo, SpellTargetCheckTypes selectionType, ConditionList *condList)
 
 ~WorldObjectSpellTargetCheck ()
 
bool operator() (WorldObject *target)
 

Public Attributes

float _range
 
Position const * _position
 
Acore::WorldObjectSpellAreaTargetSearchReason _searchReason
 
SpellTargetReferenceTypes _referenceType
 
- Public Attributes inherited from Acore::WorldObjectSpellTargetCheck
WorldObject * _caster
 
WorldObject * _referer
 
SpellInfo const * _spellInfo
 
SpellTargetCheckTypes _targetSelectionType
 
ConditionSourceInfo * _condSrcInfo
 
ConditionList * _condList
 

Detailed Description

Constructor & Destructor Documentation

◆ WorldObjectSpellAreaTargetCheck()

Acore::WorldObjectSpellAreaTargetCheck::WorldObjectSpellAreaTargetCheck ( float  range,
Position const *  position,
WorldObject *  caster,
WorldObject *  referer,
SpellInfo const *  spellInfo,
SpellTargetCheckTypes  selectionType,
ConditionList *  condList,
Acore::WorldObjectSpellAreaTargetSearchReason  searchReason = Acore::WorldObjectSpellAreaTargetSearchReason::Area,
SpellTargetReferenceTypes  referenceType = TARGET_REFERENCE_TYPE_CASTER 
)
9486 : WorldObjectSpellTargetCheck(caster, referer, spellInfo, selectionType, condList), _range(range), _position(position), _searchReason(searchReason), _referenceType(referenceType)
9487 {
9488 }
float _range
Definition Spell.h:846
Position const * _position
Definition Spell.h:847
SpellTargetReferenceTypes _referenceType
Definition Spell.h:849
Acore::WorldObjectSpellAreaTargetSearchReason _searchReason
Definition Spell.h:848
WorldObjectSpellTargetCheck(WorldObject *caster, WorldObject *referer, SpellInfo const *spellInfo, SpellTargetCheckTypes selectionType, ConditionList *condList)
Definition Spell.cpp:9378

Member Function Documentation

◆ operator()()

bool Acore::WorldObjectSpellAreaTargetCheck::operator() ( WorldObject *  target)
9491 {
9492 if (target->IsGameObject())
9493 {
9495 return false;
9496 }
9497 else
9498 {
9500 {
9501 if (!target->IsWithinDist3d(_position, _range))
9502 return false;
9503 }
9507 {
9508 float effectiveRange = _range;
9509 // searcher also visits non-unit objects (corpses, dynobjects) when the spell can target them
9510 Unit const* unitCaster = _caster->ToUnit();
9511 if (Unit const* unitTarget = target->ToUnit())
9512 if (unitCaster && unitCaster->IsControlledByPlayer() && !unitTarget->IsControlledByPlayer())
9513 effectiveRange += unitTarget->GetCombatReach();
9514
9515 // override the range check for entry area targets
9516 // players stay 3d, retail never hits them in 2d
9517 float dist = target->GetExactDist(_position);
9519 dist = target->GetExactDist2d(_position);
9520 if (dist > effectiveRange)
9521 return false;
9522 }
9523 else
9524 {
9525 if (!target->IsWithinDist3d(_position, _range))
9526 return false;
9527 }
9528 }
9529
9530 if (Creature* c = target->ToCreature())
9531 {
9532 if (c->IsAvoidingAOE()) // pussywizard
9533 return false;
9534 if (CreatureImmunities const* immunities = sSpellMgr->GetCreatureImmunities(c->GetCreatureTemplate()->CreatureImmunitiesId))
9535 {
9536 switch (_searchReason)
9537 {
9539 if (immunities->ImmuneAoE)
9540 return false;
9541 break;
9543 if (immunities->ImmuneChain)
9544 return false;
9545 break;
9546 default:
9547 break;
9548 }
9549 }
9550 }
9552 }
@ TARGET_CHECK_ENTRY
Definition SpellInfo.h:116
@ TARGET_REFERENCE_TYPE_SRC
Definition SpellInfo.h:93
@ TARGET_REFERENCE_TYPE_TARGET
Definition SpellInfo.h:91
@ TARGET_REFERENCE_TYPE_DEST
Definition SpellInfo.h:94
#define sSpellMgr
Definition SpellMgr.h:851
Definition Creature.h:47
bool IsInRange3d(float x, float y, float z, float radius) const
Definition GameObject.cpp:2260
bool IsPlayer() const
Definition Object.h:207
bool IsGameObject() const
Definition Object.h:219
GameObject * ToGameObject()
Definition Object.h:220
Creature * ToCreature()
Definition Object.h:212
Unit * ToUnit()
Definition Object.h:216
Definition Unit.h:670
float GetCombatReach() const override
Definition Unit.h:884
bool IsControlledByPlayer() const
Definition Unit.h:1324
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition Object.cpp:1354
SpellTargetCheckTypes _targetSelectionType
Definition Spell.h:825
bool operator()(WorldObject *target)
Definition Spell.cpp:9394
WorldObject * _caster
Definition Spell.h:822
Definition SpellMgr.h:573
float GetExactDist2d(const float x, const float y) const
Definition Position.h:170
float GetExactDist(float x, float y, float z) const
Definition Position.h:182
float GetPositionZ() const
Definition Position.h:123
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122

References Acore::WorldObjectSpellTargetCheck::_caster, _position, _range, _referenceType, _searchReason, Acore::WorldObjectSpellTargetCheck::_targetSelectionType, Acore::Area, Acore::Chain, Unit::GetCombatReach(), Position::GetExactDist(), Position::GetExactDist2d(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Unit::IsControlledByPlayer(), Object::IsGameObject(), GameObject::IsInRange3d(), Object::IsPlayer(), WorldObject::IsWithinDist3d(), Acore::WorldObjectSpellTargetCheck::operator()(), sSpellMgr, TARGET_CHECK_ENTRY, TARGET_REFERENCE_TYPE_DEST, TARGET_REFERENCE_TYPE_SRC, TARGET_REFERENCE_TYPE_TARGET, Object::ToCreature(), Object::ToGameObject(), and Object::ToUnit().

Referenced by Acore::WorldObjectSpellConeTargetCheck::operator()().

Member Data Documentation

◆ _position

Position const* Acore::WorldObjectSpellAreaTargetCheck::_position

◆ _range

float Acore::WorldObjectSpellAreaTargetCheck::_range

◆ _referenceType

SpellTargetReferenceTypes Acore::WorldObjectSpellAreaTargetCheck::_referenceType

Referenced by operator()().

◆ _searchReason

Acore::WorldObjectSpellAreaTargetSearchReason Acore::WorldObjectSpellAreaTargetCheck::_searchReason

Referenced by operator()().


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