Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Givikap120 committed Nov 14, 2024
1 parent 5cc1cbe commit 9fcf834
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions osu.Game.Rulesets.Osu/Difficulty/Skills/OsuStrainSkill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@ public abstract class OsuStrainSkill : StrainSkill
/// </summary>
protected virtual double ReducedStrainBaseline => 0.75;

protected double Difficulty;

protected OsuStrainSkill(Mod[] mods)
: base(mods)
{
}

public override double DifficultyValue()
{
Difficulty = 0;
double weight = 1;

// Sections with 0 strain are excluded to avoid worst-case time complexity of the following sort (e.g. /b/2351871).
Expand All @@ -48,15 +45,17 @@ public override double DifficultyValue()
strains[i] *= Interpolation.Lerp(ReducedStrainBaseline, 1.0, scale);
}

double difficulty = 0;

// Difficulty is the weighted sum of the highest strains from every section.
// We're sorting from highest to lowest strain.
foreach (double strain in strains.OrderDescending())
{
Difficulty += strain * weight;
difficulty += strain * weight;
weight *= DecayWeight;
}

return Difficulty;
return difficulty;
}

public static double DifficultyToPerformance(double difficulty) => Math.Pow(5.0 * Math.Max(1.0, difficulty / 0.0675) - 4.0, 3.0) / 100000.0;
Expand Down

0 comments on commit 9fcf834

Please sign in to comment.