1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 06:02:54 +08:00

Adjust attribute data

This commit is contained in:
Dan Balasescu 2023-06-19 21:38:13 +09:00
parent 975e9baf43
commit bfa449e47a
8 changed files with 82 additions and 57 deletions

View File

@ -49,9 +49,9 @@ namespace osu.Game.Rulesets.Catch.Difficulty
Mods = mods, Mods = mods,
ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0, ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0,
MaxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType<JuiceStream>().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)), MaxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType<JuiceStream>().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)),
LegacyTotalScore = sv1Processor.TotalScore, LegacyAccuracyScore = sv1Processor.AccuracyScore,
LegacyComboScore = sv1Processor.ComboScore, LegacyComboScore = sv1Processor.ComboScore,
LegacyBonusScore = sv1Processor.BonusScore LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio
}; };
} }

View File

@ -6,31 +6,34 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Catch.Difficulty namespace osu.Game.Rulesets.Catch.Difficulty
{ {
internal class CatchScoreV1Processor internal class CatchScoreV1Processor
{ {
public int TotalScore => BaseScore + ComboScore + BonusScore; /// <summary>
/// The accuracy portion of the legacy (ScoreV1) total score.
/// </summary>
public int AccuracyScore { get; private set; }
/// <summary> /// <summary>
/// Amount of score that is combo-and-difficulty-multiplied, excluding mod multipliers. /// The combo-multiplied portion of the legacy (ScoreV1) total score.
/// </summary> /// </summary>
public int ComboScore { get; private set; } public int ComboScore { get; private set; }
/// <summary> /// <summary>
/// Amount of score that is NOT combo-and-difficulty-multiplied. /// A ratio of <c>new_bonus_score / old_bonus_score</c> for converting the bonus score of legacy scores to the new scoring.
/// This is made up of all judgements that would be <see cref="HitResult.SmallBonus"/> or <see cref="HitResult.LargeBonus"/>.
/// </summary> /// </summary>
public int BaseScore { get; private set; } public double BonusScoreRatio => legacyBonusScore == 0 ? 0 : (double)modernBonusScore / legacyBonusScore;
/// <summary>
/// Amount of score whose judgements would be treated as "bonus" in ScoreV2.
/// </summary>
public int BonusScore { get; private set; }
private int legacyBonusScore;
private int modernBonusScore;
private int combo; private int combo;
private readonly double scoreMultiplier; private readonly double scoreMultiplier;
@ -77,7 +80,9 @@ namespace osu.Game.Rulesets.Catch.Difficulty
{ {
bool increaseCombo = true; bool increaseCombo = true;
bool addScoreComboMultiplier = false; bool addScoreComboMultiplier = false;
bool isBonus = false; bool isBonus = false;
HitResult bonusResult = HitResult.None;
int scoreIncrease = 0; int scoreIncrease = 0;
@ -102,6 +107,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
scoreIncrease = 1100; scoreIncrease = 1100;
increaseCombo = false; increaseCombo = false;
isBonus = true; isBonus = true;
bonusResult = HitResult.LargeBonus;
break; break;
case JuiceStream: case JuiceStream:
@ -122,9 +128,12 @@ namespace osu.Game.Rulesets.Catch.Difficulty
} }
if (isBonus) if (isBonus)
BonusScore += scoreIncrease; {
legacyBonusScore += scoreIncrease;
modernBonusScore += Judgement.ToNumericResult(bonusResult);
}
else else
BaseScore += scoreIncrease; AccuracyScore += scoreIncrease;
if (increaseCombo) if (increaseCombo)
combo++; combo++;

View File

@ -33,13 +33,9 @@ namespace osu.Game.Rulesets.Mania.Difficulty
public override int Version => 20220902; public override int Version => 20220902;
private readonly IWorkingBeatmap workingBeatmap;
public ManiaDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap) public ManiaDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap) : base(ruleset, beatmap)
{ {
workingBeatmap = beatmap;
isForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.MatchesOnlineID(ruleset); isForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.MatchesOnlineID(ruleset);
originalOverallDifficulty = beatmap.BeatmapInfo.Difficulty.OverallDifficulty; originalOverallDifficulty = beatmap.BeatmapInfo.Difficulty.OverallDifficulty;
} }
@ -62,7 +58,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty
// This is done the way it is to introduce fractional differences in order to match osu-stable for the time being. // This is done the way it is to introduce fractional differences in order to match osu-stable for the time being.
GreatHitWindow = Math.Ceiling((int)(getHitWindow300(mods) * clockRate) / clockRate), GreatHitWindow = Math.Ceiling((int)(getHitWindow300(mods) * clockRate) / clockRate),
MaxCombo = beatmap.HitObjects.Sum(maxComboForObject), MaxCombo = beatmap.HitObjects.Sum(maxComboForObject),
LegacyTotalScore = sv1Processor.TotalScore,
LegacyComboScore = sv1Processor.TotalScore LegacyComboScore = sv1Processor.TotalScore
}; };
} }

