mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Add a list of mods to Skill class
Although this isn't necessary for existing official rulesets and calculators, custom calculators can have use cases for accessing mods in difficulty calculation. For example, accounting for the effects of visual mods.
This commit is contained in:
@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
|
||||
private DifficultyAttributes calculate(IBeatmap beatmap, Mod[] mods, double clockRate)
|
||||
{
|
||||
var skills = CreateSkills(beatmap);
|
||||
var skills = CreateSkills(beatmap, mods);
|
||||
|
||||
if (!beatmap.HitObjects.Any())
|
||||
return CreateDifficultyAttributes(beatmap, mods, skills, clockRate);
|
||||
@ -202,7 +202,8 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
/// Creates the <see cref="Skill"/>s to calculate the difficulty of an <see cref="IBeatmap"/>.
|
||||
/// </summary>
|
||||
/// <param name="beatmap">The <see cref="IBeatmap"/> whose difficulty will be calculated.</param>
|
||||
/// <param name="mods">Mods to calculate difficulty with.</param>
|
||||
/// <returns>The <see cref="Skill"/>s.</returns>
|
||||
protected abstract Skill[] CreateSkills(IBeatmap beatmap);
|
||||
protected abstract Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Difficulty.Utils;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Difficulty.Skills
|
||||
{
|
||||
@ -46,10 +47,22 @@ namespace osu.Game.Rulesets.Difficulty.Skills
|
||||
/// </summary>
|
||||
protected double CurrentStrain { get; private set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Mods for use in skill calculations.
|
||||
/// </summary>
|
||||
protected IReadOnlyList<Mod> Mods => mods;
|
||||
|
||||
private double currentSectionPeak = 1; // We also keep track of the peak strain level in the current section.
|
||||
|
||||
private readonly List<double> strainPeaks = new List<double>();
|
||||
|
||||
private readonly Mod[] mods;
|
||||
|
||||
protected Skill(Mod[] mods)
|
||||
{
|
||||
this.mods = mods;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process a <see cref="DifficultyHitObject"/> and update current strain values accordingly.
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user