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 
)
9443 : WorldObjectSpellTargetCheck(caster, referer, spellInfo, selectionType, condList), _range(range), _position(position), _searchReason(searchReason), _referenceType(referenceType)
9444 {
9445 }
float _range
Definition Spell.h:840
Position const * _position
Definition Spell.h:841
SpellTargetReferenceTypes _referenceType
Definition Spell.h:843
Acore::WorldObjectSpellAreaTargetSearchReason _searchReason
Definition Spell.h:842
WorldObjectSpellTargetCheck(WorldObject *caster, WorldObject *referer, SpellInfo const *spellInfo, SpellTargetCheckTypes selectionType, ConditionList *condList)
Definition Spell.cpp:9340

Member Function Documentation

◆ operator()()

bool Acore::WorldObjectSpellAreaTargetCheck::operator() ( WorldObject *  target)
9448 {
9449 if (target->IsGameObject())
9450 {
9452 return false;
9453 }
9454 else
9455 {
9457 {
9458 if (!target->IsWithinDist3d(_position, _range))
9459 return false;
9460 }
9464 {
9465 float effectiveRange = _range;
9466 // searcher also visits non-unit objects (corpses, dynobjects) when the spell can target them
9467 Unit const* unitCaster = _caster->ToUnit();
9468 if (Unit const* unitTarget = target->ToUnit())
9469 if (unitCaster && unitCaster->IsControlledByPlayer() && !unitTarget->IsControlledByPlayer())
9470 effectiveRange += unitTarget->GetCombatReach();
9471
9472 // override the range check for entry area targets
9473 float dist = target->GetExactDist(_position);
9475 dist = target->GetExactDist2d(_position);
9476 if (dist > effectiveRange)
9477 return false;
9478 }
9479 else
9480 {
9481 if (!target->IsWithinDist3d(_position, _range))
9482 return false;
9483 }
9484 }
9485
9486 if (Creature* c = target->ToCreature())
9487 {
9488 if (c->IsAvoidingAOE()) // pussywizard
9489 return false;
9490 if (CreatureImmunities const* immunities = sSpellMgr->GetCreatureImmunities(c->GetCreatureTemplate()->CreatureImmunitiesId))
9491 {
9492 switch (_searchReason)
9493 {
9495 if (immunities->ImmuneAoE)
9496 return false;
9497 break;
9499 if (immunities->ImmuneChain)
9500 return false;
9501 break;
9502 default:
9503 break;
9504 }
9505 }
9506 }
9508 }
@ 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:847
Definition Creature.h:47
bool IsInRange3d(float x, float y, float z, float radius) const
Definition GameObject.cpp:2197
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:665
float GetCombatReach() const override
Definition Unit.h:878
bool IsControlledByPlayer() const
Definition Unit.h:1312
bool IsWithinDist3d(float x, float y, float z, float dist) const
Definition Object.cpp:1354
SpellTargetCheckTypes _targetSelectionType
Definition Spell.h:819
bool operator()(WorldObject *target)
Definition Spell.cpp:9356
WorldObject * _caster
Definition Spell.h:816
Definition SpellMgr.h:571
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(), 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: