Core/Spells: Fixed target radius calculation for TARGET_DEST_*_RANDOM
Port From (https://github.com/TrinityCore/TrinityCore/commit/87f3ab11d3dd5d362657aaae9c02effa8ee95f21)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user