1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-12 22:32:57 +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.

61 lines
2.0 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
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;
2018-05-15 16:36:29 +08:00
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
using System.Linq;
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
{
2024-09-16 05:58:19 +08:00
protected double SkillMultiplier => 1.430;
2024-02-24 01:52:00 +08:00
protected override double StrainDecayBase => 0.3;
2021-08-17 21:39:18 +08:00
2024-04-15 02:45:43 +08:00
protected double CurrentStrain;
protected double CurrentRhythm;
2021-08-17 21:39:18 +08:00
2021-06-16 21:13:46 +08:00
protected override int ReducedSectionCount => 5;
2018-12-18 08:51:49 +08:00
public Speed(Mod[] mods)
: base(mods)
{
}
2024-04-15 02:45:43 +08:00
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)
{
OsuDifficultyHitObject currODHO = (OsuDifficultyHitObject)current;
2021-08-17 21:39:18 +08:00
2024-04-15 02:45:43 +08:00
CurrentStrain *= StrainDecay(currODHO.StrainTime);
CurrentStrain += SpeedEvaluator.EvaluateDifficultyOf(current) * SkillMultiplier;
2021-08-17 21:39:18 +08:00
2024-04-15 02:45:43 +08:00
CurrentRhythm = currODHO.RhythmDifficulty;
double totalStrain = CurrentStrain * CurrentRhythm;
2024-05-24 02:08:32 +08:00
ObjectStrains.Add(totalStrain);
return totalStrain;
}
public double RelevantNoteCount()
{
2024-05-24 02:08:32 +08:00
if (ObjectStrains.Count == 0)
2022-06-29 15:29:14 +08:00
return 0;
2024-05-24 02:08:32 +08:00
double maxStrain = ObjectStrains.Max();
if (maxStrain == 0)
return 0;
2024-05-24 02:08:32 +08:00
return ObjectStrains.Sum(strain => 1.0 / (1.0 + Math.Exp(-(strain / maxStrain * 12.0 - 6.0))));
}
}
}