Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce interfaces for difficulty & performance attributes #30707

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@

namespace osu.Game.Rulesets.Catch.Difficulty
{
public class CatchDifficultyAttributes : DifficultyAttributes
public interface ICatchDifficultyAttributes : IDifficultyAttributes
{
/// <summary>
/// The perceived approach rate inclusive of rate-adjusting mods (DT/HT/etc).
/// </summary>
/// <remarks>
/// Rate-adjusting mods don't directly affect the approach rate difficulty value, but have a perceived effect as a result of adjusting audio timing.
/// </remarks>
public double ApproachRate { get; set; }
}

public class CatchDifficultyAttributes : DifficultyAttributes, ICatchDifficultyAttributes
{
/// <inheritdoc/>
[JsonProperty("approach_rate")]
public double ApproachRate { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

namespace osu.Game.Rulesets.Catch.Difficulty
{
public class CatchPerformanceAttributes : PerformanceAttributes
public interface ICatchPerformanceAttributes : IPerformanceAttributes
{
}

public class CatchPerformanceAttributes : PerformanceAttributes, ICatchPerformanceAttributes
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@

namespace osu.Game.Rulesets.Mania.Difficulty
{
public class ManiaDifficultyAttributes : DifficultyAttributes
public interface IManiaDifficultyAttributes : IDifficultyAttributes
{
/// <summary>
/// The hit window for a GREAT hit inclusive of rate-adjusting mods (DT/HT/etc).
/// </summary>
/// <remarks>
/// Rate-adjusting mods do not affect the hit window at all in osu-stable.
/// </remarks>
public double GreatHitWindow { get; set; }
}

public class ManiaDifficultyAttributes : DifficultyAttributes, IManiaDifficultyAttributes
{
/// <inheritdoc/>
[JsonProperty("great_hit_window")]
public double GreatHitWindow { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@

namespace osu.Game.Rulesets.Mania.Difficulty
{
public class ManiaPerformanceAttributes : PerformanceAttributes
public interface IManiaPerformanceAttributes : IPerformanceAttributes
{
public double Difficulty { get; set; }
}

public class ManiaPerformanceAttributes : PerformanceAttributes, IManiaPerformanceAttributes
{
/// <inheritdoc/>
[JsonProperty("difficulty")]
public double Difficulty { get; set; }

Expand Down
62 changes: 52 additions & 10 deletions osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,38 @@

namespace osu.Game.Rulesets.Osu.Difficulty
{
public class OsuDifficultyAttributes : DifficultyAttributes
public interface IOsuDifficultyAttributes : IDifficultyAttributes
{
/// <summary>
/// The difficulty corresponding to the aim skill.
/// </summary>
[JsonProperty("aim_difficulty")]
public double AimDifficulty { get; set; }

/// <summary>
/// The difficulty corresponding to the speed skill.
/// </summary>
[JsonProperty("speed_difficulty")]
public double SpeedDifficulty { get; set; }

/// <summary>
/// The number of clickable objects weighted by difficulty.
/// Related to <see cref="SpeedDifficulty"/>
/// </summary>
[JsonProperty("speed_note_count")]
public double SpeedNoteCount { get; set; }

/// <summary>
/// The difficulty corresponding to the flashlight skill.
/// </summary>
[JsonProperty("flashlight_difficulty")]
public double FlashlightDifficulty { get; set; }

/// <summary>
/// Describes how much of <see cref="AimDifficulty"/> is contributed to by hitcircles or sliders.
/// A value closer to 1.0 indicates most of <see cref="AimDifficulty"/> is contributed by hitcircles.
/// A value closer to 0.0 indicates most of <see cref="AimDifficulty"/> is contributed by sliders.
/// </summary>
[JsonProperty("slider_factor")]
public double SliderFactor { get; set; }

[JsonProperty("aim_difficult_strain_count")]
public double AimDifficultStrainCount { get; set; }

[JsonProperty("speed_difficult_strain_count")]
public double SpeedDifficultStrainCount { get; set; }

/// <summary>
Expand All @@ -58,7 +51,6 @@ public class OsuDifficultyAttributes : DifficultyAttributes
/// <remarks>
/// Rate-adjusting mods don't directly affect the approach rate difficulty value, but have a perceived effect as a result of adjusting audio timing.
/// </remarks>
[JsonProperty("approach_rate")]
public double ApproachRate { get; set; }

/// <summary>
Expand All @@ -67,7 +59,6 @@ public class OsuDifficultyAttributes : DifficultyAttributes
/// <remarks>
/// Rate-adjusting mods don't directly affect the overall difficulty value, but have a perceived effect as a result of adjusting audio timing.
/// </remarks>
[JsonProperty("overall_difficulty")]
public double OverallDifficulty { get; set; }

/// <summary>
Expand All @@ -89,6 +80,57 @@ public class OsuDifficultyAttributes : DifficultyAttributes
/// The number of spinners in the beatmap.
/// </summary>
public int SpinnerCount { get; set; }
}

public class OsuDifficultyAttributes : DifficultyAttributes, IOsuDifficultyAttributes
{
/// <inheritdoc/>
[JsonProperty("aim_difficulty")]
public double AimDifficulty { get; set; }

/// <inheritdoc/>
[JsonProperty("speed_difficulty")]
public double SpeedDifficulty { get; set; }

/// <inheritdoc/>
[JsonProperty("speed_note_count")]
public double SpeedNoteCount { get; set; }

/// <inheritdoc/>
[JsonProperty("flashlight_difficulty")]
public double FlashlightDifficulty { get; set; }

/// <inheritdoc/>
[JsonProperty("slider_factor")]
public double SliderFactor { get; set; }

/// <inheritdoc/>
[JsonProperty("aim_difficult_strain_count")]
public double AimDifficultStrainCount { get; set; }

/// <inheritdoc/>
[JsonProperty("speed_difficult_strain_count")]
public double SpeedDifficultStrainCount { get; set; }

/// <inheritdoc/>
[JsonProperty("approach_rate")]
public double ApproachRate { get; set; }

/// <inheritdoc/>
[JsonProperty("overall_difficulty")]
public double OverallDifficulty { get; set; }

/// <inheritdoc/>
public double DrainRate { get; set; }

/// <inheritdoc/>
public int HitCircleCount { get; set; }

/// <inheritdoc/>
public int SliderCount { get; set; }

/// <inheritdoc/>
public int SpinnerCount { get; set; }

public override IEnumerable<(int attributeId, object value)> ToDatabaseAttributes()
{
Expand Down
20 changes: 19 additions & 1 deletion osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,38 @@

namespace osu.Game.Rulesets.Osu.Difficulty
{
public class OsuPerformanceAttributes : PerformanceAttributes
public interface IOsuPerformanceAttributes : IPerformanceAttributes
{
public double Aim { get; set; }

public double Speed { get; set; }

public double Accuracy { get; set; }

public double Flashlight { get; set; }

public double EffectiveMissCount { get; set; }
}

public class OsuPerformanceAttributes : PerformanceAttributes, IOsuPerformanceAttributes
{
/// <inheritdoc/>
[JsonProperty("aim")]
public double Aim { get; set; }

/// <inheritdoc/>
[JsonProperty("speed")]
public double Speed { get; set; }

/// <inheritdoc/>
[JsonProperty("accuracy")]
public double Accuracy { get; set; }

/// <inheritdoc/>
[JsonProperty("flashlight")]
public double Flashlight { get; set; }

/// <inheritdoc/>
[JsonProperty("effective_miss_count")]
public double EffectiveMissCount { get; set; }

Expand Down
38 changes: 31 additions & 7 deletions osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,31 @@

namespace osu.Game.Rulesets.Taiko.Difficulty
{
public class TaikoDifficultyAttributes : DifficultyAttributes
public interface ITaikoDifficultyAttributes : IDifficultyAttributes
{
/// <summary>
/// The difficulty corresponding to the stamina skill.
/// </summary>
[JsonProperty("stamina_difficulty")]
public double StaminaDifficulty { get; set; }

/// <summary>
/// The ratio of stamina difficulty from mono-color (single colour) streams to total stamina difficulty.
/// </summary>
[JsonProperty("mono_stamina_factor")]
public double MonoStaminaFactor { get; set; }

/// <summary>
/// The difficulty corresponding to the rhythm skill.
/// </summary>
[JsonProperty("rhythm_difficulty")]
public double RhythmDifficulty { get; set; }

/// <summary>
/// The difficulty corresponding to the colour skill.
/// </summary>
[JsonProperty("colour_difficulty")]
public double ColourDifficulty { get; set; }

/// <summary>
/// The difficulty corresponding to the hardest parts of the map.
/// </summary>
[JsonProperty("peak_difficulty")]
public double PeakDifficulty { get; set; }

/// <summary>
Expand All @@ -46,7 +41,6 @@ public class TaikoDifficultyAttributes : DifficultyAttributes
/// <remarks>
/// Rate-adjusting mods don't directly affect the hit window, but have a perceived effect as a result of adjusting audio timing.
/// </remarks>
[JsonProperty("great_hit_window")]
public double GreatHitWindow { get; set; }

/// <summary>
Expand All @@ -55,6 +49,36 @@ public class TaikoDifficultyAttributes : DifficultyAttributes
/// <remarks>
/// Rate-adjusting mods don't directly affect the hit window, but have a perceived effect as a result of adjusting audio timing.
/// </remarks>
public double OkHitWindow { get; set; }
}

public class TaikoDifficultyAttributes : DifficultyAttributes, ITaikoDifficultyAttributes
{
/// <inheritdoc/>
[JsonProperty("stamina_difficulty")]
public double StaminaDifficulty { get; set; }

/// <inheritdoc/>
[JsonProperty("mono_stamina_factor")]
public double MonoStaminaFactor { get; set; }

/// <inheritdoc/>
[JsonProperty("rhythm_difficulty")]
public double RhythmDifficulty { get; set; }

/// <inheritdoc/>
[JsonProperty("colour_difficulty")]
public double ColourDifficulty { get; set; }

/// <inheritdoc/>
[JsonProperty("peak_difficulty")]
public double PeakDifficulty { get; set; }

/// <inheritdoc/>
[JsonProperty("great_hit_window")]
public double GreatHitWindow { get; set; }

/// <inheritdoc/>
[JsonProperty("ok_hit_window")]
public double OkHitWindow { get; set; }

Expand Down
17 changes: 16 additions & 1 deletion osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,32 @@

namespace osu.Game.Rulesets.Taiko.Difficulty
{
public class TaikoPerformanceAttributes : PerformanceAttributes
public interface ITaikoPerformanceAttributes : IPerformanceAttributes
{
public double Difficulty { get; set; }

public double Accuracy { get; set; }

public double EffectiveMissCount { get; set; }

public double? EstimatedUnstableRate { get; set; }
}

public class TaikoPerformanceAttributes : PerformanceAttributes, ITaikoPerformanceAttributes
{
/// <inheritdoc/>
[JsonProperty("difficulty")]
public double Difficulty { get; set; }

/// <inheritdoc/>
[JsonProperty("accuracy")]
public double Accuracy { get; set; }

/// <inheritdoc/>
[JsonProperty("effective_miss_count")]
public double EffectiveMissCount { get; set; }

/// <inheritdoc/>
[JsonProperty("estimated_unstable_rate")]
public double? EstimatedUnstableRate { get; set; }

Expand Down
23 changes: 16 additions & 7 deletions osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,24 @@

namespace osu.Game.Rulesets.Difficulty
{
public interface IDifficultyAttributes
{
/// <summary>
/// The combined star rating of all skills.
/// </summary>
public double StarRating { get; set; }

/// <summary>
/// The maximum achievable combo.
/// </summary>
public int MaxCombo { get; set; }
}

/// <summary>
/// Describes the difficulty of a beatmap, as output by a <see cref="DifficultyCalculator"/>.
/// </summary>
[JsonObject(MemberSerialization.OptIn)]
public class DifficultyAttributes
public class DifficultyAttributes : IDifficultyAttributes
{
protected const int ATTRIB_ID_AIM = 1;
protected const int ATTRIB_ID_SPEED = 3;
Expand All @@ -36,15 +49,11 @@ public class DifficultyAttributes
/// </summary>
public Mod[] Mods { get; set; } = Array.Empty<Mod>();

/// <summary>
/// The combined star rating of all skills.
/// </summary>
/// <inheritdoc>/>
[JsonProperty("star_rating", Order = -3)]
public double StarRating { get; set; }

/// <summary>
/// The maximum achievable combo.
/// </summary>
/// <inheritdoc>/>
[JsonProperty("max_combo", Order = -2)]
public int MaxCombo { get; set; }

Expand Down
Loading