diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index 3669e1399..c9a0ec521 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -2773,7 +2773,7 @@ namespace Framework.Constants DestFrontLeft = 71, DestCasterRandom = 72, DestCasterRadius = 73, - DestRandom = 74, + DestTargetRandom = 74, DestRadius = 75, DestChannelTarget = 76, UnitChannelTarget = 77, diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 7986fa29d..3239f4e02 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -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); diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index 58effc70b..0d0d845fb 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -4413,17 +4413,26 @@ namespace Game.Spells // TargetA -> TargetARadiusEntry // TargetB -> TargetBRadiusEntry // Aura effects have TargetARadiusEntry == TargetBRadiusEntry (mostly) + SpellImplicitTargetInfo target = TargetA; var entry = TargetARadiusEntry; if (targetIndex == SpellTargetIndex.TargetB && HasRadius(targetIndex)) + { + target = TargetB; entry = TargetBRadiusEntry; + } if (entry == null) return 0.0f; float radius = entry.RadiusMin; - // Client uses max if min is 0 - if (radius == 0.0f) + // Random targets use random value between RadiusMin and RadiusMax + // For other cases, client uses RadiusMax if RadiusMin is 0 + if (target.GetTarget() == Targets.DestCasterRandom || + target.GetTarget() == Targets.DestTargetRandom || + target.GetTarget() == Targets.DestDestRandom) + radius += (entry.RadiusMax - radius) * RandomHelper.NextSingle(); + else if (radius == 0.0f) radius = entry.RadiusMax; if (caster != null)