1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 02:42:54 +08:00

refactor hit window calc

This commit is contained in:
apollo-dw 2021-09-15 10:52:50 +01:00
parent 49658b6f82
commit a0bd73c356
2 changed files with 17 additions and 13 deletions

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Difficulty.Preprocessing;
@ -21,6 +22,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
public class OsuDifficultyCalculator : DifficultyCalculator
{
private const double difficulty_multiplier = 0.0675;
private double hitWindowGreat;
public OsuDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
: base(ruleset, beatmap)
@ -36,11 +38,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty
double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier;
double starRating = aimRating + speedRating + Math.Abs(aimRating - speedRating) / 2;
HitWindows hitWindows = new OsuHitWindows();
hitWindows.SetDifficulty(beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty);
// Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be removed in the future
double hitWindowGreat = (int)(hitWindows.WindowFor(HitResult.Great)) / clockRate;
double preempt = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / clockRate;
int maxCombo = beatmap.HitObjects.Count;
@ -79,11 +76,20 @@ namespace osu.Game.Rulesets.Osu.Difficulty
}
}
protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => new Skill[]
protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate)
{
new Aim(mods),
new Speed(mods, beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty, clockRate),
};
HitWindows hitWindows = new OsuHitWindows();
hitWindows.SetDifficulty(beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty);
// Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be removed in the future
hitWindowGreat = (int)(hitWindows.WindowFor(HitResult.Great)) / clockRate;
return new Skill[]
{
new Aim(mods),
new Speed(mods, hitWindowGreat),
};
}
protected override Mod[] DifficultyAdjustmentMods => new Mod[]
{

View File

@ -33,12 +33,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
private readonly double greatWindow;
public Speed(Mod[] mods, float od, double clockRate)
public Speed(Mod[] mods, double hitWindowGreat)
: base(mods)
{
HitWindows hitWindows = new OsuHitWindows();
hitWindows.SetDifficulty(od);
greatWindow = (int)(hitWindows.WindowFor(HitResult.Great)) / clockRate;
greatWindow = hitWindowGreat;
}
protected override double StrainValueOf(DifficultyHitObject current)