1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-07 00:57:45 +08:00

49 lines
1.7 KiB
C#
Raw Normal View History

2021-11-18 09:47:41 +11:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2021-08-08 23:56:03 +10:00
// See the LICENCE file in the repository root for full licence text.
2022-06-17 16:37:17 +09:00
#nullable disable
2021-08-08 23:56:03 +10:00
using System;
using System.Linq;
2021-08-08 23:56:03 +10:00
using osu.Game.Rulesets.Difficulty.Preprocessing;
2022-06-21 10:01:11 +01:00
using osu.Game.Rulesets.Difficulty.Skills;
2021-08-08 23:56:03 +10:00
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Difficulty.Evaluators;
using osu.Game.Rulesets.Osu.Mods;
2021-08-08 23:56:03 +10: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 10:01:11 +01:00
public class Flashlight : StrainSkill
2021-08-08 23:56:03 +10:00
{
2022-06-13 20:43:54 +09:00
private readonly bool hasHiddenMod;
public Flashlight(Mod[] mods)
2021-08-08 23:56:03 +10:00
: base(mods)
{
2022-06-13 20:43:54 +09:00
hasHiddenMod = mods.Any(m => m is OsuModHidden);
2021-08-08 23:56:03 +10:00
}
private double skillMultiplier => 0.05;
private double strainDecayBase => 0.15;
private double currentStrain;
2021-08-08 23:56:03 +10:00
private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);
protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => currentStrain * strainDecay(time - current.Previous(0).StartTime);
protected override double StrainValueAt(DifficultyHitObject current)
{
currentStrain *= strainDecay(current.DeltaTime);
2022-06-13 20:43:54 +09:00
currentStrain += FlashlightEvaluator.EvaluateDifficultyOf(current, hasHiddenMod) * skillMultiplier;
return currentStrain;
}
2022-06-21 10:01:11 +01:00
2022-06-29 16:08:59 +09:00
public override double DifficultyValue() => GetCurrentStrainPeaks().Sum() * OsuStrainSkill.DEFAULT_DIFFICULTY_MULTIPLIER;
2021-08-08 23:56:03 +10:00
}
}