Core/Spells: merged a radius calculation from 3.3.5 that covers the attempted fix from last commit

This commit is contained in:
Ovahlord
2018-07-13 15:17:54 +02:00
parent 0d46b893fc
commit 0f32e2d263
4 changed files with 27 additions and 16 deletions

View File

@@ -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);
}