示例#1
0
        private double Accuracy()
        {
            if (TotalHits() == 0)
            {
                return(0);
            }

            return(Dewlib.Clamp((double)TotalSuccessfulHits() / TotalHits(), 0.0, 1.0));
        }
示例#2
0
    private void CalculateCatcherSize()
    {
        CS = Dewlib.Clamp(CS, 0, 10);

        //Calculate the integer part of CS first, then modify later based on the decimal
        double size = 144 - 12 * Math.Floor(CS);

        //If CS has a decimal place
        if (CS % 1 != 0)
        {
            //Avoid precision bugs - round to one decimal place
            double CSdecimal = Math.Round(CS - Math.Floor(CS), 1);

            if (CSdecimal == 0.2)
            {
                size -= 2;
            }
            else if (0.3 <= CSdecimal && CSdecimal <= 0.4)
            {
                size -= 4;
            }
            else if (0.5 <= CSdecimal && CSdecimal <= 0.6)
            {
                size -= 6;
            }
            else if (CSdecimal == 0.7)
            {
                size -= 8;
            }
            else if (0.8 <= CSdecimal && CSdecimal <= 0.9)
            {
                size -= 10;
            }
        }

        catcherwidth = (int)size;
    }