Core/Spells: Fixed target radius calculation for TARGET_DEST_*_RANDOM

Port From (https://github.com/TrinityCore/TrinityCore/commit/87f3ab11d3dd5d362657aaae9c02effa8ee95f21)
This commit is contained in:
hondacrx
2024-02-03 22:02:40 -05:00
parent 136ad2cff0
commit 4d0362edc6
3 changed files with 13 additions and 8 deletions
+1 -5
View File
@@ -1114,7 +1114,7 @@ namespace Game.Spells
break;
case Targets.DestCasterRandom:
if (dist > objSize)
dist = objSize + (dist - objSize) * RandomHelper.NextSingle();
dist = objSize + (dist - objSize);
break;
case Targets.DestCasterFrontLeft:
case Targets.DestCasterBackLeft:
@@ -1164,8 +1164,6 @@ namespace Game.Spells
{
float angle = targetType.CalcDirectionAngle();
float dist = spellEffectInfo.CalcRadius(null, targetIndex);
if (targetType.GetTarget() == Targets.DestRandom)
dist *= RandomHelper.NextSingle();
Position pos = new(dest.Position);
target.MovePositionToFirstCollision(pos, dist, angle);
@@ -1218,8 +1216,6 @@ namespace Game.Spells
{
float angle = targetType.CalcDirectionAngle();
float dist = spellEffectInfo.CalcRadius(m_caster, targetIndex);
if (targetType.GetTarget() == Targets.DestRandom)
dist *= RandomHelper.NextSingle();
Position pos = new(m_targets.GetDstPos());
m_caster.MovePositionToFirstCollision(pos, dist, angle);