Core/Random: Changed random functions returning doubles to return floats
Port From (https://github.com/TrinityCore/TrinityCore/commit/9894f6b802c974bb36acd7fbb0d083455a1f0f1b)
This commit is contained in:
@@ -995,9 +995,9 @@ namespace Game.Spells
|
||||
{
|
||||
float minDist = m_spellInfo.GetMinRange(true);
|
||||
float maxDist = m_spellInfo.GetMaxRange(true);
|
||||
float dis = (float)RandomHelper.NextDouble() * (maxDist - minDist) + minDist;
|
||||
float dis = RandomHelper.NextSingle() * (maxDist - minDist) + minDist;
|
||||
float x, y, z;
|
||||
float angle = (float)RandomHelper.NextDouble() * (MathFunctions.PI * 35.0f / 180.0f) - (float)(Math.PI * 17.5f / 180.0f);
|
||||
float angle = RandomHelper.NextSingle() * (MathF.PI * 35.0f / 180.0f) - (MathF.PI * 17.5f / 180.0f);
|
||||
m_caster.GetClosePoint(out x, out y, out z, SharedConst.DefaultPlayerBoundingRadius, dis, angle);
|
||||
|
||||
float ground = m_caster.GetMapHeight(x, y, z);
|
||||
@@ -1114,7 +1114,7 @@ namespace Game.Spells
|
||||
break;
|
||||
case Targets.DestCasterRandom:
|
||||
if (dist > objSize)
|
||||
dist = objSize + (dist - objSize) * (float)RandomHelper.NextDouble();
|
||||
dist = objSize + (dist - objSize) * RandomHelper.NextSingle();
|
||||
break;
|
||||
case Targets.DestCasterFrontLeft:
|
||||
case Targets.DestCasterBackLeft:
|
||||
@@ -1165,7 +1165,7 @@ namespace Game.Spells
|
||||
float angle = targetType.CalcDirectionAngle();
|
||||
float dist = spellEffectInfo.CalcRadius(null, targetIndex);
|
||||
if (targetType.GetTarget() == Targets.DestRandom)
|
||||
dist *= (float)RandomHelper.NextDouble();
|
||||
dist *= RandomHelper.NextSingle();
|
||||
|
||||
Position pos = new(dest.Position);
|
||||
target.MovePositionToFirstCollision(pos, dist, angle);
|
||||
@@ -1219,7 +1219,7 @@ namespace Game.Spells
|
||||
float angle = targetType.CalcDirectionAngle();
|
||||
float dist = spellEffectInfo.CalcRadius(m_caster, targetIndex);
|
||||
if (targetType.GetTarget() == Targets.DestRandom)
|
||||
dist *= (float)RandomHelper.NextDouble();
|
||||
dist *= RandomHelper.NextSingle();
|
||||
|
||||
Position pos = new(m_targets.GetDstPos());
|
||||
m_caster.MovePositionToFirstCollision(pos, dist, angle);
|
||||
|
||||
@@ -4129,7 +4129,7 @@ namespace Game.Spells
|
||||
//GO is always friendly to it's creator, get range for friends
|
||||
float min_dis = m_spellInfo.GetMinRange(true);
|
||||
float max_dis = m_spellInfo.GetMaxRange(true);
|
||||
float dis = (float)RandomHelper.NextDouble() * (max_dis - min_dis) + min_dis;
|
||||
float dis = RandomHelper.NextSingle() * (max_dis - min_dis) + min_dis;
|
||||
|
||||
unitCaster.GetClosePoint(out fx, out fy, out fz, SharedConst.DefaultPlayerBoundingRadius, dis);
|
||||
fo = unitCaster.GetOrientation();
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Game.Spells
|
||||
continue;
|
||||
|
||||
_effects.EnsureWritableListIndex((uint)spellEffect.EffectIndex, new SpellEffectInfo(this));
|
||||
_effects[(int)spellEffect.EffectIndex] = new SpellEffectInfo(this, spellEffect);
|
||||
_effects[spellEffect.EffectIndex] = new SpellEffectInfo(this, spellEffect);
|
||||
}
|
||||
|
||||
// Correct EffectIndex for blank effects
|
||||
@@ -1007,7 +1007,7 @@ namespace Game.Spells
|
||||
|
||||
if (HasAttribute(SpellAttr8.OnlyTargetIfSameCreator))
|
||||
{
|
||||
ObjectGuid getCreatorOrSelf(WorldObject obj)
|
||||
var getCreatorOrSelf = (WorldObject obj) =>
|
||||
{
|
||||
ObjectGuid creator = obj.GetCreatorGUID();
|
||||
if (creator.IsEmpty())
|
||||
@@ -5005,7 +5005,7 @@ namespace Game.Spells
|
||||
case SpellTargetDirectionTypes.FrontLeft:
|
||||
return pi / 4;
|
||||
case SpellTargetDirectionTypes.Random:
|
||||
return (float)RandomHelper.NextDouble() * (2 * pi);
|
||||
return RandomHelper.NextSingle() * (2 * pi);
|
||||
default:
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user