View File

@ -109,9 +109,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty
HitCircleCount = hitCirclesCount, HitCircleCount = hitCirclesCount,
SliderCount = sliderCount, SliderCount = sliderCount,
SpinnerCount = spinnerCount, SpinnerCount = spinnerCount,
LegacyTotalScore = sv1Processor.TotalScore, LegacyAccuracyScore = sv1Processor.AccuracyScore,
LegacyComboScore = sv1Processor.ComboScore, LegacyComboScore = sv1Processor.ComboScore,
LegacyBonusScore = sv1Processor.BonusScore LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio
}; };
} }

View File

@ -5,32 +5,35 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Difficulty namespace osu.Game.Rulesets.Osu.Difficulty
{ {
internal class OsuScoreV1Processor internal class OsuScoreV1Processor
{ {
public int TotalScore => BaseScore + ComboScore + BonusScore; /// <summary>
/// The accuracy portion of the legacy (ScoreV1) total score.
/// </summary>
public int AccuracyScore { get; private set; }
/// <summary> /// <summary>
/// Amount of score that is combo-and-difficulty-multiplied, excluding mod multipliers. /// The combo-multiplied portion of the legacy (ScoreV1) total score.
/// </summary> /// </summary>
public int ComboScore { get; private set; } public int ComboScore { get; private set; }
/// <summary> /// <summary>
/// Amount of score that is NOT combo-and-difficulty-multiplied. /// A ratio of <c>new_bonus_score / old_bonus_score</c> for converting the bonus score of legacy scores to the new scoring.
/// This is made up of all judgements that would be <see cref="HitResult.SmallBonus"/> or <see cref="HitResult.LargeBonus"/>.
/// </summary> /// </summary>
public int BaseScore { get; private set; } public double BonusScoreRatio => legacyBonusScore == 0 ? 0 : (double)modernBonusScore / legacyBonusScore;
/// <summary>
/// Amount of score whose judgements would be treated as "bonus" in ScoreV2.
/// </summary>
public int BonusScore { get; private set; }
private int legacyBonusScore;
private int modernBonusScore;
private int combo; private int combo;
private readonly double scoreMultiplier; private readonly double scoreMultiplier;
@ -80,7 +83,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty
{ {
bool increaseCombo = true; bool increaseCombo = true;
bool addScoreComboMultiplier = false; bool addScoreComboMultiplier = false;
bool isBonus = false; bool isBonus = false;
HitResult bonusResult = HitResult.None;
int scoreIncrease = 0; int scoreIncrease = 0;
@ -100,12 +105,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty
scoreIncrease = 1100; scoreIncrease = 1100;
increaseCombo = false; increaseCombo = false;
isBonus = true; isBonus = true;
bonusResult = HitResult.LargeBonus;
break; break;
case SpinnerTick: case SpinnerTick:
scoreIncrease = 100; scoreIncrease = 100;
increaseCombo = false; increaseCombo = false;
isBonus = true; isBonus = true;
bonusResult = HitResult.SmallBonus;
break; break;
case HitCircle: case HitCircle:
@ -156,9 +163,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty
} }
if (isBonus) if (isBonus)
BonusScore += scoreIncrease; {
legacyBonusScore += scoreIncrease;
modernBonusScore += Judgement.ToNumericResult(bonusResult);
}
else else
BaseScore += scoreIncrease; AccuracyScore += scoreIncrease;
if (increaseCombo) if (increaseCombo)
combo++; combo++;

View File

@ -101,9 +101,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
PeakDifficulty = combinedRating, PeakDifficulty = combinedRating,
GreatHitWindow = hitWindows.WindowFor(HitResult.Great) / clockRate, GreatHitWindow = hitWindows.WindowFor(HitResult.Great) / clockRate,
MaxCombo = beatmap.HitObjects.Count(h => h is Hit), MaxCombo = beatmap.HitObjects.Count(h => h is Hit),
LegacyTotalScore = sv1Processor.TotalScore, LegacyAccuracyScore = sv1Processor.AccuracyScore,
LegacyComboScore = sv1Processor.ComboScore, LegacyComboScore = sv1Processor.ComboScore,
LegacyBonusScore = sv1Processor.BonusScore LegacyBonusScoreRatio = sv1Processor.BonusScoreRatio
}; };
} }

