Core/Spells: Adjust range checks to GameObject targets
Port From (https://github.com/TrinityCore/TrinityCore/commit/7a2ef474952e6d57f4d8282a8cd3d068dcf3f38c)
This commit is contained in:
@@ -5737,6 +5737,7 @@ namespace Game.Spells
|
||||
maxRange += Math.Min(3.0f, maxRange * 0.1f); // 10% but no more than 3.0f
|
||||
|
||||
// save the original values before squaring them
|
||||
float origMinRange = minRange;
|
||||
float origMaxRange = maxRange;
|
||||
|
||||
// get square values for sqr distance checks
|
||||
@@ -5761,6 +5762,9 @@ namespace Game.Spells
|
||||
GameObject goTarget = m_targets.GetGOTarget();
|
||||
if (goTarget != null)
|
||||
{
|
||||
if (origMinRange > 0.0f && goTarget.IsInRange(m_caster.GetPositionX(), m_caster.GetPositionY(), m_caster.GetPositionZ(), origMinRange))
|
||||
return SpellCastResult.OutOfRange;
|
||||
|
||||
if (!goTarget.IsInRange(m_caster.GetPositionX(), m_caster.GetPositionY(), m_caster.GetPositionZ(), origMaxRange))
|
||||
return SpellCastResult.OutOfRange;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user