2019-01-24 17:43:03 +09:00
|
|
|
|
// 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 18:19:50 +09:00
|
|
|
|
|
2018-12-18 09:38:02 +09:00
|
|
|
|
using System;
|
2019-02-12 16:03:28 +09:00
|
|
|
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
2021-02-06 15:06:16 +11:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2022-05-28 13:29:09 +01:00
|
|
|
|
using osu.Game.Rulesets.Osu.Difficulty.Evaluators;
|
2018-05-15 17:36:29 +09:00
|
|
|
|
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
|
2021-10-11 03:12:57 +02:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2018-05-15 17:36:29 +09:00
|
|
|
|
namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
2017-06-05 23:45:22 +02:00
|
|
|
|
{
|
2017-06-08 00:17:58 +02: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-14 19:18:49 +02:00
|
|
|
|
public class Speed : OsuStrainSkill
|
2017-06-05 23:45:22 +02:00
|
|
|
|
{
|
2024-09-12 17:28:24 +09:00
|
|
|
|
private double skillMultiplier => 1.430;
|
2021-08-17 13:39:18 +00:00
|
|
|
|
private double strainDecayBase => 0.3;
|
|
|
|
|
|
2021-11-08 01:53:51 +01:00
|
|
|
|
private double currentStrain;
|
|
|
|
|
private double currentRhythm;
|
2021-08-17 13:39:18 +00:00
|
|
|
|
|
2021-06-16 15:13:46 +02:00
|
|
|
|
protected override int ReducedSectionCount => 5;
|
2018-12-18 09:51:49 +09:00
|
|
|
|
|
2022-06-29 16:57:10 +09:00
|
|
|
|
private readonly List<double> objectStrains = new List<double>();
|
2021-10-11 03:12:57 +02:00
|
|
|
|
|
2022-09-06 17:10:32 +01:00
|
|
|
|
public Speed(Mod[] mods)
|
2021-02-06 15:06:16 +11:00
|
|
|
|
: base(mods)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-03 17:06:59 +00:00
|
|
|
|
private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);
|
|
|
|
|
|
2022-05-22 16:26:22 +01:00
|
|
|
|
protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => (currentStrain * currentRhythm) * strainDecay(time - current.Previous(0).StartTime);
|
2021-10-03 17:06:59 +00:00
|
|
|
|
|
|
|
|
|
protected override double StrainValueAt(DifficultyHitObject current)
|
|
|
|
|
{
|
2022-06-13 17:49:56 +01:00
|
|
|
|
currentStrain *= strainDecay(((OsuDifficultyHitObject)current).StrainTime);
|
2022-09-06 17:10:32 +01:00
|
|
|
|
currentStrain += SpeedEvaluator.EvaluateDifficultyOf(current) * skillMultiplier;
|
2021-08-17 13:39:18 +00:00
|
|
|
|
|
2022-09-06 17:10:32 +01:00
|
|
|
|
currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current);
|
2021-08-17 13:39:18 +00:00
|
|
|
|
|
2021-10-11 03:12:57 +02:00
|
|
|
|
double totalStrain = currentStrain * currentRhythm;
|
|
|
|
|
|
|
|
|
|
objectStrains.Add(totalStrain);
|
|
|
|
|
|
|
|
|
|
return totalStrain;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public double RelevantNoteCount()
|
|
|
|
|
{
|
2022-06-29 16:29:14 +09:00
|
|
|
|
if (objectStrains.Count == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
2021-10-11 03:12:57 +02:00
|
|
|
|
double maxStrain = objectStrains.Max();
|
2022-06-29 16:42:53 +09:00
|
|
|
|
|
|
|
|
|
if (maxStrain == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
2022-08-30 18:03:44 +01:00
|
|
|
|
return objectStrains.Sum(strain => 1.0 / (1.0 + Math.Exp(-(strain / maxStrain * 12.0 - 6.0))));
|
2017-06-05 23:45:22 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-06 15:39:37 +02:00
|
|
|
|
}
|