2019-01-24 16:43:03 +08: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.
|
2018-06-14 14:36:49 +08:00
|
|
|
|
|
2021-11-15 15:06:46 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2021-11-15 16:24:53 +08:00
|
|
|
|
using JetBrains.Annotations;
|
2021-11-15 15:06:29 +08:00
|
|
|
|
using Newtonsoft.Json;
|
2018-06-14 14:36:49 +08:00
|
|
|
|
using osu.Game.Rulesets.Difficulty;
|
2021-11-15 15:06:46 +08:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2018-06-14 14:36:49 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Difficulty
|
|
|
|
|
{
|
|
|
|
|
public class OsuDifficultyAttributes : DifficultyAttributes
|
|
|
|
|
{
|
2021-11-15 15:06:29 +08:00
|
|
|
|
[JsonProperty("aim_strain")]
|
2021-06-08 17:43:59 +08:00
|
|
|
|
public double AimStrain { get; set; }
|
2021-11-15 15:06:29 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty("speed_strain")]
|
2021-06-08 17:43:59 +08:00
|
|
|
|
public double SpeedStrain { get; set; }
|
2021-11-15 15:06:29 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty("flashlight_rating")]
|
2021-09-14 08:34:21 +08:00
|
|
|
|
public double FlashlightRating { get; set; }
|
2021-11-15 15:06:29 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty("slider_factor")]
|
2021-11-10 08:59:28 +08:00
|
|
|
|
public double SliderFactor { get; set; }
|
2021-11-15 15:06:29 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty("approach_rate")]
|
2021-06-08 17:43:59 +08:00
|
|
|
|
public double ApproachRate { get; set; }
|
2021-11-15 15:06:29 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty("overall_difficulty")]
|
2021-06-08 17:43:59 +08:00
|
|
|
|
public double OverallDifficulty { get; set; }
|
2021-11-15 15:06:29 +08:00
|
|
|
|
|
2021-11-15 15:32:25 +08:00
|
|
|
|
[JsonIgnore]
|
2021-09-24 22:02:19 +08:00
|
|
|
|
public double DrainRate { get; set; }
|
2021-11-15 15:06:29 +08:00
|
|
|
|
|
2021-11-15 15:32:25 +08:00
|
|
|
|
[JsonIgnore]
|
2021-06-08 17:43:59 +08:00
|
|
|
|
public int HitCircleCount { get; set; }
|
2021-11-15 15:06:29 +08:00
|
|
|
|
|
2021-11-15 15:32:25 +08:00
|
|
|
|
[JsonIgnore]
|
2021-10-14 01:04:34 +08:00
|
|
|
|
public int SliderCount { get; set; }
|
2021-11-15 15:06:29 +08:00
|
|
|
|
|
2021-11-15 15:32:25 +08:00
|
|
|
|
[JsonIgnore]
|
2021-06-08 17:43:59 +08:00
|
|
|
|
public int SpinnerCount { get; set; }
|
2021-11-15 15:06:46 +08:00
|
|
|
|
|
|
|
|
|
public override IEnumerable<(int attributeId, object value)> ToDatabase()
|
|
|
|
|
{
|
|
|
|
|
foreach (var v in base.ToDatabase())
|
|
|
|
|
yield return v;
|
|
|
|
|
|
|
|
|
|
yield return (1, AimStrain);
|
|
|
|
|
yield return (3, SpeedStrain);
|
|
|
|
|
yield return (5, OverallDifficulty);
|
|
|
|
|
yield return (7, ApproachRate);
|
|
|
|
|
yield return (9, MaxCombo);
|
|
|
|
|
yield return (11, StarRating);
|
|
|
|
|
|
|
|
|
|
if (Mods.Any(m => m is ModFlashlight))
|
|
|
|
|
yield return (17, FlashlightRating);
|
|
|
|
|
|
|
|
|
|
yield return (19, SliderFactor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void FromDatabase(IReadOnlyDictionary<int, double> values, int hitCircleCount, int spinnerCount)
|
|
|
|
|
{
|
|
|
|
|
base.FromDatabase(values, hitCircleCount, spinnerCount);
|
|
|
|
|
|
|
|
|
|
AimStrain = values[1];
|
|
|
|
|
SpeedStrain = values[3];
|
|
|
|
|
OverallDifficulty = values[5];
|
|
|
|
|
ApproachRate = values[7];
|
|
|
|
|
MaxCombo = (int)values[9];
|
|
|
|
|
StarRating = values[11];
|
|
|
|
|
FlashlightRating = values.GetValueOrDefault(17);
|
|
|
|
|
SliderFactor = values[19];
|
|
|
|
|
HitCircleCount = hitCircleCount;
|
|
|
|
|
SpinnerCount = spinnerCount;
|
|
|
|
|
}
|
2021-11-15 16:24:53 +08:00
|
|
|
|
|
|
|
|
|
[UsedImplicitly]
|
|
|
|
|
public bool ShouldSerializeFlashlightRating() => Mods.OfType<ModFlashlight>().Any();
|
2018-06-14 14:36:49 +08:00
|
|
|
|
}
|
|
|
|
|
}
|