1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:43:05 +08:00

refactoring

This commit is contained in:
emu1337 2021-06-16 03:34:46 +02:00
parent e987a511ba
commit be68950c30
6 changed files with 17 additions and 17 deletions

View File

@ -32,8 +32,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty
if (beatmap.HitObjects.Count == 0)
return new OsuDifficultyAttributes { Mods = mods, Skills = skills };
double aimRating = Math.Sqrt((skills[0] as OsuStrainSkill).OsuDifficultyValue()) * difficulty_multiplier;
double speedRating = Math.Sqrt((skills[1] as OsuStrainSkill).OsuDifficultyValue()) * difficulty_multiplier;
double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier;
double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier;
double starRating = aimRating + speedRating + Math.Abs(aimRating - speedRating) / 2;
HitWindows hitWindows = new OsuHitWindows();

View File

@ -113,14 +113,15 @@ namespace osu.Game.Rulesets.Osu.Difficulty
aimValue *= 1.0 + 0.04 * (12.0 - Attributes.ApproachRate);
double flashlightBonus = 1.0;
if (mods.Any(h => h is OsuModFlashlight))
{
// Apply object-based bonus for flashlight.
flashlightBonus = 1.0 + 0.35 * Math.Min(1.0, totalHits / 200.0) +
(totalHits > 200
? 0.3 * Math.Min(1.0, (totalHits - 200) / 300.0) +
(totalHits > 500 ? (totalHits - 500) / 1200.0 : 0.0)
: 0.0);
(totalHits > 200
? 0.3 * Math.Min(1.0, (totalHits - 200) / 300.0) +
(totalHits > 500 ? (totalHits - 500) / 1200.0 : 0.0)
: 0.0);
}
aimValue *= Math.Max(flashlightBonus, approachRateFactor);

View File

@ -3,7 +3,6 @@
using System;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Difficulty.Skills;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
using osu.Game.Rulesets.Osu.Objects;

View File

@ -1,7 +1,8 @@
using System;
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Text;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Difficulty.Skills;
using osu.Game.Rulesets.Mods;
using System.Linq;
@ -14,22 +15,22 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
protected virtual double ReducedStrainBaseline => 0.7;
protected virtual double DifficultyMultiplier => 1.08;
public OsuStrainSkill(Mod[] mods) : base(mods)
protected OsuStrainSkill(Mod[] mods)
: base(mods)
{
}
public double OsuDifficultyValue()
public override double DifficultyValue()
{
double difficulty = 0;
double weight = 1;
double strainMultiplier;
List<double> strains = GetCurrentStrainPeaks().OrderByDescending(d => d).ToList();
// We are reducing the highest strains first to account for extreme difficulty spikes
for (int i = 0; i < ReducedSectionCount; i++)
{
strainMultiplier = ReducedStrainBaseline + Math.Log10(i * 9.0 / ReducedSectionCount + 1) * (1.0 - ReducedStrainBaseline);
strains[i] = strains[i] * strainMultiplier;
strains[i] *= ReducedStrainBaseline + Math.Log10(i * 9.0 / ReducedSectionCount + 1) * (1.0 - ReducedStrainBaseline);
}
// Difficulty is the weighted sum of the highest strains from every section.

View File

@ -3,7 +3,6 @@
using System;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Difficulty.Skills;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
using osu.Game.Rulesets.Osu.Objects;

View File

@ -109,7 +109,7 @@ namespace osu.Game.Rulesets.Difficulty.Skills
/// <summary>
/// Returns the calculated difficulty value representing all <see cref="DifficultyHitObject"/>s that have been processed up to this point.
/// </summary>
public sealed override double DifficultyValue()
public override double DifficultyValue()
{
double difficulty = 0;
double weight = 1;