2019-02-18 05:54:21 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2020-05-11 05:50:02 +00:00
|
|
|
using System;
|
2019-02-18 05:54:21 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Difficulty;
|
|
|
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
|
|
|
using osu.Game.Rulesets.Difficulty.Skills;
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2019-09-06 06:24:00 +00:00
|
|
|
using osu.Game.Rulesets.Scoring;
|
2019-02-18 05:54:21 +00:00
|
|
|
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
|
|
|
|
using osu.Game.Rulesets.Taiko.Difficulty.Skills;
|
|
|
|
using osu.Game.Rulesets.Taiko.Mods;
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
2019-09-06 06:24:00 +00:00
|
|
|
using osu.Game.Rulesets.Taiko.Scoring;
|
2019-02-18 05:54:21 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Difficulty
|
|
|
|
{
|
|
|
|
public class TaikoDifficultyCalculator : DifficultyCalculator
|
|
|
|
{
|
2021-11-15 09:23:03 +00:00
|
|
|
public TaikoDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
|
2019-02-18 05:54:21 +00:00
|
|
|
: base(ruleset, beatmap)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-06-08 05:24:51 +00:00
|
|
|
protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate)
|
2020-05-11 05:50:02 +00:00
|
|
|
{
|
2022-06-08 05:24:51 +00:00
|
|
|
return new Skill[]
|
|
|
|
{
|
|
|
|
new CombinedStrain(mods)
|
|
|
|
};
|
|
|
|
}
|
2020-05-11 05:50:02 +00:00
|
|
|
|
2020-08-22 15:51:35 +00:00
|
|
|
protected override Mod[] DifficultyAdjustmentMods => new Mod[]
|
2020-05-11 05:50:02 +00:00
|
|
|
{
|
2020-08-22 15:51:35 +00:00
|
|
|
new TaikoModDoubleTime(),
|
|
|
|
new TaikoModHalfTime(),
|
|
|
|
new TaikoModEasy(),
|
|
|
|
new TaikoModHardRock(),
|
|
|
|
};
|
2020-05-11 05:50:02 +00:00
|
|
|
|
2020-08-22 15:51:35 +00:00
|
|
|
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
2020-05-11 05:50:02 +00:00
|
|
|
{
|
2022-06-02 10:34:46 +00:00
|
|
|
List<DifficultyHitObject> difficultyHitObject = new List<DifficultyHitObject>();
|
2022-06-06 08:11:26 +00:00
|
|
|
List<TaikoDifficultyHitObject> centreObjects = new List<TaikoDifficultyHitObject>();
|
|
|
|
List<TaikoDifficultyHitObject> rimObjects = new List<TaikoDifficultyHitObject>();
|
|
|
|
List<TaikoDifficultyHitObject> noteObjects = new List<TaikoDifficultyHitObject>();
|
2020-05-11 05:53:42 +00:00
|
|
|
|
2020-08-22 15:51:35 +00:00
|
|
|
for (int i = 2; i < beatmap.HitObjects.Count; i++)
|
2020-05-11 05:50:02 +00:00
|
|
|
{
|
2022-06-02 10:34:46 +00:00
|
|
|
difficultyHitObject.Add(
|
2020-09-10 11:00:57 +00:00
|
|
|
new TaikoDifficultyHitObject(
|
2022-06-06 08:11:26 +00:00
|
|
|
beatmap.HitObjects[i], beatmap.HitObjects[i - 1], beatmap.HitObjects[i - 2], clockRate, difficultyHitObject,
|
|
|
|
centreObjects, rimObjects, noteObjects, difficultyHitObject.Count)
|
2020-09-10 11:00:57 +00:00
|
|
|
);
|
2020-05-11 05:50:02 +00:00
|
|
|
}
|
|
|
|
|
2022-05-26 10:04:25 +00:00
|
|
|
// Find repetition interval for the final TaikoDifficultyHitObjectColour
|
|
|
|
// TODO: Might be a good idea to refactor this
|
2022-06-06 04:42:49 +00:00
|
|
|
((TaikoDifficultyHitObject)difficultyHitObject.Last()).Colour?.FindRepetitionInterval();
|
2022-06-02 10:34:46 +00:00
|
|
|
return difficultyHitObject;
|
2020-05-11 05:50:02 +00:00
|
|
|
}
|
|
|
|
|
2019-02-19 08:45:16 +00:00
|
|
|
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
|
2019-02-18 05:54:21 +00:00
|
|
|
{
|
2019-02-19 08:45:16 +00:00
|
|
|
if (beatmap.HitObjects.Count == 0)
|
2021-11-21 03:12:24 +00:00
|
|
|
return new TaikoDifficultyAttributes { Mods = mods };
|
2019-02-19 08:45:16 +00:00
|
|
|
|
2022-06-08 05:24:51 +00:00
|
|
|
var combined = (CombinedStrain)skills[0];
|
2020-05-22 11:50:21 +00:00
|
|
|
|
2022-06-08 05:24:51 +00:00
|
|
|
double colourRating = combined.ColourDifficultyValue;
|
|
|
|
double rhythmRating = combined.RhythmDifficultyValue;
|
|
|
|
double staminaRating = combined.StaminaDifficultyValue;
|
2020-05-22 11:50:21 +00:00
|
|
|
|
2022-06-08 05:24:51 +00:00
|
|
|
double starRating = rescale(1.9 * combined.DifficultyValue());
|
2020-05-11 05:50:02 +00:00
|
|
|
|
2019-09-02 08:38:52 +00:00
|
|
|
HitWindows hitWindows = new TaikoHitWindows();
|
2021-10-02 03:34:29 +00:00
|
|
|
hitWindows.SetDifficulty(beatmap.Difficulty.OverallDifficulty);
|
2019-09-02 08:38:52 +00:00
|
|
|
|
2019-02-19 08:45:16 +00:00
|
|
|
return new TaikoDifficultyAttributes
|
|
|
|
{
|
2020-05-11 05:50:02 +00:00
|
|
|
StarRating = starRating,
|
2019-02-19 08:45:16 +00:00
|
|
|
Mods = mods,
|
2021-12-17 20:39:03 +00:00
|
|
|
StaminaDifficulty = staminaRating,
|
|
|
|
RhythmDifficulty = rhythmRating,
|
|
|
|
ColourDifficulty = colourRating,
|
2021-10-10 07:23:35 +00:00
|
|
|
GreatHitWindow = hitWindows.WindowFor(HitResult.Great) / clockRate,
|
2019-02-19 08:45:16 +00:00
|
|
|
MaxCombo = beatmap.HitObjects.Count(h => h is Hit),
|
|
|
|
};
|
2019-02-18 05:54:21 +00:00
|
|
|
}
|
|
|
|
|
2020-08-22 17:34:16 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Applies a final re-scaling of the star rating to bring maps with recorded full combos below 9.5 stars.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sr">The raw star rating value before re-scaling.</param>
|
|
|
|
private double rescale(double sr)
|
|
|
|
{
|
|
|
|
if (sr < 0) return sr;
|
|
|
|
|
|
|
|
return 10.43 * Math.Log(sr / 8 + 1);
|
|
|
|
}
|
2019-02-18 05:54:21 +00:00
|
|
|
}
|
|
|
|
}
|