Пример #1
0
        public void SetDifficulty(double difficulty)
        {
            foreach (var range in GetRanges())
            {
                double value = IBeatmapDifficultyInfo.DifficultyRange(difficulty, (range.Min, range.Average, range.Max));

                switch (range.Result)
                {
                case HitResult.Miss:
                    miss = value;
                    break;

                case HitResult.Meh:
                    meh = value;
                    break;

                case HitResult.Ok:
                    ok = value;
                    break;

                case HitResult.Good:
                    good = value;
                    break;

                case HitResult.Great:
                    great = value;
                    break;

                case HitResult.Perfect:
                    perfect = value;
                    break;
                }
            }
        }
Пример #2
0
        public override void ApplyBeatmap(IBeatmap beatmap)
        {
            base.ApplyBeatmap(beatmap);

            hpMultiplier     = 1 / (object_count_factor * Math.Max(1, beatmap.HitObjects.OfType <Hit>().Count()) * IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.DrainRate, 0.5, 0.75, 0.98));
            hpMissMultiplier = IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.DrainRate, 0.0018, 0.0075, 0.0120);
        }
Пример #3
0
        public void TestAroundCentre()
        {
            var beatmap    = new TestBeatmap(new TauRuleset().RulesetInfo);
            var angleRange = (float)IBeatmapDifficultyInfo.DifficultyRange(beatmap.BeatmapInfo.Difficulty.CircleSize, 75, 25, 10);

            createTest(Enumerable.Range(0, (int)angleRange).Select(i => new HitEvent(i / 50f, HitResult.Perfect, new Beat(), new Beat(), new Vector2((i - (angleRange / 2)), 0))).ToList());
        }
Пример #4
0
        public static List <HitEvent> CreateDistributedHitEvents()
        {
            var hitEvents  = new List <HitEvent>();
            var beatmap    = new TestBeatmap(new TauRuleset().RulesetInfo);
            var angleRange = (float)IBeatmapDifficultyInfo.DifficultyRange(beatmap.BeatmapInfo.Difficulty.CircleSize, 75, 25, 10);

            for (int i = 0; i < 100; i++)
            {
                hitEvents.Add(new HitEvent(i - 25, HitResult.Perfect, new Beat(), new Beat(), new Vector2(RNG.NextSingle(-(angleRange / 2), angleRange / 2), 0)));
            }

            return(hitEvents);
        }
Пример #5
0
            protected override void UpdateAtLimitedRate(InputState inputState)
            {
                if (HitEvent == null)
                {
                    double preempt = (float)IBeatmapDifficultyInfo.DifficultyRange(SampleApproachRate.Value, 1800, 1200, 450);

                    approach.Scale = new Vector2(1 + 4 * (float)MathHelper.Clamp((HitTime - Clock.CurrentTime) / preempt, 0, 100));
                    Alpha          = (float)MathHelper.Clamp((Clock.CurrentTime - HitTime + 600) / 400, 0, 1);

                    if (Clock.CurrentTime > HitTime + duration)
                    {
                        Expire();
                    }
                }
            }
Пример #6
0
        public TauCursor(BeatmapDifficulty difficulty)
        {
            AngleRange = (float)IBeatmapDifficultyInfo.DifficultyRange(difficulty.CircleSize, 75, 25, 10);

            FillAspectRatio = 1; // 1:1
            FillMode        = FillMode.Fit;
            Anchor          = Anchor.Centre;
            Origin          = Anchor.Centre;

            Alpha = 0;

            Add(PaddleDrawable = new Paddle(AngleRange));

            State.Value = Visibility.Hidden;
        }
Пример #7
0
        protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
        {
            if (beatmap.HitObjects.Count == 0)
            {
                return new CatchDifficultyAttributes {
                           Mods = mods
                }
            }
            ;

            // this is the same as osu!, so there's potential to share the implementation... maybe
            double preempt = IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.ApproachRate, 1800, 1200, 450) / clockRate;

            return(new CatchDifficultyAttributes
            {
                StarRating = Math.Sqrt(skills[0].DifficultyValue()) * star_scaling_factor,
                Mods = mods,
                ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0,
                MaxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType <JuiceStream>().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)),
            });
        }
