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