1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 13:47:38 +08:00
osu-lazer/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.8 KiB
C#
Raw Normal View History

// 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.
2018-04-13 17:19:50 +08:00
2022-06-17 15:37:17 +08:00
#nullable disable
2018-12-18 08:38:02 +08:00
using System;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Difficulty.Evaluators;
2022-06-14 00:49:56 +08:00
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
2018-04-13 17:19:50 +08:00
2018-05-15 16:36:29 +08:00
namespace osu.Game.Rulesets.Osu.Difficulty.Skills
{
2017-06-08 06:17:58 +08:00
/// <summary>
/// Represents the skill required to press keys with regards to keeping up with the speed at which objects need to be hit.
/// </summary>
2021-06-15 01:18:49 +08:00
public class Speed : OsuStrainSkill
{
private double skillMultiplier => 1375;
2021-08-17 21:39:18 +08:00
private double strainDecayBase => 0.3;
private double currentStrain;
private double currentRhythm;
2021-08-17 21:39:18 +08:00
2021-06-16 21:13:46 +08:00
protected override int ReducedSectionCount => 5;
protected override double DifficultyMultiplier => 1.04;
2021-09-15 17:29:30 +08:00
private readonly double greatWindow;
2018-12-18 08:51:49 +08:00
2021-09-15 17:52:50 +08:00
public Speed(Mod[] mods, double hitWindowGreat)
: base(mods)
{
2021-09-15 17:52:50 +08:00
greatWindow = hitWindowGreat;
}
2021-10-04 01:06:59 +08:00
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);
2021-10-04 01:06:59 +08:00
protected override double StrainValueAt(DifficultyHitObject current)
{
2022-06-14 00:49:56 +08:00
currentStrain *= strainDecay(((OsuDifficultyHitObject)current).StrainTime);
currentStrain += SpeedEvaluator.EvaluateDifficultyOf(current, greatWindow) * skillMultiplier;
2021-08-17 21:39:18 +08:00
currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current, greatWindow);
2021-08-17 21:39:18 +08:00
2021-10-04 01:06:59 +08:00
return currentStrain * currentRhythm;
}
}
}