Пример #8
0
        protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
        {
            if (beatmap.HitObjects.Count == 0)
            {
                return new OsuDifficultyAttributes {
                           Mods = mods, Skills = skills
                }
            }
            ;

            double aimRating          = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier;
            double aimRatingNoSliders = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier;
            double speedRating        = Math.Sqrt(skills[2].DifficultyValue()) * difficulty_multiplier;
            double flashlightRating   = Math.Sqrt(skills[3].DifficultyValue()) * difficulty_multiplier;

            double sliderFactor = aimRating > 0 ? aimRatingNoSliders / aimRating : 1;

            if (mods.Any(h => h is OsuModRelax))
            {
                speedRating = 0.0;
            }

            double baseAimPerformance        = Math.Pow(5 * Math.Max(1, aimRating / 0.0675) - 4, 3) / 100000;
            double baseSpeedPerformance      = Math.Pow(5 * Math.Max(1, speedRating / 0.0675) - 4, 3) / 100000;
            double baseFlashlightPerformance = 0.0;

            if (mods.Any(h => h is OsuModFlashlight))
            {
                baseFlashlightPerformance = Math.Pow(flashlightRating, 2.0) * 25.0;
            }

            double basePerformance =
                Math.Pow(
                    Math.Pow(baseAimPerformance, 1.1) +
                    Math.Pow(baseSpeedPerformance, 1.1) +
                    Math.Pow(baseFlashlightPerformance, 1.1), 1.0 / 1.1
                    );

            double starRating = basePerformance > 0.00001 ? Math.Cbrt(1.12) * 0.027 * (Math.Cbrt(100000 / Math.Pow(2, 1 / 1.1) * basePerformance) + 4) : 0;

            double preempt   = IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.ApproachRate, 1800, 1200, 450) / clockRate;
            double drainRate = beatmap.Difficulty.DrainRate;

            int maxCombo = beatmap.HitObjects.Count;

            // Add the ticks + tail of the slider. 1 is subtracted because the head circle would be counted twice (once for the slider itself in the line above)
            maxCombo += beatmap.HitObjects.OfType <Slider>().Sum(s => s.NestedHitObjects.Count - 1);

            int hitCirclesCount = beatmap.HitObjects.Count(h => h is HitCircle);
            int sliderCount     = beatmap.HitObjects.Count(h => h is Slider);
            int spinnerCount    = beatmap.HitObjects.Count(h => h is Spinner);

            return(new OsuDifficultyAttributes
            {
                StarRating = starRating,
                Mods = mods,
                AimStrain = aimRating,
                SpeedStrain = speedRating,
                FlashlightRating = flashlightRating,
                SliderFactor = sliderFactor,
                ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5,
                OverallDifficulty = (80 - hitWindowGreat) / 6,
                DrainRate = drainRate,
                MaxCombo = maxCombo,
                HitCircleCount = hitCirclesCount,
                SliderCount = sliderCount,
                SpinnerCount = spinnerCount,
                Skills = skills
            });
        }
Пример #9
0
 public DrawableCatchRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList <Mod> mods = null)
     : base(ruleset, beatmap, mods)
 {
     Direction.Value = ScrollingDirection.Down;
     TimeRange.Value = IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.ApproachRate, 1800, 1200, 450);
 }
Пример #10
0
        public PaddleDistributionGraph(IReadOnlyList <HitEvent> hitEvents, IBeatmap beatmap)
        {
            this.hitEvents = hitEvents.Where(e => !(e.HitObject.HitWindows is HitWindows.EmptyHitWindows) && e.HitObject is Beat && e.Result.IsHit()).ToList();

            angleRange = (float)IBeatmapDifficultyInfo.DifficultyRange(beatmap.BeatmapInfo.Difficulty.CircleSize, 75, 25, 10);
        }
Пример #11
0
 public TauResumeOverlay(BeatmapDifficulty difficulty)
 {
     angleRange = (float)IBeatmapDifficultyInfo.DifficultyRange(difficulty.CircleSize, 75, 25, 10);
 }
