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.
|
|
|
|
|
|
|
|
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-02 08:38:52 +00:00
|
|
|
using osu.Game.Rulesets.Objects;
|
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;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Difficulty
|
|
|
|
{
|
|
|
|
public class TaikoDifficultyCalculator : DifficultyCalculator
|
|
|
|
{
|
2019-02-18 05:55:20 +00:00
|
|
|
private const double star_scaling_factor = 0.04125;
|
2019-02-18 05:54:21 +00:00
|
|
|
|
|
|
|
public TaikoDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
|
|
|
|
: base(ruleset, beatmap)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
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)
|
2019-05-29 09:22:51 +00:00
|
|
|
return new TaikoDifficultyAttributes { Mods = mods, Skills = skills };
|
2019-02-19 08:45:16 +00:00
|
|
|
|
2019-09-02 08:38:52 +00:00
|
|
|
HitWindows hitWindows = new TaikoHitWindows();
|
|
|
|
hitWindows.SetDifficulty(beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty);
|
|
|
|
|
2019-02-19 08:45:16 +00:00
|
|
|
return new TaikoDifficultyAttributes
|
|
|
|
{
|
|
|
|
StarRating = skills.Single().DifficultyValue() * star_scaling_factor,
|
|
|
|
Mods = mods,
|
|
|
|
// Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future
|
2019-09-02 08:38:52 +00:00
|
|
|
GreatHitWindow = (int)(hitWindows.Great / 2) / clockRate,
|
2019-02-19 08:45:16 +00:00
|
|
|
MaxCombo = beatmap.HitObjects.Count(h => h is Hit),
|
2019-05-29 09:22:51 +00:00
|
|
|
Skills = skills
|
2019-02-19 08:45:16 +00:00
|
|
|
};
|
2019-02-18 05:54:21 +00:00
|
|
|
}
|
|
|
|
|
2019-02-19 08:45:16 +00:00
|
|
|
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
2019-02-18 05:54:21 +00:00
|
|
|
{
|
|
|
|
for (int i = 1; i < beatmap.HitObjects.Count; i++)
|
2019-02-19 08:45:16 +00:00
|
|
|
yield return new TaikoDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate);
|
2019-02-18 05:54:21 +00:00
|
|
|
}
|
|
|
|
|
2019-02-19 08:57:29 +00:00
|
|
|
protected override Skill[] CreateSkills(IBeatmap beatmap) => new Skill[] { new Strain() };
|
2019-02-18 05:54:21 +00:00
|
|
|
|
|
|
|
protected override Mod[] DifficultyAdjustmentMods => new Mod[]
|
|
|
|
{
|
|
|
|
new TaikoModDoubleTime(),
|
|
|
|
new TaikoModHalfTime(),
|
|
|
|
new TaikoModEasy(),
|
|
|
|
new TaikoModHardRock(),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|