mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Spells: Fixed target radius calculation for TARGET_DEST_*_RANDOM (#29479)
This commit is contained in:
@@ -674,17 +674,26 @@ float SpellEffectInfo::CalcRadius(WorldObject* caster /*= nullptr*/, SpellTarget
|
||||
// TargetA -> TargetARadiusEntry
|
||||
// TargetB -> TargetBRadiusEntry
|
||||
// Aura effects have TargetARadiusEntry == TargetBRadiusEntry (mostly)
|
||||
SpellImplicitTargetInfo target = TargetA;
|
||||
SpellRadiusEntry const* entry = TargetARadiusEntry;
|
||||
if (targetIndex == SpellTargetIndex::TargetB && HasRadius(targetIndex))
|
||||
{
|
||||
target = TargetB;
|
||||
entry = TargetBRadiusEntry;
|
||||
}
|
||||
|
||||
if (!entry)
|
||||
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() == TARGET_DEST_CASTER_RANDOM ||
|
||||
target.GetTarget() == TARGET_DEST_TARGET_RANDOM ||
|
||||
target.GetTarget() == TARGET_DEST_DEST_RANDOM)
|
||||
radius += (entry->RadiusMax - radius) * rand_norm();
|
||||
else if (radius == 0.0f)
|
||||
radius = entry->RadiusMax;
|
||||
|
||||
if (caster)
|
||||
|
||||
Reference in New Issue
Block a user