2021-11-17 22:47:41 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2021-08-08 13:56:03 +00:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using System;
|
2021-11-12 10:29:51 +00:00
|
|
|
|
using System.Linq;
|
2021-08-08 13:56:03 +00:00
|
|
|
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
2022-06-21 09:01:11 +00:00
|
|
|
|
using osu.Game.Rulesets.Difficulty.Skills;
|
2021-08-08 13:56:03 +00:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2022-05-28 12:29:09 +00:00
|
|
|
|
using osu.Game.Rulesets.Osu.Difficulty.Evaluators;
|
2021-11-12 10:29:51 +00:00
|
|
|
|
using osu.Game.Rulesets.Osu.Mods;
|
2021-08-08 13:56:03 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents the skill required to memorise and hit every object in a map with the Flashlight mod enabled.
|
|
|
|
|
/// </summary>
|
2022-06-21 09:01:11 +00:00
|
|
|
|
public class Flashlight : StrainSkill
|
2021-08-08 13:56:03 +00:00
|
|
|
|
{
|
2022-06-13 11:43:54 +00:00
|
|
|
|
private readonly bool hasHiddenMod;
|
|
|
|
|
|
2021-11-21 12:43:09 +00:00
|
|
|
|
public Flashlight(Mod[] mods)
|
2021-08-08 13:56:03 +00:00
|
|
|
|
: base(mods)
|
|
|
|
|
{
|
2022-06-13 11:43:54 +00:00
|
|
|
|
hasHiddenMod = mods.Any(m => m is OsuModHidden);
|
2021-08-08 13:56:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-08-27 08:31:07 +00:00
|
|
|
|
private double skillMultiplier => 0.052;
|
2021-09-25 02:52:10 +00:00
|
|
|
|
private double strainDecayBase => 0.15;
|
2021-11-08 00:53:51 +00:00
|
|
|
|
|
|
|
|
|
private double currentStrain;
|
2021-08-08 13:56:03 +00:00
|
|
|
|
|
2021-09-25 02:52:10 +00:00
|
|
|
|
private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);
|
|
|
|
|
|
2022-05-22 15:26:22 +00:00
|
|
|
|
protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => currentStrain * strainDecay(time - current.Previous(0).StartTime);
|
2021-09-25 02:52:10 +00:00
|
|
|
|
|
|
|
|
|
protected override double StrainValueAt(DifficultyHitObject current)
|
|
|
|
|
{
|
|
|
|
|
currentStrain *= strainDecay(current.DeltaTime);
|
2022-06-13 11:43:54 +00:00
|
|
|
|
currentStrain += FlashlightEvaluator.EvaluateDifficultyOf(current, hasHiddenMod) * skillMultiplier;
|
2021-09-25 02:52:10 +00:00
|
|
|
|
|
|
|
|
|
return currentStrain;
|
|
|
|
|
}
|
2022-06-21 09:01:11 +00:00
|
|
|
|
|
2022-06-29 07:08:59 +00:00
|
|
|
|
public override double DifficultyValue() => GetCurrentStrainPeaks().Sum() * OsuStrainSkill.DEFAULT_DIFFICULTY_MULTIPLIER;
|
2024-08-05 13:08:30 +00:00
|
|
|
|
|
|
|
|
|
public static double DifficultyToPerformance(double difficulty) => 25 * Math.Pow(difficulty, 2);
|
2021-08-08 13:56:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|