AiModtpDifficultyCalculator.tpHitObject.SpacingWeight C# (CSharp) Method

SpacingWeight() private static method

private static SpacingWeight ( double distance, AiModtpDifficulty Type ) : double
distance double
Type AiModtpDifficulty
return double
        private static double SpacingWeight(double distance, AiModtpDifficulty.DifficultyType Type)
        {
            switch(Type)
            {
                case AiModtpDifficulty.DifficultyType.Speed:

                    {
                        double Weight;

                        if (distance > SINGLE_SPACING_TRESHOLD)
                        {
                            Weight = 2.5;
                        }
                        else if (distance > STREAM_SPACING_TRESHOLD)
                        {
                            Weight = 1.6 + 0.9 * (distance - STREAM_SPACING_TRESHOLD) / (SINGLE_SPACING_TRESHOLD - STREAM_SPACING_TRESHOLD);
                        }
                        else if (distance > ALMOST_DIAMETER)
                        {
                            Weight = 1.2 + 0.4 * (distance - ALMOST_DIAMETER) / (STREAM_SPACING_TRESHOLD - ALMOST_DIAMETER);
                        }
                        else if (distance > ALMOST_DIAMETER / 2)
                        {
                            Weight = 0.95 + 0.25 * (distance - (ALMOST_DIAMETER / 2)) / (ALMOST_DIAMETER / 2);
                        }
                        else
                        {
                            Weight = 0.95;
                        }

                        return Weight;
                    }

                case AiModtpDifficulty.DifficultyType.Aim:

                    return Math.Pow(distance, 0.99);

                    // Should never happen.
                default:
                    return 0;
            }
        }