View File

@ -5,32 +5,35 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects;
namespace osu.Game.Rulesets.Taiko.Difficulty namespace osu.Game.Rulesets.Taiko.Difficulty
{ {
internal class TaikoScoreV1Processor internal class TaikoScoreV1Processor
{ {
public int TotalScore => BaseScore + ComboScore + BonusScore; /// <summary>
/// The accuracy portion of the legacy (ScoreV1) total score.
/// </summary>
public int AccuracyScore { get; private set; }
/// <summary> /// <summary>
/// Amount of score that is combo-and-difficulty-multiplied, excluding mod multipliers. /// The combo-multiplied portion of the legacy (ScoreV1) total score.
/// </summary> /// </summary>
public int ComboScore { get; private set; } public int ComboScore { get; private set; }
/// <summary> /// <summary>
/// Amount of score that is NOT combo-and-difficulty-multiplied. /// A ratio of <c>new_bonus_score / old_bonus_score</c> for converting the bonus score of legacy scores to the new scoring.
/// This is made up of all judgements that would be <see cref="HitResult.SmallBonus"/> or <see cref="HitResult.LargeBonus"/>.
/// </summary> /// </summary>
public int BaseScore { get; private set; } public double BonusScoreRatio => legacyBonusScore == 0 ? 0 : (double)modernBonusScore / legacyBonusScore;
/// <summary>
/// Amount of score whose judgements would be treated as "bonus" in ScoreV2.
/// </summary>
public int BonusScore { get; private set; }
private int legacyBonusScore;
private int modernBonusScore;
private int combo; private int combo;
private readonly double modMultiplier; private readonly double modMultiplier;
@ -83,7 +86,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
{ {
bool increaseCombo = true; bool increaseCombo = true;
bool addScoreComboMultiplier = false; bool addScoreComboMultiplier = false;
bool isBonus = false; bool isBonus = false;
HitResult bonusResult = HitResult.None;
int scoreIncrease = 0; int scoreIncrease = 0;
@ -98,6 +103,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
scoreIncrease = 300; scoreIncrease = 300;
increaseCombo = false; increaseCombo = false;
isBonus = true; isBonus = true;
bonusResult = HitResult.SmallBonus;
break; break;
case Swell swell: case Swell swell:
@ -123,6 +129,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
addScoreComboMultiplier = true; addScoreComboMultiplier = true;
increaseCombo = false; increaseCombo = false;
isBonus = true; isBonus = true;
bonusResult = HitResult.LargeBonus;
break; break;
case Hit: case Hit:
@ -181,9 +188,12 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
ComboScore += comboScoreIncrease; ComboScore += comboScoreIncrease;
if (isBonus) if (isBonus)
BonusScore += scoreIncrease; {
legacyBonusScore += scoreIncrease;
modernBonusScore += Judgement.ToNumericResult(bonusResult);
}
else else
BaseScore += scoreIncrease; AccuracyScore += scoreIncrease;
if (increaseCombo) if (increaseCombo)
combo++; combo++;

View File

@ -27,9 +27,9 @@ namespace osu.Game.Rulesets.Difficulty
protected const int ATTRIB_ID_FLASHLIGHT = 17; protected const int ATTRIB_ID_FLASHLIGHT = 17;
protected const int ATTRIB_ID_SLIDER_FACTOR = 19; protected const int ATTRIB_ID_SLIDER_FACTOR = 19;
protected const int ATTRIB_ID_SPEED_NOTE_COUNT = 21; protected const int ATTRIB_ID_SPEED_NOTE_COUNT = 21;
protected const int ATTRIB_ID_LEGACY_TOTAL_SCORE = 23; protected const int ATTRIB_ID_LEGACY_ACCURACY_SCORE = 23;
protected const int ATTRIB_ID_LEGACY_COMBO_SCORE = 25; protected const int ATTRIB_ID_LEGACY_COMBO_SCORE = 25;
protected const int ATTRIB_ID_LEGACY_BONUS_SCORE = 27; protected const int ATTRIB_ID_LEGACY_BONUS_SCORE_RATIO = 27;
/// <summary> /// <summary>
/// The mods which were applied to the beatmap. /// The mods which were applied to the beatmap.
@ -49,22 +49,23 @@ namespace osu.Game.Rulesets.Difficulty
public int MaxCombo { get; set; } public int MaxCombo { get; set; }
/// <summary> /// <summary>
/// The maximum achievable legacy total score. /// The accuracy portion of the legacy (ScoreV1) total score.
/// </summary> /// </summary>
[JsonProperty("legacy_total_score", Order = -5)] [JsonProperty("legacy_accuracy_score", Order = -5)]
public int LegacyTotalScore { get; set; } public int LegacyAccuracyScore { get; set; }
/// <summary> /// <summary>
/// The combo-multiplied portion of <see cref="LegacyTotalScore"/>. /// The combo-multiplied portion of the legacy (ScoreV1) total score.
/// </summary> /// </summary>
[JsonProperty("legacy_combo_score", Order = -4)] [JsonProperty("legacy_combo_score", Order = -4)]
public int LegacyComboScore { get; set; } public int LegacyComboScore { get; set; }
/// <summary> /// <summary>
/// The "bonus" portion of <see cref="LegacyTotalScore"/> consisting of all judgements that would be <see cref="HitResult.SmallBonus"/> or <see cref="HitResult.LargeBonus"/>. /// A ratio of <c>new_bonus_score / old_bonus_score</c> for converting the bonus score of legacy scores to the new scoring.
/// This is made up of all judgements that would be <see cref="HitResult.SmallBonus"/> or <see cref="HitResult.LargeBonus"/>.
/// </summary> /// </summary>
[JsonProperty("legacy_bonus_score", Order = -3)] [JsonProperty("legacy_bonus_score_ratio", Order = -3)]
public int LegacyBonusScore { get; set; } public double LegacyBonusScoreRatio { get; set; }
/// <summary> /// <summary>
/// Creates new <see cref="DifficultyAttributes"/>. /// Creates new <see cref="DifficultyAttributes"/>.
@ -93,9 +94,9 @@ namespace osu.Game.Rulesets.Difficulty
public virtual IEnumerable<(int attributeId, object value)> ToDatabaseAttributes() public virtual IEnumerable<(int attributeId, object value)> ToDatabaseAttributes()
{ {
yield return (ATTRIB_ID_MAX_COMBO, MaxCombo); yield return (ATTRIB_ID_MAX_COMBO, MaxCombo);
yield return (ATTRIB_ID_LEGACY_TOTAL_SCORE, LegacyTotalScore); yield return (ATTRIB_ID_LEGACY_ACCURACY_SCORE, LegacyAccuracyScore);
yield return (ATTRIB_ID_LEGACY_COMBO_SCORE, LegacyComboScore); yield return (ATTRIB_ID_LEGACY_COMBO_SCORE, LegacyComboScore);
yield return (ATTRIB_ID_LEGACY_BONUS_SCORE, LegacyBonusScore); yield return (ATTRIB_ID_LEGACY_BONUS_SCORE_RATIO, LegacyBonusScoreRatio);
} }
/// <summary> /// <summary>
@ -106,9 +107,9 @@ namespace osu.Game.Rulesets.Difficulty
public virtual void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values, IBeatmapOnlineInfo onlineInfo) public virtual void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values, IBeatmapOnlineInfo onlineInfo)
{ {
MaxCombo = (int)values[ATTRIB_ID_MAX_COMBO]; MaxCombo = (int)values[ATTRIB_ID_MAX_COMBO];
LegacyTotalScore = (int)values[ATTRIB_ID_LEGACY_TOTAL_SCORE]; LegacyAccuracyScore = (int)values[ATTRIB_ID_LEGACY_ACCURACY_SCORE];
LegacyComboScore = (int)values[ATTRIB_ID_LEGACY_COMBO_SCORE]; LegacyComboScore = (int)values[ATTRIB_ID_LEGACY_COMBO_SCORE];
LegacyBonusScore = (int)values[ATTRIB_ID_LEGACY_BONUS_SCORE]; LegacyBonusScoreRatio = (int)values[ATTRIB_ID_LEGACY_BONUS_SCORE_RATIO];
} }
} }
} }