Пример #12
0
        protected override IEnumerable <TauHitObject> ConvertHitObject(HitObject original, IBeatmap beatmap, CancellationToken cancellationToken)
        {
            var  position  = ((IHasPosition)original).Position;
            var  comboData = original as IHasCombo;
            bool isHard    = (original is IHasPathWithRepeats tmp ? tmp.NodeSamples[0] : original.Samples).Any(s => s.Name == HitSampleInfo.HIT_FINISH);
            var  sample    = original is IHasPathWithRepeats c ? c.NodeSamples[0] : original.Samples;

            switch (original)
            {
            case IHasPathWithRepeats pathData:
                if (!CanConvertToSliders)
                {
                    goto default;
                }

                if (pathData.Duration < IBeatmapDifficultyInfo.DifficultyRange(Beatmap.BeatmapInfo.Difficulty.ApproachRate, 1800, 1200, 450) / SliderDivisionLevel)
                {
                    goto default;
                }

                var nodes = new List <SliderNode>();

                float? lastAngle = null;
                double?lastTime  = null;

                for (double t = 0; t < pathData.Duration; t += 20)
                {
                    float angle = ((original as IHasPosition).Position + pathData.CurvePositionAt(t / pathData.Duration)).GetHitObjectAngle();

                    // We don't want sliders that switch angles too fast. We would default to a normal note in this case
                    if (lastAngle.HasValue && (Math.Abs(Extensions.GetDeltaAngle(lastAngle.Value, angle)) / (float)Math.Abs(lastTime.Value - t)) > 0.6)
                    {
                        goto default;
                    }

                    lastAngle = angle;
                    lastTime  = t;
                    nodes.Add(new SliderNode((float)t, angle));
                }

                float finalAngle = ((original as IHasPosition).Position + pathData.CurvePositionAt(1)).GetHitObjectAngle();

                if (lastAngle.HasValue && (Math.Abs(Extensions.GetDeltaAngle(lastAngle.Value, finalAngle)) / (float)Math.Abs(lastTime.Value - pathData.Duration)) > 0.6)
                {
                    goto default;
                }

                nodes.Add(new SliderNode((float)pathData.Duration, finalAngle));

                return(new Slider
                {
                    Samples = sample,
                    StartTime = original.StartTime,
                    NodeSamples = pathData.NodeSamples,
                    NewCombo = comboData?.NewCombo ?? false,
                    ComboOffset = comboData?.ComboOffset ?? 0,
                    Nodes = new BindableList <SliderNode>(nodes),
                }.Yield());

            // Convert spinners into sliders
            case IHasDuration durationData:
                if (!CanConvertToSliders)
                {
                    goto default;
                }

                // Spinners should only be converted to sliders if duration is sufficiently long
                if (durationData.Duration < IBeatmapDifficultyInfo.DifficultyRange(Beatmap.BeatmapInfo.Difficulty.ApproachRate, 1800, 1200, 450) / 2)
                {
                    goto default;
                }

                var sliderNodes = new List <SliderNode>();

                // Whether the spin should go in direction of previous object, otherwise, go anti-clockwise.
                int direction = beatmap.HitObjects.GetPrevious(original) is IHasPosition previous && previous.Position.GetHitObjectAngle() > 0 ? -1 : 1;

                // The amount of nodes should be dependent on how many quarter revolutions it can do.
                double nodeDuration = 800 * original.DifficultyControlPoint.SliderVelocity;
                float  currAngle    = 0;

                for (double time = 0; time < durationData.Duration; time += nodeDuration)
                {
                    sliderNodes.Add(new SliderNode((float)time, currAngle));
                    currAngle += direction * 45;
                }

                sliderNodes.Add(new SliderNode((float)durationData.Duration, currAngle));

                return(new Slider
                {
                    Samples = sample,
                    StartTime = original.StartTime,
                    NewCombo = true,
                    Nodes = new BindableList <SliderNode>(sliderNodes),
                }.Yield());

            default:
                if (isHard && CanConvertToHardBeats)
                {
                    return new HardBeat
                           {
                               Samples     = sample,
                               StartTime   = original.StartTime,
                               NewCombo    = comboData?.NewCombo ?? false,
                               ComboOffset = comboData?.ComboOffset ?? 0,
                           }
                }
                .Yield();