From d8f18661d3af71ec429a2d70c5cb6d4e1e83b071 Mon Sep 17 00:00:00 2001 From: apollo-dw <83023433+apollo-dw@users.noreply.github.com> Date: Tue, 21 Jun 2022 23:21:57 +0100 Subject: [PATCH] Wave of changes --- .../Evaluators/CognitionEvaluator.cs | 22 +++++++++++++------ .../Difficulty/Skills/Cognition.cs | 21 ++++++++++++------ 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/CognitionEvaluator.cs b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/CognitionEvaluator.cs index e68eb7a3e5..83daad8383 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Evaluators/CognitionEvaluator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Evaluators/CognitionEvaluator.cs @@ -17,9 +17,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators return 0; var currObj = (OsuDifficultyHitObject)current; - double noteDensity = 1.0; + double currVelocity = currObj.LazyJumpDistance / currObj.StrainTime; - double difficulty = 0.0; + double noteDensity = 1.0; // This loop sucks so much lol. // Will be replaced in conjuction with the "objects with current visible" and the "currently visible objects" lists @@ -47,18 +47,26 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators noteDensity += opacity; } - double noteDensityDifficulty = 0; + double noteDensityDifficulty = Math.Pow(Math.Max(0, noteDensity - 3), 2.5); + + double hiddenDifficulty = 0; if (hidden) - noteDensityDifficulty = Math.Pow(noteDensity, 2.5) * 1.2; + { + noteDensityDifficulty *= 3.2; - difficulty += noteDensityDifficulty; + // Really not sure about this, but without this a lot of normal HD plays become underweight. + hiddenDifficulty = 11 * currObj.LazyJumpDistance / currObj.StrainTime; + } double preemptDifficulty = 0.0; if (currObj.preempt < 400) - preemptDifficulty += Math.Pow(400 - currObj.preempt, 1.5) / 7; + preemptDifficulty += Math.Pow(400 - currObj.preempt, 1.5) / 14; - difficulty += preemptDifficulty; + // Buff rhythm on high AR. + preemptDifficulty *= RhythmEvaluator.EvaluateDifficultyOf(current, 30); + + double difficulty = Math.Max(preemptDifficulty, hiddenDifficulty) + noteDensityDifficulty; return difficulty; } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Cognition.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Cognition.cs index b42b6aa053..2b59fbf1ee 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Cognition.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Cognition.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Difficulty.Preprocessing; @@ -16,7 +15,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills { private readonly List difficulties = new List(); private readonly bool hasHiddenMod; - private const double skill_multiplier = 17000; + private const double skill_multiplier = 2.4; public Cognition(Mod[] mods) : base(mods) @@ -30,12 +29,20 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills { double difficulty = 0; - for (int i = 0; i < difficulties.Count; i++) - difficulty += difficulties[i] * weight(i); + // Sections with 0 difficulty are excluded to avoid worst-case time complexity of the following sort (e.g. /b/2351871). + // These sections will not contribute to the difficulty. + var peaks = difficulties.Where(p => p > 0); - return Math.Pow(difficulty, 1.0 / 3.0); + List values = peaks.OrderByDescending(d => d).ToList(); + + // Difficulty is the weighted sum of the highest strains from every section. + // We're sorting from highest to lowest strain. + for (int i = 0; i < values.Count; i++) + { + difficulty += values[i] / (i + 1); + } + + return difficulty; } - - private double weight(int x) => x / (x + 100.0); } }