mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 10:56:38 +01:00
Core/Spells: merged a radius calculation from 3.3.5 that covers the attempted fix from last commit
This commit is contained in:
@@ -7952,8 +7952,20 @@ WorldObjectSpellAreaTargetCheck::WorldObjectSpellAreaTargetCheck(float range, Po
|
||||
|
||||
bool WorldObjectSpellAreaTargetCheck::operator()(WorldObject* target)
|
||||
{
|
||||
if (!target->IsWithinDist3d(_position, _range, true) && !(target->ToGameObject() && target->ToGameObject()->IsInRange(_position->GetPositionX(), _position->GetPositionY(), _position->GetPositionZ(), _range)))
|
||||
return false;
|
||||
if (target->ToGameObject())
|
||||
{
|
||||
// isInRange including the dimension of the GO
|
||||
bool isInRange = target->ToGameObject()->IsInRange(_position->GetPositionX(), _position->GetPositionY(), _position->GetPositionZ(), _range);
|
||||
if (!isInRange)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isInsideCylinder = target->IsWithinDist2d(_position, _range) && std::abs(target->GetPositionZ() - _position->GetPositionZ()) <= _range;
|
||||
if (!isInsideCylinder)
|
||||
return false;
|
||||
}
|
||||
|
||||
return WorldObjectSpellTargetCheck::operator ()(target);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user