mirror of
https://github.com/ppy/osu.git
synced 2024-11-18 22:02:54 +08:00
49 lines
1.7 KiB
C#
49 lines
1.7 KiB
C#
// 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.
|
|
|
|
#nullable disable
|
|
|
|
using System;
|
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
|
using osu.Game.Rulesets.Mods;
|
|
using osu.Game.Rulesets.Osu.Difficulty.Evaluators;
|
|
|
|
namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
|
{
|
|
/// <summary>
|
|
/// Represents the skill required to press keys with regards to keeping up with the speed at which objects need to be hit.
|
|
/// </summary>
|
|
public class Speed : OsuStrainSkill
|
|
{
|
|
private double skillMultiplier => 1375;
|
|
private double strainDecayBase => 0.3;
|
|
|
|
private double currentStrain;
|
|
private double currentRhythm;
|
|
|
|
protected override int ReducedSectionCount => 5;
|
|
protected override double DifficultyMultiplier => 1.04;
|
|
private readonly double greatWindow;
|
|
|
|
public Speed(Mod[] mods, double hitWindowGreat)
|
|
: base(mods)
|
|
{
|
|
greatWindow = hitWindowGreat;
|
|
}
|
|
|
|
private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);
|
|
|
|
protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => (currentStrain * currentRhythm) * strainDecay(time - current.Previous(0).StartTime);
|
|
|
|
protected override double StrainValueAt(DifficultyHitObject current)
|
|
{
|
|
currentStrain *= strainDecay(current.DeltaTime);
|
|
currentStrain += SpeedEvaluator.EvaluateDifficultyOf(current, greatWindow) * skillMultiplier;
|
|
|
|
currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current, greatWindow);
|
|
|
|
return currentStrain * currentRhythm;
|
|
}
|
|
}
|
|
}
|