From e187c6453d841aa393dda610938e858b786951bf Mon Sep 17 00:00:00 2001 From: Poyo Date: Mon, 5 Mar 2018 18:19:06 -0800 Subject: [PATCH] Added mania-difficulty mod support --- .../ManiaDifficultyCalculator.cs | 15 ++++++++------- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 2 +- .../Objects/ManiaHitObjectDifficulty.cs | 6 +++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs index e1d3b6212f..02560c8141 100644 --- a/osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs @@ -4,6 +4,7 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.Mods; using System; using System.Collections.Generic; @@ -31,8 +32,11 @@ namespace osu.Game.Rulesets.Mania private readonly List difficultyHitObjects = new List(); public ManiaDifficultyCalculator(Beatmap beatmap) - : base(beatmap) - { + : base(beatmap) { + } + + public ManiaDifficultyCalculator(Beatmap beatmap, Mod[] mods) + : base(beatmap, mods) { } public override double Calculate(Dictionary categoryDifficulty = null) @@ -53,11 +57,8 @@ namespace osu.Game.Rulesets.Mania double starRating = calculateDifficulty() * star_scaling_factor; - if (categoryDifficulty != null) - { - categoryDifficulty.Add("Strain", starRating); - // categoryDifficulty.Add("Hit window 300", 35 /*HitObjectManager.HitWindow300*/ / TimeRate); - } + categoryDifficulty?.Add("Strain", starRating); + // categoryDifficulty.Add("Hit window 300", 35 /*HitObjectManager.HitWindow300*/ / TimeRate); return starRating; } diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 3bfb4d3e44..ac815e0e2f 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Mania public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_mania_o }; - public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap, Mod[] mods = null) => new ManiaDifficultyCalculator(beatmap); + public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap, Mod[] mods = null) => new ManiaDifficultyCalculator(beatmap, mods); public override int LegacyID => 3; diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitObjectDifficulty.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitObjectDifficulty.cs index 0b5e7d7e4c..2b59279972 100644 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitObjectDifficulty.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaHitObjectDifficulty.cs @@ -22,13 +22,13 @@ namespace osu.Game.Rulesets.Mania.Objects private readonly int beatmapColumnCount; - private double endTime; - private double[] heldUntil; + private readonly double endTime; + private readonly double[] heldUntil; /// /// Measures jacks or more generally: repeated presses of the same button /// - private double[] individualStrains; + private readonly double[] individualStrains; internal double IndividualStrain {