예제 #1
0
        public double SimulatedPp()
        {
            double pp = double.NaN;

            if (PpCalculator == null)
            {
                return(pp);
            }


            PpCalculator.Goods        = null;
            PpCalculator.Mehs         = null;
            PpCalculator.Misses       = 0;
            PpCalculator.Combo        = null;
            PpCalculator.PercentCombo = 100;
            PpCalculator.Score        = 1_000_000;
            pp = PpCalculator.Calculate(PlayTime, null);

            if (double.IsInfinity(pp))
            {
                pp = Double.NaN;
            }


            return(pp);
        }
예제 #2
0
        public double NoChokePp()
        {
            double pp = double.NaN;

            if (PpCalculator == null || _currentPlayMode == PlayMode.OsuMania)
            {
                return(pp);
            }


            PpCalculator.Goods        = Play.Hit100;
            PpCalculator.Mehs         = Play.Hit50;
            PpCalculator.Misses       = 0;
            PpCalculator.Combo        = null;
            PpCalculator.PercentCombo = 100;
            PpCalculator.Score        = Play.Score;
            pp = PpCalculator.Calculate(PlayTime, null);

            if (double.IsInfinity(pp))
            {
                pp = Double.NaN;
            }


            return(pp);
        }
예제 #3
0
        public double PPIfBeatmapWouldEndNow()
        {
            if (PpCalculator != null && PlayTime > 0)
            {
                PpCalculator.Goods  = Play.Hit100;
                PpCalculator.Mehs   = Play.Hit50;
                PpCalculator.Misses = Play.HitMiss;
                PpCalculator.Combo  = Play.MaxCombo;
                PpCalculator.Score  = Play.Score;
                attribs.Clear();
                var pp = PpCalculator.Calculate(PlayTime, attribs);
                if (!double.IsInfinity(pp))
                {
                    double accuracy, aim, strain, speed;
                    switch (_currentPlayMode)
                    {
                    case PlayMode.Taiko:
                    case PlayMode.OsuMania:
                        attribs.TryGetValue("Strain", out strain);
                        StrainPPIfBeatmapWouldEndNow = strain;
                        attribs.TryGetValue("Accuracy", out accuracy);
                        AccPPIfBeatmapWouldEndNow   = accuracy;
                        AimPPIfBeatmapWouldEndNow   = double.NaN;
                        SpeedPPIfBeatmapWouldEndNow = double.NaN;
                        break;

                    case PlayMode.CatchTheBeat:
                        ResetValues();
                        break;

                    default:
                        attribs.TryGetValue("Aim", out aim);
                        AimPPIfBeatmapWouldEndNow = aim;
                        attribs.TryGetValue("Speed", out speed);
                        SpeedPPIfBeatmapWouldEndNow = speed;
                        attribs.TryGetValue("Accuracy", out accuracy);
                        AccPPIfBeatmapWouldEndNow    = accuracy;
                        StrainPPIfBeatmapWouldEndNow = double.NaN;
                        break;
                    }

                    return(pp);
                }
            }
            ResetValues();
            return(double.NaN);

            void ResetValues()
            {
                AimPPIfBeatmapWouldEndNow    = double.NaN;
                SpeedPPIfBeatmapWouldEndNow  = double.NaN;
                AccPPIfBeatmapWouldEndNow    = double.NaN;
                StrainPPIfBeatmapWouldEndNow = double.NaN;
            }
        }
        public void CalculateTest(int c100, int c50, int cMiss, int combo, string mods, double expectedPp, int mapId, PpCalculator ppCalculator, int score = 0)
        {
            ppCalculator.PreProcess(GetMapPath(mapId));
            ppCalculator.Goods  = c100;
            ppCalculator.Mehs   = c50;
            ppCalculator.Misses = cMiss;
            ppCalculator.Combo  = combo;
            ppCalculator.Score  = score;
            ppCalculator.Mods   = mods.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);

            var calculatedPp = ppCalculator.Calculate();

            Assert.That(calculatedPp, Is.EqualTo(expectedPp).Within(0.01));
        }
예제 #5
0
        public double PPIfBeatmapWouldEndNow()
        {
            if (PpCalculator != null && PlayTime > 0)
            {
                try
                {
                    PpCalculator.Goods  = Play.C100;
                    PpCalculator.Mehs   = Play.C50;
                    PpCalculator.Misses = Play.CMiss;
                    PpCalculator.Combo  = Play.MaxCombo;
                    PpCalculator.Score  = Play.Score;
                    var pp = PpCalculator.Calculate(PlayTime, attribs);
                    if (!double.IsInfinity(pp))
                    {
                        switch (_currentPlayMode)
                        {
                        case PlayMode.Taiko:
                        case PlayMode.OsuMania:
                            StrainPPIfBeatmapWouldEndNow = attribs["Strain"];
                            AccPPIfBeatmapWouldEndNow    = attribs["Accuracy"];
                            AimPPIfBeatmapWouldEndNow    = double.NaN;
                            SpeedPPIfBeatmapWouldEndNow  = double.NaN;
                            break;

                        default:
                            AimPPIfBeatmapWouldEndNow   = attribs["Aim"];
                            SpeedPPIfBeatmapWouldEndNow = attribs["Speed"];
                            AccPPIfBeatmapWouldEndNow   = attribs["Accuracy"];
                            break;
                        }

                        attribs.Clear();

                        return(pp);
                    }

                    attribs.Clear();
                }
                catch { }
            }
            AimPPIfBeatmapWouldEndNow    = double.NaN;
            SpeedPPIfBeatmapWouldEndNow  = double.NaN;
            AccPPIfBeatmapWouldEndNow    = double.NaN;
            StrainPPIfBeatmapWouldEndNow = double.NaN;
            return(double.NaN);
        }