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
|
|
|
|
|
2017-06-05 23:45:22 +02:00
|
|
|
|
using System;
|
2024-12-22 04:45:29 +05:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
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;
|
2024-12-22 04:45:29 +05:00
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
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-07 20:29:03 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents the skill required to correctly aim at every object in the map with a uniform CircleSize and normalized distances.
|
|
|
|
|
/// </summary>
|
2021-06-14 19:18:49 +02:00
|
|
|
|
public class Aim : OsuStrainSkill
|
2017-06-05 23:45:22 +02:00
|
|
|
|
{
|
2025-01-20 14:39:35 +05:00
|
|
|
|
public readonly bool IncludeSliders;
|
|
|
|
|
|
|
|
|
|
public Aim(Mod[] mods, bool includeSliders)
|
2021-02-06 15:06:16 +11:00
|
|
|
|
: base(mods)
|
|
|
|
|
{
|
2025-01-20 14:39:35 +05:00
|
|
|
|
IncludeSliders = includeSliders;
|
2021-02-06 15:06:16 +11:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-08 01:53:51 +01:00
|
|
|
|
private double currentStrain;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2025-01-14 18:27:25 +00:00
|
|
|
|
private double skillMultiplier => 25.6;
|
2021-08-17 13:39:18 +00:00
|
|
|
|
private double strainDecayBase => 0.15;
|
|
|
|
|
|
2024-12-22 04:45:29 +05:00
|
|
|
|
private readonly List<double> sliderStrains = new List<double>();
|
|
|
|
|
|
2021-08-17 13:39:18 +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 * strainDecay(time - current.Previous(0).StartTime);
|
2021-08-17 13:39:18 +00:00
|
|
|
|
|
|
|
|
|
protected override double StrainValueAt(DifficultyHitObject current)
|
|
|
|
|
{
|
|
|
|
|
currentStrain *= strainDecay(current.DeltaTime);
|
2025-01-20 14:39:35 +05:00
|
|
|
|
currentStrain += AimEvaluator.EvaluateDifficultyOf(current, IncludeSliders) * skillMultiplier;
|
2022-02-14 01:53:03 +00:00
|
|
|
|
|
2024-12-22 04:45:29 +05:00
|
|
|
|
if (current.BaseObject is Slider)
|
|
|
|
|
{
|
|
|
|
|
sliderStrains.Add(currentStrain);
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-17 13:39:18 +00:00
|
|
|
|
return currentStrain;
|
|
|
|
|
}
|
2024-12-22 04:45:29 +05:00
|
|
|
|
|
|
|
|
|
public double GetDifficultSliders()
|
|
|
|
|
{
|
|
|
|
|
if (sliderStrains.Count == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
2025-01-30 03:06:05 +08:00
|
|
|
|
double maxSliderStrain = sliderStrains.Max();
|
2024-12-22 04:45:29 +05:00
|
|
|
|
if (maxSliderStrain == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
2025-01-30 03:06:05 +08:00
|
|
|
|
return sliderStrains.Sum(strain => 1.0 / (1.0 + Math.Exp(-(strain / maxSliderStrain * 12.0 - 6.0))));
|
2024-12-22 04:45:29 +05:00
|
|
|
|
}
|
2017-06-05 23:45:22 +02:00
|
|
|
|
}
|
2017-06-06 00:07:00 +02:00
|
|
|
|
}
|