mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 05:22:54 +08:00
Merge branch 'master' into editor-save-local-score-management
This commit is contained in:
commit
9ff6b3fcd3
@ -202,6 +202,8 @@ namespace osu.Game.Rulesets.Catch
|
||||
|
||||
public int LegacyID => 2;
|
||||
|
||||
public ILegacyScoreSimulator CreateLegacyScoreSimulator() => new CatchLegacyScoreSimulator();
|
||||
|
||||
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new CatchReplayFrame();
|
||||
|
||||
public override HitObjectComposer CreateHitObjectComposer() => new CatchHitObjectComposer(this);
|
||||
|
@ -27,7 +27,6 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
||||
// Todo: osu!catch should not output star rating in the 'aim' attribute.
|
||||
yield return (ATTRIB_ID_AIM, StarRating);
|
||||
yield return (ATTRIB_ID_APPROACH_RATE, ApproachRate);
|
||||
yield return (ATTRIB_ID_MAX_COMBO, MaxCombo);
|
||||
}
|
||||
|
||||
public override void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values, IBeatmapOnlineInfo onlineInfo)
|
||||
@ -36,7 +35,6 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
||||
|
||||
StarRating = values[ATTRIB_ID_AIM];
|
||||
ApproachRate = values[ATTRIB_ID_APPROACH_RATE];
|
||||
MaxCombo = (int)values[ATTRIB_ID_MAX_COMBO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,9 +25,12 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
||||
|
||||
public override int Version => 20220701;
|
||||
|
||||
private readonly IWorkingBeatmap workingBeatmap;
|
||||
|
||||
public CatchDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
|
||||
: base(ruleset, beatmap)
|
||||
{
|
||||
workingBeatmap = beatmap;
|
||||
}
|
||||
|
||||
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
|
||||
@ -38,13 +41,24 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
||||
// this is the same as osu!, so there's potential to share the implementation... maybe
|
||||
double preempt = IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.ApproachRate, 1800, 1200, 450) / clockRate;
|
||||
|
||||
return new CatchDifficultyAttributes
|
||||
CatchDifficultyAttributes attributes = new CatchDifficultyAttributes
|
||||
{
|
||||
StarRating = Math.Sqrt(skills[0].DifficultyValue()) * star_scaling_factor,
|
||||
Mods = mods,
|
||||
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)),
|
||||
};
|
||||
|
||||
if (ComputeLegacyScoringValues)
|
||||
{
|
||||
CatchLegacyScoreSimulator sv1Simulator = new CatchLegacyScoreSimulator();
|
||||
sv1Simulator.Simulate(workingBeatmap, beatmap, mods);
|
||||
attributes.LegacyAccuracyScore = sv1Simulator.AccuracyScore;
|
||||
attributes.LegacyComboScore = sv1Simulator.ComboScore;
|
||||
attributes.LegacyBonusScoreRatio = sv1Simulator.BonusScoreRatio;
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
||||
|
142
osu.Game.Rulesets.Catch/Difficulty/CatchLegacyScoreSimulator.cs
Normal file
142
osu.Game.Rulesets.Catch/Difficulty/CatchLegacyScoreSimulator.cs
Normal file
@ -0,0 +1,142 @@
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Difficulty
|
||||
{
|
||||
internal class CatchLegacyScoreSimulator : ILegacyScoreSimulator
|
||||
{
|
||||
public int AccuracyScore { get; private set; }
|
||||
|
||||
public int ComboScore { get; private set; }
|
||||
|
||||
public double BonusScoreRatio => legacyBonusScore == 0 ? 0 : (double)modernBonusScore / legacyBonusScore;
|
||||
|
||||
private int legacyBonusScore;
|
||||
private int modernBonusScore;
|
||||
private int combo;
|
||||
|
||||
private double scoreMultiplier;
|
||||
|
||||
public void Simulate(IWorkingBeatmap workingBeatmap, IBeatmap playableBeatmap, IReadOnlyList<Mod> mods)
|
||||
{
|
||||
IBeatmap baseBeatmap = workingBeatmap.Beatmap;
|
||||
|
||||
int countNormal = 0;
|
||||
int countSlider = 0;
|
||||
int countSpinner = 0;
|
||||
|
||||
foreach (HitObject obj in baseBeatmap.HitObjects)
|
||||
{
|
||||
switch (obj)
|
||||
{
|
||||
case IHasPath:
|
||||
countSlider++;
|
||||
break;
|
||||
|
||||
case IHasDuration:
|
||||
countSpinner++;
|
||||
break;
|
||||
|
||||
default:
|
||||
countNormal++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int objectCount = countNormal + countSlider + countSpinner;
|
||||
|
||||
int drainLength = 0;
|
||||
|
||||
if (baseBeatmap.HitObjects.Count > 0)
|
||||
{
|
||||
int breakLength = baseBeatmap.Breaks.Select(b => (int)Math.Round(b.EndTime) - (int)Math.Round(b.StartTime)).Sum();
|
||||
drainLength = ((int)Math.Round(baseBeatmap.HitObjects[^1].StartTime) - (int)Math.Round(baseBeatmap.HitObjects[0].StartTime) - breakLength) / 1000;
|
||||
}
|
||||
|
||||
int difficultyPeppyStars = (int)Math.Round(
|
||||
(baseBeatmap.Difficulty.DrainRate
|
||||
+ baseBeatmap.Difficulty.OverallDifficulty
|
||||
+ baseBeatmap.Difficulty.CircleSize
|
||||
+ Math.Clamp((float)objectCount / drainLength * 8, 0, 16)) / 38 * 5);
|
||||
|
||||
scoreMultiplier = difficultyPeppyStars * mods.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier);
|
||||
|
||||
foreach (var obj in playableBeatmap.HitObjects)
|
||||
simulateHit(obj);
|
||||
}
|
||||
|
||||
private void simulateHit(HitObject hitObject)
|
||||
{
|
||||
bool increaseCombo = true;
|
||||
bool addScoreComboMultiplier = false;
|
||||
|
||||
bool isBonus = false;
|
||||
HitResult bonusResult = HitResult.None;
|
||||
|
||||
int scoreIncrease = 0;
|
||||
|
||||
switch (hitObject)
|
||||
{
|
||||
case TinyDroplet:
|
||||
scoreIncrease = 10;
|
||||
increaseCombo = false;
|
||||
break;
|
||||
|
||||
case Droplet:
|
||||
scoreIncrease = 100;
|
||||
break;
|
||||
|
||||
case Fruit:
|
||||
scoreIncrease = 300;
|
||||
addScoreComboMultiplier = true;
|
||||
increaseCombo = true;
|
||||
break;
|
||||
|
||||
case Banana:
|
||||
scoreIncrease = 1100;
|
||||
increaseCombo = false;
|
||||
isBonus = true;
|
||||
bonusResult = HitResult.LargeBonus;
|
||||
break;
|
||||
|
||||
case JuiceStream:
|
||||
foreach (var nested in hitObject.NestedHitObjects)
|
||||
simulateHit(nested);
|
||||
return;
|
||||
|
||||
case BananaShower:
|
||||
foreach (var nested in hitObject.NestedHitObjects)
|
||||
simulateHit(nested);
|
||||
return;
|
||||
}
|
||||
|
||||
if (addScoreComboMultiplier)
|
||||
{
|
||||
// ReSharper disable once PossibleLossOfFraction (intentional to match osu-stable...)
|
||||
ComboScore += (int)(Math.Max(0, combo - 1) * (scoreIncrease / 25 * scoreMultiplier));
|
||||
}
|
||||
|
||||
if (isBonus)
|
||||
{
|
||||
legacyBonusScore += scoreIncrease;
|
||||
modernBonusScore += Judgement.ToNumericResult(bonusResult);
|
||||
}
|
||||
else
|
||||
AccuracyScore += scoreIncrease;
|
||||
|
||||
if (increaseCombo)
|
||||
combo++;
|
||||
}
|
||||
}
|
||||
}
|
@ -24,7 +24,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
||||
foreach (var v in base.ToDatabaseAttributes())
|
||||
yield return v;
|
||||
|
||||
yield return (ATTRIB_ID_MAX_COMBO, MaxCombo);
|
||||
yield return (ATTRIB_ID_DIFFICULTY, StarRating);
|
||||
yield return (ATTRIB_ID_GREAT_HIT_WINDOW, GreatHitWindow);
|
||||
}
|
||||
@ -33,7 +32,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
||||
{
|
||||
base.FromDatabaseAttributes(values, onlineInfo);
|
||||
|
||||
MaxCombo = (int)values[ATTRIB_ID_MAX_COMBO];
|
||||
StarRating = values[ATTRIB_ID_DIFFICULTY];
|
||||
GreatHitWindow = values[ATTRIB_ID_GREAT_HIT_WINDOW];
|
||||
}
|
||||
|
@ -31,9 +31,13 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
||||
|
||||
public override int Version => 20220902;
|
||||
|
||||
private readonly IWorkingBeatmap workingBeatmap;
|
||||
|
||||
public ManiaDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
|
||||
: base(ruleset, beatmap)
|
||||
{
|
||||
workingBeatmap = beatmap;
|
||||
|
||||
isForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.MatchesOnlineID(ruleset);
|
||||
originalOverallDifficulty = beatmap.BeatmapInfo.Difficulty.OverallDifficulty;
|
||||
}
|
||||
@ -46,15 +50,26 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
||||
HitWindows hitWindows = new ManiaHitWindows();
|
||||
hitWindows.SetDifficulty(beatmap.Difficulty.OverallDifficulty);
|
||||
|
||||
return new ManiaDifficultyAttributes
|
||||
ManiaDifficultyAttributes attributes = new ManiaDifficultyAttributes
|
||||
{
|
||||
StarRating = skills[0].DifficultyValue() * star_scaling_factor,
|
||||
Mods = mods,
|
||||
// In osu-stable mania, rate-adjustment mods don't affect the hit window.
|
||||
// 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),
|
||||
MaxCombo = beatmap.HitObjects.Sum(maxComboForObject)
|
||||
MaxCombo = beatmap.HitObjects.Sum(maxComboForObject),
|
||||
};
|
||||
|
||||
if (ComputeLegacyScoringValues)
|
||||
{
|
||||
ManiaLegacyScoreSimulator sv1Simulator = new ManiaLegacyScoreSimulator();
|
||||
sv1Simulator.Simulate(workingBeatmap, beatmap, mods);
|
||||
attributes.LegacyAccuracyScore = sv1Simulator.AccuracyScore;
|
||||
attributes.LegacyComboScore = sv1Simulator.ComboScore;
|
||||
attributes.LegacyBonusScoreRatio = sv1Simulator.BonusScoreRatio;
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
private static int maxComboForObject(HitObject hitObject)
|
||||
|
@ -0,0 +1,28 @@
|
||||
// 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.Mania.Mods;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Difficulty
|
||||
{
|
||||
internal class ManiaLegacyScoreSimulator : ILegacyScoreSimulator
|
||||
{
|
||||
public int AccuracyScore => 0;
|
||||
public int ComboScore { get; private set; }
|
||||
public double BonusScoreRatio => 0;
|
||||
|
||||
public void Simulate(IWorkingBeatmap workingBeatmap, IBeatmap playableBeatmap, IReadOnlyList<Mod> mods)
|
||||
{
|
||||
double multiplier = mods.Where(m => m is not (ModHidden or ModHardRock or ModDoubleTime or ModFlashlight or ManiaModFadeIn))
|
||||
.Select(m => m.ScoreMultiplier)
|
||||
.Aggregate(1.0, (c, n) => c * n);
|
||||
|
||||
ComboScore = (int)(1000000 * multiplier);
|
||||
}
|
||||
}
|
||||
}
|
@ -302,6 +302,8 @@ namespace osu.Game.Rulesets.Mania
|
||||
|
||||
public int LegacyID => 3;
|
||||
|
||||
public ILegacyScoreSimulator CreateLegacyScoreSimulator() => new ManiaLegacyScoreSimulator();
|
||||
|
||||
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new ManiaReplayFrame();
|
||||
|
||||
public override IRulesetConfigManager CreateConfig(SettingsStore? settings) => new ManiaRulesetConfigManager(settings, RulesetInfo);
|
||||
|
@ -93,7 +93,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
yield return (ATTRIB_ID_SPEED, SpeedDifficulty);
|
||||
yield return (ATTRIB_ID_OVERALL_DIFFICULTY, OverallDifficulty);
|
||||
yield return (ATTRIB_ID_APPROACH_RATE, ApproachRate);
|
||||
yield return (ATTRIB_ID_MAX_COMBO, MaxCombo);
|
||||
yield return (ATTRIB_ID_DIFFICULTY, StarRating);
|
||||
|
||||
if (ShouldSerializeFlashlightRating())
|
||||
@ -111,7 +110,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
SpeedDifficulty = values[ATTRIB_ID_SPEED];
|
||||
OverallDifficulty = values[ATTRIB_ID_OVERALL_DIFFICULTY];
|
||||
ApproachRate = values[ATTRIB_ID_APPROACH_RATE];
|
||||
MaxCombo = (int)values[ATTRIB_ID_MAX_COMBO];
|
||||
StarRating = values[ATTRIB_ID_DIFFICULTY];
|
||||
FlashlightDifficulty = values.GetValueOrDefault(ATTRIB_ID_FLASHLIGHT);
|
||||
SliderFactor = values[ATTRIB_ID_SLIDER_FACTOR];
|
||||
|
@ -26,9 +26,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
|
||||
public override int Version => 20220902;
|
||||
|
||||
private readonly IWorkingBeatmap workingBeatmap;
|
||||
|
||||
public OsuDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
|
||||
: base(ruleset, beatmap)
|
||||
{
|
||||
workingBeatmap = beatmap;
|
||||
}
|
||||
|
||||
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
|
||||
@ -71,7 +74,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
Math.Pow(baseFlashlightPerformance, 1.1), 1.0 / 1.1
|
||||
);
|
||||
|
||||
double starRating = basePerformance > 0.00001 ? Math.Cbrt(OsuPerformanceCalculator.PERFORMANCE_BASE_MULTIPLIER) * 0.027 * (Math.Cbrt(100000 / Math.Pow(2, 1 / 1.1) * basePerformance) + 4) : 0;
|
||||
double starRating = basePerformance > 0.00001
|
||||
? Math.Cbrt(OsuPerformanceCalculator.PERFORMANCE_BASE_MULTIPLIER) * 0.027 * (Math.Cbrt(100000 / Math.Pow(2, 1 / 1.1) * basePerformance) + 4)
|
||||
: 0;
|
||||
|
||||
double preempt = IBeatmapDifficultyInfo.DifficultyRange(beatmap.Difficulty.ApproachRate, 1800, 1200, 450) / clockRate;
|
||||
double drainRate = beatmap.Difficulty.DrainRate;
|
||||
@ -86,7 +91,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
|
||||
double hitWindowGreat = hitWindows.WindowFor(HitResult.Great) / clockRate;
|
||||
|
||||
return new OsuDifficultyAttributes
|
||||
OsuDifficultyAttributes attributes = new OsuDifficultyAttributes
|
||||
{
|
||||
StarRating = starRating,
|
||||
Mods = mods,
|
||||
@ -103,6 +108,17 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
SliderCount = sliderCount,
|
||||
SpinnerCount = spinnerCount,
|
||||
};
|
||||
|
||||
if (ComputeLegacyScoringValues)
|
||||
{
|
||||
OsuLegacyScoreSimulator sv1Simulator = new OsuLegacyScoreSimulator();
|
||||
sv1Simulator.Simulate(workingBeatmap, beatmap, mods);
|
||||
attributes.LegacyAccuracyScore = sv1Simulator.AccuracyScore;
|
||||
attributes.LegacyComboScore = sv1Simulator.ComboScore;
|
||||
attributes.LegacyBonusScoreRatio = sv1Simulator.BonusScoreRatio;
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
||||
|
177
osu.Game.Rulesets.Osu/Difficulty/OsuLegacyScoreSimulator.cs
Normal file
177
osu.Game.Rulesets.Osu/Difficulty/OsuLegacyScoreSimulator.cs
Normal file
@ -0,0 +1,177 @@
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
{
|
||||
internal class OsuLegacyScoreSimulator : ILegacyScoreSimulator
|
||||
{
|
||||
public int AccuracyScore { get; private set; }
|
||||
|
||||
public int ComboScore { get; private set; }
|
||||
|
||||
public double BonusScoreRatio => legacyBonusScore == 0 ? 0 : (double)modernBonusScore / legacyBonusScore;
|
||||
|
||||
private int legacyBonusScore;
|
||||
private int modernBonusScore;
|
||||
private int combo;
|
||||
|
||||
private double scoreMultiplier;
|
||||
private IBeatmap playableBeatmap = null!;
|
||||
|
||||
public void Simulate(IWorkingBeatmap workingBeatmap, IBeatmap playableBeatmap, IReadOnlyList<Mod> mods)
|
||||
{
|
||||
this.playableBeatmap = playableBeatmap;
|
||||
|
||||
IBeatmap baseBeatmap = workingBeatmap.Beatmap;
|
||||
|
||||
int countNormal = 0;
|
||||
int countSlider = 0;
|
||||
int countSpinner = 0;
|
||||
|
||||
foreach (HitObject obj in workingBeatmap.Beatmap.HitObjects)
|
||||
{
|
||||
switch (obj)
|
||||
{
|
||||
case IHasPath:
|
||||
countSlider++;
|
||||
break;
|
||||
|
||||
case IHasDuration:
|
||||
countSpinner++;
|
||||
break;
|
||||
|
||||
default:
|
||||
countNormal++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int objectCount = countNormal + countSlider + countSpinner;
|
||||
|
||||
int drainLength = 0;
|
||||
|
||||
if (baseBeatmap.HitObjects.Count > 0)
|
||||
{
|
||||
int breakLength = baseBeatmap.Breaks.Select(b => (int)Math.Round(b.EndTime) - (int)Math.Round(b.StartTime)).Sum();
|
||||
drainLength = ((int)Math.Round(baseBeatmap.HitObjects[^1].StartTime) - (int)Math.Round(baseBeatmap.HitObjects[0].StartTime) - breakLength) / 1000;
|
||||
}
|
||||
|
||||
int difficultyPeppyStars = (int)Math.Round(
|
||||
(baseBeatmap.Difficulty.DrainRate
|
||||
+ baseBeatmap.Difficulty.OverallDifficulty
|
||||
+ baseBeatmap.Difficulty.CircleSize
|
||||
+ Math.Clamp((float)objectCount / drainLength * 8, 0, 16)) / 38 * 5);
|
||||
|
||||
scoreMultiplier = difficultyPeppyStars * mods.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier);
|
||||
|
||||
foreach (var obj in playableBeatmap.HitObjects)
|
||||
simulateHit(obj);
|
||||
}
|
||||
|
||||
private void simulateHit(HitObject hitObject)
|
||||
{
|
||||
bool increaseCombo = true;
|
||||
bool addScoreComboMultiplier = false;
|
||||
|
||||
bool isBonus = false;
|
||||
HitResult bonusResult = HitResult.None;
|
||||
|
||||
int scoreIncrease = 0;
|
||||
|
||||
switch (hitObject)
|
||||
{
|
||||
case SliderHeadCircle:
|
||||
case SliderTailCircle:
|
||||
case SliderRepeat:
|
||||
scoreIncrease = 30;
|
||||
break;
|
||||
|
||||
case SliderTick:
|
||||
scoreIncrease = 10;
|
||||
break;
|
||||
|
||||
case SpinnerBonusTick:
|
||||
scoreIncrease = 1100;
|
||||
increaseCombo = false;
|
||||
isBonus = true;
|
||||
bonusResult = HitResult.LargeBonus;
|
||||
break;
|
||||
|
||||
case SpinnerTick:
|
||||
scoreIncrease = 100;
|
||||
increaseCombo = false;
|
||||
isBonus = true;
|
||||
bonusResult = HitResult.SmallBonus;
|
||||
break;
|
||||
|
||||
case HitCircle:
|
||||
scoreIncrease = 300;
|
||||
addScoreComboMultiplier = true;
|
||||
break;
|
||||
|
||||
case Slider:
|
||||
foreach (var nested in hitObject.NestedHitObjects)
|
||||
simulateHit(nested);
|
||||
|
||||
scoreIncrease = 300;
|
||||
increaseCombo = false;
|
||||
addScoreComboMultiplier = true;
|
||||
break;
|
||||
|
||||
case Spinner spinner:
|
||||
// The spinner object applies a lenience because gameplay mechanics differ from osu-stable.
|
||||
// We'll redo the calculations to match osu-stable here...
|
||||
const double maximum_rotations_per_second = 477.0 / 60;
|
||||
double minimumRotationsPerSecond = IBeatmapDifficultyInfo.DifficultyRange(playableBeatmap.Difficulty.OverallDifficulty, 3, 5, 7.5);
|
||||
double secondsDuration = spinner.Duration / 1000;
|
||||
|
||||
// The total amount of half spins possible for the entire spinner.
|
||||
int totalHalfSpinsPossible = (int)(secondsDuration * maximum_rotations_per_second * 2);
|
||||
// The amount of half spins that are required to successfully complete the spinner (i.e. get a 300).
|
||||
int halfSpinsRequiredForCompletion = (int)(secondsDuration * minimumRotationsPerSecond);
|
||||
// To be able to receive bonus points, the spinner must be rotated another 1.5 times.
|
||||
int halfSpinsRequiredBeforeBonus = halfSpinsRequiredForCompletion + 3;
|
||||
|
||||
for (int i = 0; i <= totalHalfSpinsPossible; i++)
|
||||
{
|
||||
if (i > halfSpinsRequiredBeforeBonus && (i - halfSpinsRequiredBeforeBonus) % 2 == 0)
|
||||
simulateHit(new SpinnerBonusTick());
|
||||
else if (i > 1 && i % 2 == 0)
|
||||
simulateHit(new SpinnerTick());
|
||||
}
|
||||
|
||||
scoreIncrease = 300;
|
||||
addScoreComboMultiplier = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (addScoreComboMultiplier)
|
||||
{
|
||||
// ReSharper disable once PossibleLossOfFraction (intentional to match osu-stable...)
|
||||
ComboScore += (int)(Math.Max(0, combo - 1) * (scoreIncrease / 25 * scoreMultiplier));
|
||||
}
|
||||
|
||||
if (isBonus)
|
||||
{
|
||||
legacyBonusScore += scoreIncrease;
|
||||
modernBonusScore += Judgement.ToNumericResult(bonusResult);
|
||||
}
|
||||
else
|
||||
AccuracyScore += scoreIncrease;
|
||||
|
||||
if (increaseCombo)
|
||||
combo++;
|
||||
}
|
||||
}
|
||||
}
|
@ -253,6 +253,8 @@ namespace osu.Game.Rulesets.Osu
|
||||
|
||||
public int LegacyID => 0;
|
||||
|
||||
public ILegacyScoreSimulator CreateLegacyScoreSimulator() => new OsuLegacyScoreSimulator();
|
||||
|
||||
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new OsuReplayFrame();
|
||||
|
||||
public override IRulesetConfigManager CreateConfig(SettingsStore? settings) => new OsuRulesetConfigManager(settings, RulesetInfo);
|
||||
|
@ -72,13 +72,13 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
});
|
||||
|
||||
AddAssert("most valid object is hit", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Hit>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
|
||||
seekTo(200);
|
||||
AddAssert("most valid object is hit", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Hit>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -100,13 +100,13 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
});
|
||||
|
||||
AddAssert("most valid object is hit", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Hit>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
|
||||
seekTo(200);
|
||||
AddAssert("most valid object is hit", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Hit>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -145,23 +145,23 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
});
|
||||
|
||||
AddAssert("most valid object is first hit", () => triggerSource.GetMostValidObject(), () => Is.EqualTo(first));
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_NORMAL);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_NORMAL);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_NORMAL);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_NORMAL);
|
||||
|
||||
seekTo(120);
|
||||
AddAssert("most valid object is first hit", () => triggerSource.GetMostValidObject(), () => Is.EqualTo(first));
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_NORMAL);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_NORMAL);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_NORMAL);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_NORMAL);
|
||||
|
||||
seekTo(480);
|
||||
AddAssert("most valid object is second hit", () => triggerSource.GetMostValidObject(), () => Is.EqualTo(second));
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
|
||||
seekTo(700);
|
||||
AddAssert("most valid object is second hit", () => triggerSource.GetMostValidObject(), () => Is.EqualTo(second));
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -174,8 +174,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
StartTime = 100,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, "drum"),
|
||||
new HitSampleInfo(HitSampleInfo.HIT_FINISH, "drum") // implies strong
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_DRUM),
|
||||
new HitSampleInfo(HitSampleInfo.HIT_FINISH, HitSampleInfo.BANK_DRUM) // implies strong
|
||||
}
|
||||
};
|
||||
hit.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||
@ -184,13 +184,13 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
});
|
||||
|
||||
AddAssert("most valid object is nested strong hit", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Hit.StrongNestedHit>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
checkSamples(HitType.Centre, $"{HitSampleInfo.HIT_NORMAL},{HitSampleInfo.HIT_FINISH}", HitSampleInfo.BANK_DRUM);
|
||||
checkSamples(HitType.Rim, $"{HitSampleInfo.HIT_CLAP},{HitSampleInfo.HIT_WHISTLE}", HitSampleInfo.BANK_DRUM);
|
||||
|
||||
seekTo(200);
|
||||
AddAssert("most valid object is hit", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Hit>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
checkSamples(HitType.Centre, $"{HitSampleInfo.HIT_NORMAL},{HitSampleInfo.HIT_FINISH}", HitSampleInfo.BANK_DRUM);
|
||||
checkSamples(HitType.Rim, $"{HitSampleInfo.HIT_CLAP},{HitSampleInfo.HIT_WHISTLE}", HitSampleInfo.BANK_DRUM);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -213,18 +213,18 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
});
|
||||
|
||||
AddAssert("most valid object is drum roll tick", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRollTick>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
|
||||
seekTo(600);
|
||||
AddAssert("most valid object is drum roll tick", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRollTick>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
|
||||
seekTo(1200);
|
||||
AddAssert("most valid object is drum roll", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRoll>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -247,18 +247,18 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
});
|
||||
|
||||
AddAssert("most valid object is drum roll tick", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRollTick>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
|
||||
seekTo(600);
|
||||
AddAssert("most valid object is drum roll tick", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRollTick>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
|
||||
seekTo(1200);
|
||||
AddAssert("most valid object is drum roll", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRoll>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -272,8 +272,8 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
EndTime = 1100,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, "drum"),
|
||||
new HitSampleInfo(HitSampleInfo.HIT_FINISH, "drum") // implies strong
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_DRUM),
|
||||
new HitSampleInfo(HitSampleInfo.HIT_FINISH, HitSampleInfo.BANK_DRUM) // implies strong
|
||||
}
|
||||
};
|
||||
drumRoll.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||
@ -282,18 +282,18 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
});
|
||||
|
||||
AddAssert("most valid object is drum roll tick", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRollTick>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
checkSamples(HitType.Centre, $"{HitSampleInfo.HIT_NORMAL},{HitSampleInfo.HIT_FINISH}", HitSampleInfo.BANK_DRUM);
|
||||
checkSamples(HitType.Rim, $"{HitSampleInfo.HIT_CLAP},{HitSampleInfo.HIT_WHISTLE}", HitSampleInfo.BANK_DRUM);
|
||||
|
||||
seekTo(600);
|
||||
AddAssert("most valid object is drum roll tick", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRollTick>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
checkSamples(HitType.Centre, $"{HitSampleInfo.HIT_NORMAL},{HitSampleInfo.HIT_FINISH}", HitSampleInfo.BANK_DRUM);
|
||||
checkSamples(HitType.Rim, $"{HitSampleInfo.HIT_CLAP},{HitSampleInfo.HIT_WHISTLE}", HitSampleInfo.BANK_DRUM);
|
||||
|
||||
seekTo(1200);
|
||||
AddAssert("most valid object is drum roll", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRoll>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
checkSamples(HitType.Centre, $"{HitSampleInfo.HIT_NORMAL},{HitSampleInfo.HIT_FINISH}", HitSampleInfo.BANK_DRUM);
|
||||
checkSamples(HitType.Rim, $"{HitSampleInfo.HIT_CLAP},{HitSampleInfo.HIT_WHISTLE}", HitSampleInfo.BANK_DRUM);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -319,18 +319,18 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
// This works fine in gameplay because they are judged whenever the user pressed, rather than being timed hits.
|
||||
// But for sample playback purposes they can be ignored as noise.
|
||||
AddAssert("most valid object is swell", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Swell>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
|
||||
seekTo(600);
|
||||
AddAssert("most valid object is swell", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Swell>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
|
||||
seekTo(1200);
|
||||
AddAssert("most valid object is swell", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Swell>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -344,7 +344,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
EndTime = 1100,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, "drum")
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_DRUM)
|
||||
}
|
||||
};
|
||||
swell.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||
@ -356,25 +356,26 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
// This works fine in gameplay because they are judged whenever the user pressed, rather than being timed hits.
|
||||
// But for sample playback purposes they can be ignored as noise.
|
||||
AddAssert("most valid object is swell", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Swell>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_DRUM);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_DRUM);
|
||||
|
||||
seekTo(600);
|
||||
AddAssert("most valid object is swell", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Swell>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_DRUM);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_DRUM);
|
||||
|
||||
seekTo(1200);
|
||||
AddAssert("most valid object is swell", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Swell>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
checkSamples(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_DRUM);
|
||||
checkSamples(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_DRUM);
|
||||
}
|
||||
|
||||
private void checkSound(HitType hitType, string expectedName, string expectedBank)
|
||||
private void checkSamples(HitType hitType, string expectedSamplesCsv, string expectedBank)
|
||||
{
|
||||
AddStep($"hit {hitType}", () => triggerSource.Play(hitType));
|
||||
AddAssert($"last played sample is {expectedName}", () => triggerSource.LastPlayedSamples!.OfType<HitSampleInfo>().Single().Name, () => Is.EqualTo(expectedName));
|
||||
AddAssert($"last played sample has {expectedBank} bank", () => triggerSource.LastPlayedSamples!.OfType<HitSampleInfo>().Single().Bank, () => Is.EqualTo(expectedBank));
|
||||
AddAssert($"last played sample is {expectedSamplesCsv}", () => string.Join(',', triggerSource.LastPlayedSamples!.OfType<HitSampleInfo>().Select(s => s.Name)),
|
||||
() => Is.EqualTo(expectedSamplesCsv));
|
||||
AddAssert($"last played sample has {expectedBank} bank", () => triggerSource.LastPlayedSamples!.OfType<HitSampleInfo>().First().Bank, () => Is.EqualTo(expectedBank));
|
||||
}
|
||||
|
||||
private void seekTo(double time) => AddStep($"seek to {time}", () => gameplayClock.Seek(time));
|
||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
|
||||
private void addFlyingHit(HitType hitType)
|
||||
{
|
||||
var tick = new DrumRollTick { HitWindows = HitWindows.Empty, StartTime = DrawableRuleset.Playfield.Time.Current };
|
||||
var tick = new DrumRollTick(new DrumRoll()) { HitWindows = HitWindows.Empty, StartTime = DrawableRuleset.Playfield.Time.Current };
|
||||
|
||||
DrawableDrumRollTick h;
|
||||
DrawableRuleset.Playfield.Add(h = new DrawableDrumRollTick(tick) { JudgementType = hitType });
|
||||
|
@ -3,15 +3,16 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Taiko.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Taiko has some interesting rules for legacy mappings.
|
||||
/// Taiko doesn't output any samples. They are all handled externally by <see cref="DrumSamplePlayer"/>.
|
||||
/// </summary>
|
||||
[HeadlessTest]
|
||||
public partial class TestSceneSampleOutput : TestSceneTaikoPlayer
|
||||
@ -26,10 +27,10 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
HitSampleInfo.HIT_FINISH,
|
||||
HitSampleInfo.HIT_WHISTLE,
|
||||
HitSampleInfo.HIT_WHISTLE,
|
||||
HitSampleInfo.HIT_WHISTLE,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
};
|
||||
|
||||
var actualSampleNames = new List<string>();
|
||||
@ -46,7 +47,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
|
||||
AddUntilStep("all samples collected", () => actualSampleNames.Count == expectedSampleNames.Length);
|
||||
|
||||
AddAssert("samples are correct", () => actualSampleNames.SequenceEqual(expectedSampleNames));
|
||||
AddAssert("samples are correct", () => actualSampleNames, () => Is.EqualTo(expectedSampleNames));
|
||||
}
|
||||
|
||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TaikoBeatmapConversionTest().GetBeatmap("sample-to-type-conversions");
|
||||
|
@ -48,7 +48,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
||||
foreach (var v in base.ToDatabaseAttributes())
|
||||
yield return v;
|
||||
|
||||
yield return (ATTRIB_ID_MAX_COMBO, MaxCombo);
|
||||
yield return (ATTRIB_ID_DIFFICULTY, StarRating);
|
||||
yield return (ATTRIB_ID_GREAT_HIT_WINDOW, GreatHitWindow);
|
||||
}
|
||||
@ -57,7 +56,6 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
||||
{
|
||||
base.FromDatabaseAttributes(values, onlineInfo);
|
||||
|
||||
MaxCombo = (int)values[ATTRIB_ID_MAX_COMBO];
|
||||
StarRating = values[ATTRIB_ID_DIFFICULTY];
|
||||
GreatHitWindow = values[ATTRIB_ID_GREAT_HIT_WINDOW];
|
||||
}
|
||||
|
@ -25,9 +25,12 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
||||
|
||||
public override int Version => 20220902;
|
||||
|
||||
private readonly IWorkingBeatmap workingBeatmap;
|
||||
|
||||
public TaikoDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
|
||||
: base(ruleset, beatmap)
|
||||
{
|
||||
workingBeatmap = beatmap;
|
||||
}
|
||||
|
||||
protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate)
|
||||
@ -84,7 +87,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
||||
HitWindows hitWindows = new TaikoHitWindows();
|
||||
hitWindows.SetDifficulty(beatmap.Difficulty.OverallDifficulty);
|
||||
|
||||
return new TaikoDifficultyAttributes
|
||||
TaikoDifficultyAttributes attributes = new TaikoDifficultyAttributes
|
||||
{
|
||||
StarRating = starRating,
|
||||
Mods = mods,
|
||||
@ -95,6 +98,17 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
||||
GreatHitWindow = hitWindows.WindowFor(HitResult.Great) / clockRate,
|
||||
MaxCombo = beatmap.HitObjects.Count(h => h is Hit),
|
||||
};
|
||||
|
||||
if (ComputeLegacyScoringValues)
|
||||
{
|
||||
TaikoLegacyScoreSimulator sv1Simulator = new TaikoLegacyScoreSimulator();
|
||||
sv1Simulator.Simulate(workingBeatmap, beatmap, mods);
|
||||
attributes.LegacyAccuracyScore = sv1Simulator.AccuracyScore;
|
||||
attributes.LegacyComboScore = sv1Simulator.ComboScore;
|
||||
attributes.LegacyBonusScoreRatio = sv1Simulator.BonusScoreRatio;
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
202
osu.Game.Rulesets.Taiko/Difficulty/TaikoLegacyScoreSimulator.cs
Normal file
202
osu.Game.Rulesets.Taiko/Difficulty/TaikoLegacyScoreSimulator.cs
Normal file
@ -0,0 +1,202 @@
|
||||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Difficulty
|
||||
{
|
||||
internal class TaikoLegacyScoreSimulator : ILegacyScoreSimulator
|
||||
{
|
||||
public int AccuracyScore { get; private set; }
|
||||
|
||||
public int ComboScore { get; private set; }
|
||||
|
||||
public double BonusScoreRatio => legacyBonusScore == 0 ? 0 : (double)modernBonusScore / legacyBonusScore;
|
||||
|
||||
private int legacyBonusScore;
|
||||
private int modernBonusScore;
|
||||
private int combo;
|
||||
|
||||
private double modMultiplier;
|
||||
private int difficultyPeppyStars;
|
||||
private IBeatmap playableBeatmap = null!;
|
||||
private IReadOnlyList<Mod> mods = null!;
|
||||
|
||||
public void Simulate(IWorkingBeatmap workingBeatmap, IBeatmap playableBeatmap, IReadOnlyList<Mod> mods)
|
||||
{
|
||||
this.playableBeatmap = playableBeatmap;
|
||||
this.mods = mods;
|
||||
|
||||
IBeatmap baseBeatmap = workingBeatmap.Beatmap;
|
||||
|
||||
int countNormal = 0;
|
||||
int countSlider = 0;
|
||||
int countSpinner = 0;
|
||||
|
||||
foreach (HitObject obj in baseBeatmap.HitObjects)
|
||||
{
|
||||
switch (obj)
|
||||
{
|
||||
case IHasPath:
|
||||
countSlider++;
|
||||
break;
|
||||
|
||||
case IHasDuration:
|
||||
countSpinner++;
|
||||
break;
|
||||
|
||||
default:
|
||||
countNormal++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int objectCount = countNormal + countSlider + countSpinner;
|
||||
|
||||
int drainLength = 0;
|
||||
|
||||
if (baseBeatmap.HitObjects.Count > 0)
|
||||
{
|
||||
int breakLength = baseBeatmap.Breaks.Select(b => (int)Math.Round(b.EndTime) - (int)Math.Round(b.StartTime)).Sum();
|
||||
drainLength = ((int)Math.Round(baseBeatmap.HitObjects[^1].StartTime) - (int)Math.Round(baseBeatmap.HitObjects[0].StartTime) - breakLength) / 1000;
|
||||
}
|
||||
|
||||
difficultyPeppyStars = (int)Math.Round(
|
||||
(baseBeatmap.Difficulty.DrainRate
|
||||
+ baseBeatmap.Difficulty.OverallDifficulty
|
||||
+ baseBeatmap.Difficulty.CircleSize
|
||||
+ Math.Clamp((float)objectCount / drainLength * 8, 0, 16)) / 38 * 5);
|
||||
|
||||
modMultiplier = mods.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier);
|
||||
|
||||
foreach (var obj in playableBeatmap.HitObjects)
|
||||
simulateHit(obj);
|
||||
}
|
||||
|
||||
private void simulateHit(HitObject hitObject)
|
||||
{
|
||||
bool increaseCombo = true;
|
||||
bool addScoreComboMultiplier = false;
|
||||
|
||||
bool isBonus = false;
|
||||
HitResult bonusResult = HitResult.None;
|
||||
|
||||
int scoreIncrease = 0;
|
||||
|
||||
switch (hitObject)
|
||||
{
|
||||
case SwellTick:
|
||||
scoreIncrease = 300;
|
||||
increaseCombo = false;
|
||||
break;
|
||||
|
||||
case DrumRollTick:
|
||||
scoreIncrease = 300;
|
||||
increaseCombo = false;
|
||||
isBonus = true;
|
||||
bonusResult = HitResult.SmallBonus;
|
||||
break;
|
||||
|
||||
case Swell swell:
|
||||
// The taiko swell generally does not match the osu-stable implementation in any way.
|
||||
// We'll redo the calculations to match osu-stable here...
|
||||
double minimumRotationsPerSecond = IBeatmapDifficultyInfo.DifficultyRange(playableBeatmap.Difficulty.OverallDifficulty, 3, 5, 7.5);
|
||||
double secondsDuration = swell.Duration / 1000;
|
||||
|
||||
// The amount of half spins that are required to successfully complete the spinner (i.e. get a 300).
|
||||
int halfSpinsRequiredForCompletion = (int)(secondsDuration * minimumRotationsPerSecond);
|
||||
|
||||
halfSpinsRequiredForCompletion = (int)Math.Max(1, halfSpinsRequiredForCompletion * 1.65f);
|
||||
|
||||
if (mods.Any(m => m is ModDoubleTime))
|
||||
halfSpinsRequiredForCompletion = Math.Max(1, (int)(halfSpinsRequiredForCompletion * 0.75f));
|
||||
if (mods.Any(m => m is ModHalfTime))
|
||||
halfSpinsRequiredForCompletion = Math.Max(1, (int)(halfSpinsRequiredForCompletion * 1.5f));
|
||||
|
||||
for (int i = 0; i <= halfSpinsRequiredForCompletion; i++)
|
||||
simulateHit(new SwellTick());
|
||||
|
||||
scoreIncrease = 300;
|
||||
addScoreComboMultiplier = true;
|
||||
increaseCombo = false;
|
||||
isBonus = true;
|
||||
bonusResult = HitResult.LargeBonus;
|
||||
break;
|
||||
|
||||
case Hit:
|
||||
scoreIncrease = 300;
|
||||
addScoreComboMultiplier = true;
|
||||
break;
|
||||
|
||||
case DrumRoll:
|
||||
foreach (var nested in hitObject.NestedHitObjects)
|
||||
simulateHit(nested);
|
||||
return;
|
||||
}
|
||||
|
||||
if (hitObject is DrumRollTick tick)
|
||||
{
|
||||
if (playableBeatmap.ControlPointInfo.EffectPointAt(tick.Parent.StartTime).KiaiMode)
|
||||
scoreIncrease = (int)(scoreIncrease * 1.2f);
|
||||
|
||||
if (tick.IsStrong)
|
||||
scoreIncrease += scoreIncrease / 5;
|
||||
}
|
||||
|
||||
// The score increase directly contributed to by the combo-multiplied portion.
|
||||
int comboScoreIncrease = 0;
|
||||
|
||||
if (addScoreComboMultiplier)
|
||||
{
|
||||
int oldScoreIncrease = scoreIncrease;
|
||||
|
||||
// ReSharper disable once PossibleLossOfFraction (intentional to match osu-stable...)
|
||||
scoreIncrease += (int)(scoreIncrease / 35 * 2 * (difficultyPeppyStars + 1) * modMultiplier) * (Math.Min(100, combo) / 10);
|
||||
|
||||
if (hitObject is Swell)
|
||||
{
|
||||
if (playableBeatmap.ControlPointInfo.EffectPointAt(hitObject.GetEndTime()).KiaiMode)
|
||||
scoreIncrease = (int)(scoreIncrease * 1.2f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (playableBeatmap.ControlPointInfo.EffectPointAt(hitObject.StartTime).KiaiMode)
|
||||
scoreIncrease = (int)(scoreIncrease * 1.2f);
|
||||
}
|
||||
|
||||
comboScoreIncrease = scoreIncrease - oldScoreIncrease;
|
||||
}
|
||||
|
||||
if (hitObject is Swell || (hitObject is TaikoStrongableHitObject strongable && strongable.IsStrong))
|
||||
{
|
||||
scoreIncrease *= 2;
|
||||
comboScoreIncrease *= 2;
|
||||
}
|
||||
|
||||
scoreIncrease -= comboScoreIncrease;
|
||||
|
||||
if (addScoreComboMultiplier)
|
||||
ComboScore += comboScoreIncrease;
|
||||
|
||||
if (isBonus)
|
||||
{
|
||||
legacyBonusScore += scoreIncrease;
|
||||
modernBonusScore += Judgement.ToNumericResult(bonusResult);
|
||||
}
|
||||
else
|
||||
AccuracyScore += scoreIncrease;
|
||||
|
||||
if (increaseCombo)
|
||||
combo++;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,14 +4,12 @@
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Skinning.Default;
|
||||
@ -93,40 +91,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
? new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.CentreHit), _ => new CentreHitCirclePiece(), confineMode: ConfineMode.ScaleToFit)
|
||||
: new SkinnableDrawable(new TaikoSkinComponentLookup(TaikoSkinComponents.RimHit), _ => new RimHitCirclePiece(), confineMode: ConfineMode.ScaleToFit);
|
||||
|
||||
public override IEnumerable<HitSampleInfo> GetSamples()
|
||||
{
|
||||
// normal and claps are always handled by the drum (see DrumSampleMapping).
|
||||
// in addition, whistles are excluded as they are an alternative rim marker.
|
||||
|
||||
var samples = HitObject.Samples.Where(s =>
|
||||
s.Name != HitSampleInfo.HIT_NORMAL
|
||||
&& s.Name != HitSampleInfo.HIT_CLAP
|
||||
&& s.Name != HitSampleInfo.HIT_WHISTLE);
|
||||
|
||||
if (HitObject.Type == HitType.Rim && HitObject.IsStrong)
|
||||
{
|
||||
// strong + rim always maps to whistle.
|
||||
// TODO: this should really be in the legacy decoder, but can't be because legacy encoding parity would be broken.
|
||||
// when we add a taiko editor, this is probably not going to play nice.
|
||||
|
||||
var corrected = samples.ToList();
|
||||
|
||||
for (int i = 0; i < corrected.Count; i++)
|
||||
{
|
||||
var s = corrected[i];
|
||||
|
||||
if (s.Name != HitSampleInfo.HIT_FINISH)
|
||||
continue;
|
||||
|
||||
corrected[i] = s.With(HitSampleInfo.HIT_WHISTLE);
|
||||
}
|
||||
|
||||
return corrected;
|
||||
}
|
||||
|
||||
return samples;
|
||||
}
|
||||
|
||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||
{
|
||||
Debug.Assert(HitObject.HitWindows != null);
|
||||
|
@ -119,8 +119,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
public override bool RemoveWhenNotAlive => false;
|
||||
}
|
||||
|
||||
// Most osu!taiko hitsounds are managed by the drum (see DrumSampleTriggerSource).
|
||||
public override IEnumerable<HitSampleInfo> GetSamples() => Enumerable.Empty<HitSampleInfo>();
|
||||
// osu!taiko hitsounds are managed by the drum (see DrumSampleTriggerSource).
|
||||
public sealed override IEnumerable<HitSampleInfo> GetSamples() => Enumerable.Empty<HitSampleInfo>();
|
||||
}
|
||||
|
||||
public abstract partial class DrawableTaikoHitObject<TObject> : DrawableTaikoHitObject
|
||||
|
@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
AddNested(new DrumRollTick
|
||||
AddNested(new DrumRollTick(this)
|
||||
{
|
||||
FirstTick = first,
|
||||
TickSpacing = tickSpacing,
|
||||
|
@ -9,6 +9,8 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
{
|
||||
public class DrumRollTick : TaikoStrongableHitObject
|
||||
{
|
||||
public readonly DrumRoll Parent;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this is the first (initial) tick of the slider.
|
||||
/// </summary>
|
||||
@ -25,6 +27,11 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
/// </summary>
|
||||
public double HitWindow => TickSpacing / 2;
|
||||
|
||||
public DrumRollTick(DrumRoll parent)
|
||||
{
|
||||
Parent = parent;
|
||||
}
|
||||
|
||||
public override Judgement CreateJudgement() => new TaikoDrumRollTickJudgement();
|
||||
|
||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||
|
@ -197,6 +197,8 @@ namespace osu.Game.Rulesets.Taiko
|
||||
|
||||
public int LegacyID => 1;
|
||||
|
||||
public ILegacyScoreSimulator CreateLegacyScoreSimulator() => new TaikoLegacyScoreSimulator();
|
||||
|
||||
public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new TaikoReplayFrame();
|
||||
|
||||
public override IRulesetConfigManager CreateConfig(SettingsStore? settings) => new TaikoRulesetConfigManager(settings, RulesetInfo);
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Rulesets.UI;
|
||||
@ -18,12 +17,25 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
|
||||
public void Play(HitType hitType)
|
||||
{
|
||||
var hitSample = GetMostValidObject()?.Samples?.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL);
|
||||
TaikoHitObject? hitObject = GetMostValidObject() as TaikoHitObject;
|
||||
|
||||
if (hitSample == null)
|
||||
if (hitObject == null)
|
||||
return;
|
||||
|
||||
PlaySamples(new ISampleInfo[] { new HitSampleInfo(hitType == HitType.Rim ? HitSampleInfo.HIT_CLAP : HitSampleInfo.HIT_NORMAL, hitSample.Bank, volume: hitSample.Volume) });
|
||||
var baseSample = hitObject.CreateHitSampleInfo(hitType == HitType.Rim ? HitSampleInfo.HIT_CLAP : HitSampleInfo.HIT_NORMAL);
|
||||
|
||||
if ((hitObject as TaikoStrongableHitObject)?.IsStrong == true || hitObject is StrongNestedHitObject)
|
||||
{
|
||||
PlaySamples(new ISampleInfo[]
|
||||
{
|
||||
baseSample,
|
||||
hitObject.CreateHitSampleInfo(hitType == HitType.Rim ? HitSampleInfo.HIT_WHISTLE : HitSampleInfo.HIT_FINISH)
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySamples(new ISampleInfo[] { baseSample });
|
||||
}
|
||||
}
|
||||
|
||||
public override void Play() => throw new InvalidOperationException(@"Use override with HitType parameter instead");
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Testing;
|
||||
@ -80,7 +81,9 @@ namespace osu.Game.Tests.Gameplay
|
||||
{
|
||||
TestLifetimeEntry entry = null;
|
||||
AddStep("Create entry", () => entry = new TestLifetimeEntry(new HitObject()) { LifetimeStart = 1 });
|
||||
assertJudged(() => entry, false);
|
||||
AddStep("ApplyDefaults", () => entry.HitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()));
|
||||
assertJudged(() => entry, false);
|
||||
AddAssert("Lifetime is updated", () => entry.LifetimeStart == -TestLifetimeEntry.INITIAL_LIFETIME_OFFSET);
|
||||
|
||||
TestDrawableHitObject dho = null;
|
||||
@ -91,6 +94,7 @@ namespace osu.Game.Tests.Gameplay
|
||||
});
|
||||
AddStep("ApplyDefaults", () => entry.HitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()));
|
||||
AddAssert("Lifetime is correct", () => dho.LifetimeStart == TestDrawableHitObject.LIFETIME_ON_APPLY && entry.LifetimeStart == TestDrawableHitObject.LIFETIME_ON_APPLY);
|
||||
assertJudged(() => entry, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -138,6 +142,29 @@ namespace osu.Game.Tests.Gameplay
|
||||
AddAssert("DHO state is correct", () => dho.State.Value == ArmedState.Miss);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestJudgedStateThroughLifetime()
|
||||
{
|
||||
TestDrawableHitObject dho = null;
|
||||
HitObjectLifetimeEntry lifetimeEntry = null;
|
||||
|
||||
AddStep("Create lifetime entry", () => lifetimeEntry = new HitObjectLifetimeEntry(new HitObject { StartTime = Time.Current }));
|
||||
|
||||
assertJudged(() => lifetimeEntry, false);
|
||||
|
||||
AddStep("Create DHO and apply entry", () =>
|
||||
{
|
||||
Child = dho = new TestDrawableHitObject();
|
||||
dho.Apply(lifetimeEntry);
|
||||
});
|
||||
|
||||
assertJudged(() => lifetimeEntry, false);
|
||||
|
||||
AddStep("Apply result", () => dho.MissForcefully());
|
||||
|
||||
assertJudged(() => lifetimeEntry, true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestResultSetBeforeLoadComplete()
|
||||
{
|
||||
@ -154,15 +181,20 @@ namespace osu.Game.Tests.Gameplay
|
||||
}
|
||||
};
|
||||
});
|
||||
assertJudged(() => lifetimeEntry, true);
|
||||
AddStep("Create DHO and apply entry", () =>
|
||||
{
|
||||
dho = new TestDrawableHitObject();
|
||||
dho.Apply(lifetimeEntry);
|
||||
Child = dho;
|
||||
});
|
||||
assertJudged(() => lifetimeEntry, true);
|
||||
AddAssert("DHO state is correct", () => dho.State.Value, () => Is.EqualTo(ArmedState.Hit));
|
||||
}
|
||||
|
||||
private void assertJudged(Func<HitObjectLifetimeEntry> entry, bool val) =>
|
||||
AddAssert(val ? "Is judged" : "Not judged", () => entry().Judged, () => Is.EqualTo(val));
|
||||
|
||||
private partial class TestDrawableHitObject : DrawableHitObject
|
||||
{
|
||||
public const double INITIAL_LIFETIME_OFFSET = 100;
|
||||
|
@ -170,7 +170,16 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
ManualClock clock = null;
|
||||
|
||||
var beatmap = new Beatmap();
|
||||
beatmap.HitObjects.Add(new TestHitObjectWithNested { Duration = 40 });
|
||||
beatmap.HitObjects.Add(new TestHitObjectWithNested
|
||||
{
|
||||
Duration = 40,
|
||||
NestedObjects = new HitObject[]
|
||||
{
|
||||
new PooledNestedHitObject { StartTime = 10 },
|
||||
new PooledNestedHitObject { StartTime = 20 },
|
||||
new PooledNestedHitObject { StartTime = 30 }
|
||||
}
|
||||
});
|
||||
|
||||
createTest(beatmap, 10, () => new FramedClock(clock = new ManualClock()));
|
||||
|
||||
@ -209,6 +218,49 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddAssert("object judged", () => playfield.JudgedObjects.Count == 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPooledObjectWithNonPooledNesteds()
|
||||
{
|
||||
ManualClock clock = null;
|
||||
TestHitObjectWithNested hitObjectWithNested;
|
||||
|
||||
var beatmap = new Beatmap();
|
||||
beatmap.HitObjects.Add(hitObjectWithNested = new TestHitObjectWithNested
|
||||
{
|
||||
Duration = 40,
|
||||
NestedObjects = new HitObject[]
|
||||
{
|
||||
new PooledNestedHitObject { StartTime = 10 },
|
||||
new NonPooledNestedHitObject { StartTime = 20 },
|
||||
new NonPooledNestedHitObject { StartTime = 30 }
|
||||
}
|
||||
});
|
||||
|
||||
createTest(beatmap, 10, () => new FramedClock(clock = new ManualClock()));
|
||||
|
||||
AddAssert("hitobject entry has all nesteds", () => playfield.HitObjectContainer.Entries.Single().NestedEntries, () => Has.Count.EqualTo(3));
|
||||
|
||||
AddStep("skip to middle of object", () => clock.CurrentTime = (hitObjectWithNested.StartTime + hitObjectWithNested.GetEndTime()) / 2);
|
||||
AddAssert("2 objects judged", () => playfield.JudgedObjects.Count, () => Is.EqualTo(2));
|
||||
AddAssert("entry not all judged", () => playfield.HitObjectContainer.Entries.Single().AllJudged, () => Is.False);
|
||||
|
||||
AddStep("skip to before end of object", () => clock.CurrentTime = hitObjectWithNested.GetEndTime() - 1);
|
||||
AddAssert("3 objects judged", () => playfield.JudgedObjects.Count, () => Is.EqualTo(3));
|
||||
AddAssert("entry not all judged", () => playfield.HitObjectContainer.Entries.Single().AllJudged, () => Is.False);
|
||||
|
||||
AddStep("removing object doesn't crash", () => playfield.Remove(hitObjectWithNested));
|
||||
AddStep("clear judged", () => playfield.JudgedObjects.Clear());
|
||||
|
||||
AddStep("add object back", () => playfield.Add(hitObjectWithNested));
|
||||
AddAssert("entry not all judged", () => playfield.HitObjectContainer.Entries.Single().AllJudged, () => Is.False);
|
||||
|
||||
AddStep("skip to long past object", () => clock.CurrentTime = 100_000);
|
||||
// the parent entry should still be linked to nested entries of pooled objects that are managed externally
|
||||
// but not contain synthetic entries that were created for the non-pooled objects.
|
||||
AddAssert("entry still has non-synthetic nested entries", () => playfield.HitObjectContainer.Entries.Single().NestedEntries, () => Has.Count.EqualTo(1));
|
||||
AddAssert("entry all judged", () => playfield.HitObjectContainer.Entries.Single().AllJudged, () => Is.True);
|
||||
}
|
||||
|
||||
private void createTest(IBeatmap beatmap, int poolSize, Func<IFrameBasedClock> createClock = null)
|
||||
{
|
||||
AddStep("create test", () =>
|
||||
@ -289,7 +341,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
RegisterPool<TestHitObject, DrawableTestHitObject>(poolSize);
|
||||
RegisterPool<TestKilledHitObject, DrawableTestKilledHitObject>(poolSize);
|
||||
RegisterPool<TestHitObjectWithNested, DrawableTestHitObjectWithNested>(poolSize);
|
||||
RegisterPool<NestedHitObject, DrawableNestedHitObject>(poolSize);
|
||||
RegisterPool<PooledNestedHitObject, DrawableNestedHitObject>(poolSize);
|
||||
}
|
||||
|
||||
protected override HitObjectLifetimeEntry CreateLifetimeEntry(HitObject hitObject) => new TestHitObjectLifetimeEntry(hitObject);
|
||||
@ -422,16 +474,22 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
private class TestHitObjectWithNested : TestHitObject
|
||||
{
|
||||
public IEnumerable<HitObject> NestedObjects { get; init; } = Array.Empty<HitObject>();
|
||||
|
||||
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
||||
{
|
||||
base.CreateNestedHitObjects(cancellationToken);
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
AddNested(new NestedHitObject { StartTime = (float)Duration * (i + 1) / 4 });
|
||||
foreach (var ho in NestedObjects)
|
||||
AddNested(ho);
|
||||
}
|
||||
}
|
||||
|
||||
private class NestedHitObject : ConvertHitObject
|
||||
private class PooledNestedHitObject : ConvertHitObject
|
||||
{
|
||||
}
|
||||
|
||||
private class NonPooledNestedHitObject : ConvertHitObject
|
||||
{
|
||||
}
|
||||
|
||||
@ -482,6 +540,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
nestedContainer.Clear(false);
|
||||
}
|
||||
|
||||
protected override DrawableHitObject CreateNestedHitObject(HitObject hitObject)
|
||||
=> hitObject is NonPooledNestedHitObject nonPooled ? new DrawableNestedHitObject(nonPooled) : null;
|
||||
|
||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||
{
|
||||
base.CheckForResult(userTriggered, timeOffset);
|
||||
@ -490,25 +551,30 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
}
|
||||
}
|
||||
|
||||
private partial class DrawableNestedHitObject : DrawableHitObject<NestedHitObject>
|
||||
private partial class DrawableNestedHitObject : DrawableHitObject
|
||||
{
|
||||
public DrawableNestedHitObject()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public DrawableNestedHitObject(NestedHitObject hitObject)
|
||||
public DrawableNestedHitObject(PooledNestedHitObject hitObject)
|
||||
: base(hitObject)
|
||||
{
|
||||
}
|
||||
|
||||
public DrawableNestedHitObject(NonPooledNestedHitObject hitObject)
|
||||
: base(hitObject)
|
||||
{
|
||||
Size = new Vector2(15);
|
||||
Colour = Colour4.White;
|
||||
RelativePositionAxes = Axes.Both;
|
||||
Origin = Anchor.Centre;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Size = new Vector2(15);
|
||||
Colour = Colour4.White;
|
||||
RelativePositionAxes = Axes.Both;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
AddInternal(new Circle
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
@ -14,8 +14,11 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Scoring.Legacy;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
namespace osu.Game
|
||||
@ -25,6 +28,9 @@ namespace osu.Game
|
||||
[Resolved]
|
||||
private RulesetStore rulesetStore { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager beatmapManager { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private ScoreManager scoreManager { get; set; } = null!;
|
||||
|
||||
@ -40,19 +46,23 @@ namespace osu.Game
|
||||
[Resolved]
|
||||
private ILocalUserPlayInfo? localUserPlayInfo { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private INotificationOverlay? notificationOverlay { get; set; }
|
||||
|
||||
protected virtual int TimeToSleepDuringGameplay => 30000;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Task.Run(() =>
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
Logger.Log("Beginning background beatmap processing..");
|
||||
checkForOutdatedStarRatings();
|
||||
processBeatmapSetsWithMissingMetrics();
|
||||
processScoresWithMissingStatistics();
|
||||
}).ContinueWith(t =>
|
||||
convertLegacyTotalScoreToStandardised();
|
||||
}, TaskCreationOptions.LongRunning).ContinueWith(t =>
|
||||
{
|
||||
if (t.Exception?.InnerException is ObjectDisposedException)
|
||||
{
|
||||
@ -121,11 +131,7 @@ namespace osu.Game
|
||||
|
||||
foreach (var id in beatmapSetIds)
|
||||
{
|
||||
while (localUserPlayInfo?.IsPlaying.Value == true)
|
||||
{
|
||||
Logger.Log("Background processing sleeping due to active gameplay...");
|
||||
Thread.Sleep(TimeToSleepDuringGameplay);
|
||||
}
|
||||
sleepIfRequired();
|
||||
|
||||
realmAccess.Run(r =>
|
||||
{
|
||||
@ -166,11 +172,7 @@ namespace osu.Game
|
||||
|
||||
foreach (var id in scoreIds)
|
||||
{
|
||||
while (localUserPlayInfo?.IsPlaying.Value == true)
|
||||
{
|
||||
Logger.Log("Background processing sleeping due to active gameplay...");
|
||||
Thread.Sleep(TimeToSleepDuringGameplay);
|
||||
}
|
||||
sleepIfRequired();
|
||||
|
||||
try
|
||||
{
|
||||
@ -187,11 +189,98 @@ namespace osu.Game
|
||||
|
||||
Logger.Log($"Populated maximum statistics for score {id}");
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Log(@$"Failed to populate maximum statistics for {id}: {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void convertLegacyTotalScoreToStandardised()
|
||||
{
|
||||
Logger.Log("Querying for scores that need total score conversion...");
|
||||
|
||||
HashSet<Guid> scoreIds = realmAccess.Run(r => new HashSet<Guid>(r.All<ScoreInfo>().Where(s => s.TotalScoreVersion == 30000002).AsEnumerable().Select(s => s.ID)));
|
||||
|
||||
Logger.Log($"Found {scoreIds.Count} scores which require total score conversion.");
|
||||
|
||||
if (scoreIds.Count == 0)
|
||||
return;
|
||||
|
||||
ProgressNotification notification = new ProgressNotification { State = ProgressNotificationState.Active };
|
||||
|
||||
notificationOverlay?.Post(notification);
|
||||
|
||||
int processedCount = 0;
|
||||
int failedCount = 0;
|
||||
|
||||
foreach (var id in scoreIds)
|
||||
{
|
||||
if (notification.State == ProgressNotificationState.Cancelled)
|
||||
break;
|
||||
|
||||
notification.Text = $"Upgrading scores to new scoring algorithm ({processedCount} of {scoreIds.Count})";
|
||||
notification.Progress = (float)processedCount / scoreIds.Count;
|
||||
|
||||
sleepIfRequired();
|
||||
|
||||
try
|
||||
{
|
||||
var score = scoreManager.Query(s => s.ID == id);
|
||||
long newTotalScore = StandardisedScoreMigrationTools.ConvertFromLegacyTotalScore(score, beatmapManager);
|
||||
|
||||
// Can't use async overload because we're not on the update thread.
|
||||
// ReSharper disable once MethodHasAsyncOverload
|
||||
realmAccess.Write(r =>
|
||||
{
|
||||
ScoreInfo s = r.Find<ScoreInfo>(id);
|
||||
s.TotalScore = newTotalScore;
|
||||
s.TotalScoreVersion = LegacyScoreEncoder.LATEST_VERSION;
|
||||
});
|
||||
|
||||
Logger.Log($"Converted total score for score {id}");
|
||||
++processedCount;
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Log($"Failed to convert total score for {id}: {e}");
|
||||
++failedCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (processedCount == scoreIds.Count)
|
||||
{
|
||||
notification.CompletionText = $"{processedCount} score(s) have been upgraded to the new scoring algorithm";
|
||||
notification.Progress = 1;
|
||||
notification.State = ProgressNotificationState.Completed;
|
||||
}
|
||||
else
|
||||
{
|
||||
notification.Text = $"{processedCount} of {scoreIds.Count} score(s) have been upgraded to the new scoring algorithm.";
|
||||
|
||||
// We may have arrived here due to user cancellation or completion with failures.
|
||||
if (failedCount > 0)
|
||||
notification.Text += $" Check logs for issues with {failedCount} failed upgrades.";
|
||||
|
||||
notification.State = ProgressNotificationState.Cancelled;
|
||||
}
|
||||
}
|
||||
|
||||
private void sleepIfRequired()
|
||||
{
|
||||
while (localUserPlayInfo?.IsPlaying.Value == true)
|
||||
{
|
||||
Logger.Log("Background processing sleeping due to active gameplay...");
|
||||
Thread.Sleep(TimeToSleepDuringGameplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,6 +129,7 @@ namespace osu.Game.Configuration
|
||||
SetDefault(OsuSetting.ShowHealthDisplayWhenCantFail, true);
|
||||
SetDefault(OsuSetting.FadePlayfieldWhenHealthLow, true);
|
||||
SetDefault(OsuSetting.KeyOverlay, false);
|
||||
SetDefault(OsuSetting.ReplaySettingsOverlay, true);
|
||||
SetDefault(OsuSetting.GameplayLeaderboard, true);
|
||||
SetDefault(OsuSetting.AlwaysPlayFirstComboBreak, true);
|
||||
|
||||
@ -382,6 +383,7 @@ namespace osu.Game.Configuration
|
||||
SafeAreaConsiderations,
|
||||
ComboColourNormalisationAmount,
|
||||
ProfileCoverExpanded,
|
||||
EditorLimitedDistanceSnap
|
||||
EditorLimitedDistanceSnap,
|
||||
ReplaySettingsOverlay
|
||||
}
|
||||
}
|
||||
|
@ -78,8 +78,9 @@ namespace osu.Game.Database
|
||||
/// 28 2023-06-08 Added IsLegacyScore to ScoreInfo, parsed from replay files.
|
||||
/// 29 2023-06-12 Run migration of old lazer scores to be best-effort in the new scoring number space. No actual realm changes.
|
||||
/// 30 2023-06-16 Run migration of old lazer scores again. This time with more correct rounding considerations.
|
||||
/// 31 2023-06-26 Add Version and LegacyTotalScore to ScoreInfo, set Version to 30000002 and copy TotalScore into LegacyTotalScore for legacy scores.
|
||||
/// </summary>
|
||||
private const int schema_version = 30;
|
||||
private const int schema_version = 31;
|
||||
|
||||
/// <summary>
|
||||
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
|
||||
@ -966,6 +967,25 @@ namespace osu.Game.Database
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 31:
|
||||
{
|
||||
foreach (var score in migration.NewRealm.All<ScoreInfo>())
|
||||
{
|
||||
if (score.IsLegacyScore && score.Ruleset.IsLegacyRuleset())
|
||||
{
|
||||
// Scores with this version will trigger the score upgrade process in BackgroundBeatmapProcessor.
|
||||
score.TotalScoreVersion = 30000002;
|
||||
|
||||
// Transfer known legacy scores to a permanent storage field for preservation.
|
||||
score.LegacyTotalScore = score.TotalScore;
|
||||
}
|
||||
else
|
||||
score.TotalScoreVersion = LegacyScoreEncoder.LATEST_VERSION;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Logger.Log($"Migration completed in {stopwatch.ElapsedMilliseconds}ms");
|
||||
|
@ -3,8 +3,11 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
@ -185,6 +188,100 @@ namespace osu.Game.Database
|
||||
return (long)Math.Round((1000000 * (accuracyPortion * accuracyScore + (1 - accuracyPortion) * comboScore) + bonusScore) * modMultiplier);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts from <see cref="ScoreInfo.LegacyTotalScore"/> to the new standardised scoring of <see cref="ScoreProcessor"/>.
|
||||
/// </summary>
|
||||
/// <param name="score">The score to convert the total score of.</param>
|
||||
/// <param name="beatmaps">A <see cref="BeatmapManager"/> used for <see cref="WorkingBeatmap"/> lookups.</param>
|
||||
/// <returns>The standardised total score.</returns>
|
||||
public static long ConvertFromLegacyTotalScore(ScoreInfo score, BeatmapManager beatmaps)
|
||||
{
|
||||
if (!score.IsLegacyScore)
|
||||
return score.TotalScore;
|
||||
|
||||
WorkingBeatmap beatmap = beatmaps.GetWorkingBeatmap(score.BeatmapInfo);
|
||||
Ruleset ruleset = score.Ruleset.CreateInstance();
|
||||
|
||||
if (ruleset is not ILegacyRuleset legacyRuleset)
|
||||
return score.TotalScore;
|
||||
|
||||
var playableBeatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo, score.Mods);
|
||||
|
||||
if (playableBeatmap.HitObjects.Count == 0)
|
||||
throw new InvalidOperationException("Beatmap contains no hit objects!");
|
||||
|
||||
ILegacyScoreSimulator sv1Simulator = legacyRuleset.CreateLegacyScoreSimulator();
|
||||
|
||||
sv1Simulator.Simulate(beatmap, playableBeatmap, score.Mods);
|
||||
|
||||
return ConvertFromLegacyTotalScore(score, new DifficultyAttributes
|
||||
{
|
||||
LegacyAccuracyScore = sv1Simulator.AccuracyScore,
|
||||
LegacyComboScore = sv1Simulator.ComboScore,
|
||||
LegacyBonusScoreRatio = sv1Simulator.BonusScoreRatio
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts from <see cref="ScoreInfo.LegacyTotalScore"/> to the new standardised scoring of <see cref="ScoreProcessor"/>.
|
||||
/// </summary>
|
||||
/// <param name="score">The score to convert the total score of.</param>
|
||||
/// <param name="attributes">Difficulty attributes providing the legacy scoring values
|
||||
/// (<see cref="DifficultyAttributes.LegacyAccuracyScore"/>, <see cref="DifficultyAttributes.LegacyComboScore"/>, and <see cref="DifficultyAttributes.LegacyBonusScoreRatio"/>)
|
||||
/// for the beatmap which the score was set on.</param>
|
||||
/// <returns>The standardised total score.</returns>
|
||||
public static long ConvertFromLegacyTotalScore(ScoreInfo score, DifficultyAttributes attributes)
|
||||
{
|
||||
if (!score.IsLegacyScore)
|
||||
return score.TotalScore;
|
||||
|
||||
Debug.Assert(score.LegacyTotalScore != null);
|
||||
|
||||
int maximumLegacyAccuracyScore = attributes.LegacyAccuracyScore;
|
||||
int maximumLegacyComboScore = attributes.LegacyComboScore;
|
||||
double maximumLegacyBonusRatio = attributes.LegacyBonusScoreRatio;
|
||||
double modMultiplier = score.Mods.Select(m => m.ScoreMultiplier).Aggregate(1.0, (c, n) => c * n);
|
||||
|
||||
// The part of total score that doesn't include bonus.
|
||||
int maximumLegacyBaseScore = maximumLegacyAccuracyScore + maximumLegacyComboScore;
|
||||
|
||||
// The combo proportion is calculated as a proportion of maximumLegacyBaseScore.
|
||||
double comboProportion = Math.Min(1, (double)score.LegacyTotalScore / maximumLegacyBaseScore);
|
||||
|
||||
// The bonus proportion makes up the rest of the score that exceeds maximumLegacyBaseScore.
|
||||
double bonusProportion = Math.Max(0, ((long)score.LegacyTotalScore - maximumLegacyBaseScore) * maximumLegacyBonusRatio);
|
||||
|
||||
switch (score.Ruleset.OnlineID)
|
||||
{
|
||||
case 0:
|
||||
return (long)Math.Round((
|
||||
700000 * comboProportion
|
||||
+ 300000 * Math.Pow(score.Accuracy, 10)
|
||||
+ bonusProportion) * modMultiplier);
|
||||
|
||||
case 1:
|
||||
return (long)Math.Round((
|
||||
250000 * comboProportion
|
||||
+ 750000 * Math.Pow(score.Accuracy, 3.6)
|
||||
+ bonusProportion) * modMultiplier);
|
||||
|
||||
case 2:
|
||||
return (long)Math.Round((
|
||||
600000 * comboProportion
|
||||
+ 400000 * score.Accuracy
|
||||
+ bonusProportion) * modMultiplier);
|
||||
|
||||
case 3:
|
||||
return (long)Math.Round((
|
||||
990000 * comboProportion
|
||||
+ 10000 * Math.Pow(score.Accuracy, 2 + 2 * score.Accuracy)
|
||||
+ bonusProportion) * modMultiplier);
|
||||
|
||||
default:
|
||||
return score.TotalScore;
|
||||
}
|
||||
}
|
||||
|
||||
private class FakeHit : HitObject
|
||||
{
|
||||
private readonly Judgement judgement;
|
||||
|
@ -129,6 +129,7 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(InputKey.MouseMiddle, GlobalAction.TogglePauseReplay),
|
||||
new KeyBinding(InputKey.Left, GlobalAction.SeekReplayBackward),
|
||||
new KeyBinding(InputKey.Right, GlobalAction.SeekReplayForward),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.H }, GlobalAction.ToggleReplaySettings),
|
||||
};
|
||||
|
||||
public IEnumerable<KeyBinding> SongSelectKeyBindings => new[]
|
||||
@ -374,5 +375,8 @@ namespace osu.Game.Input.Bindings
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.ExportReplay))]
|
||||
ExportReplay,
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.ToggleReplaySettings))]
|
||||
ToggleReplaySettings,
|
||||
}
|
||||
}
|
||||
|
@ -65,10 +65,15 @@ namespace osu.Game.Localisation
|
||||
public static LocalisableString HUDVisibilityMode => new TranslatableString(getKey(@"hud_visibility_mode"), @"HUD overlay visibility mode");
|
||||
|
||||
/// <summary>
|
||||
/// "Show health display even when you can't fail"
|
||||
/// "Show health display even when you can't fail"
|
||||
/// </summary>
|
||||
public static LocalisableString ShowHealthDisplayWhenCantFail => new TranslatableString(getKey(@"show_health_display_when_cant_fail"), @"Show health display even when you can't fail");
|
||||
|
||||
/// <summary>
|
||||
/// "Show replay settings overlay"
|
||||
/// </summary>
|
||||
public static LocalisableString ShowReplaySettingsOverlay => new TranslatableString(getKey(@"show_replay_settings_overlay"), @"Show replay settings overlay");
|
||||
|
||||
/// <summary>
|
||||
/// "Fade playfield to red when health is low"
|
||||
/// </summary>
|
||||
@ -134,6 +139,6 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString ClassicScoreDisplay => new TranslatableString(getKey(@"classic_score_display"), @"Classic");
|
||||
|
||||
private static string getKey(string key) => $"{prefix}:{key}";
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
||||
|
@ -324,6 +324,11 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString ToggleChatFocus => new TranslatableString(getKey(@"toggle_chat_focus"), @"Toggle chat focus");
|
||||
|
||||
/// <summary>
|
||||
/// "Toggle replay settings"
|
||||
/// </summary>
|
||||
public static LocalisableString ToggleReplaySettings => new TranslatableString(getKey(@"toggle_replay_settings"), @"Toggle replay settings");
|
||||
|
||||
/// <summary>
|
||||
/// "Save replay"
|
||||
/// </summary>
|
||||
|
@ -44,6 +44,6 @@ namespace osu.Game.Overlays
|
||||
/// <summary>
|
||||
/// All ongoing operations (ie. any <see cref="ProgressNotification"/> not in a completed state).
|
||||
/// </summary>
|
||||
public IEnumerable<ProgressNotification> OngoingOperations => AllNotifications.OfType<ProgressNotification>().Where(p => p.State != ProgressNotificationState.Completed);
|
||||
public IEnumerable<ProgressNotification> OngoingOperations => AllNotifications.OfType<ProgressNotification>().Where(p => p.State != ProgressNotificationState.Completed && p.State != ProgressNotificationState.Cancelled);
|
||||
}
|
||||
}
|
||||
|
@ -25,10 +25,9 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
ClassicDefault = false,
|
||||
LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail,
|
||||
Current = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
|
||||
Keywords = new[] { "hp", "bar" }
|
||||
LabelText = GameplaySettingsStrings.ShowReplaySettingsOverlay,
|
||||
Current = config.GetBindable<bool>(OsuSetting.ReplaySettingsOverlay),
|
||||
Keywords = new[] { "hide" },
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
@ -41,6 +40,13 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||
LabelText = GameplaySettingsStrings.AlwaysShowGameplayLeaderboard,
|
||||
Current = config.GetBindable<bool>(OsuSetting.GameplayLeaderboard),
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
ClassicDefault = false,
|
||||
LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail,
|
||||
Current = config.GetBindable<bool>(OsuSetting.ShowHealthDisplayWhenCantFail),
|
||||
Keywords = new[] { "hp", "bar" }
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Difficulty
|
||||
{
|
||||
@ -27,6 +27,9 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
protected const int ATTRIB_ID_FLASHLIGHT = 17;
|
||||
protected const int ATTRIB_ID_SLIDER_FACTOR = 19;
|
||||
protected const int ATTRIB_ID_SPEED_NOTE_COUNT = 21;
|
||||
protected const int ATTRIB_ID_LEGACY_ACCURACY_SCORE = 23;
|
||||
protected const int ATTRIB_ID_LEGACY_COMBO_SCORE = 25;
|
||||
protected const int ATTRIB_ID_LEGACY_BONUS_SCORE_RATIO = 27;
|
||||
|
||||
/// <summary>
|
||||
/// The mods which were applied to the beatmap.
|
||||
@ -45,6 +48,22 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
[JsonProperty("max_combo", Order = -2)]
|
||||
public int MaxCombo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The accuracy portion of the legacy (ScoreV1) total score.
|
||||
/// </summary>
|
||||
public int LegacyAccuracyScore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The combo-multiplied portion of the legacy (ScoreV1) total score.
|
||||
/// </summary>
|
||||
public int LegacyComboScore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
public double LegacyBonusScoreRatio { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates new <see cref="DifficultyAttributes"/>.
|
||||
/// </summary>
|
||||
@ -69,7 +88,13 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
/// <remarks>
|
||||
/// See: osu_difficulty_attribs table.
|
||||
/// </remarks>
|
||||
public virtual IEnumerable<(int attributeId, object value)> ToDatabaseAttributes() => Enumerable.Empty<(int, object)>();
|
||||
public virtual IEnumerable<(int attributeId, object value)> ToDatabaseAttributes()
|
||||
{
|
||||
yield return (ATTRIB_ID_MAX_COMBO, MaxCombo);
|
||||
yield return (ATTRIB_ID_LEGACY_ACCURACY_SCORE, LegacyAccuracyScore);
|
||||
yield return (ATTRIB_ID_LEGACY_COMBO_SCORE, LegacyComboScore);
|
||||
yield return (ATTRIB_ID_LEGACY_BONUS_SCORE_RATIO, LegacyBonusScoreRatio);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads osu-web database attribute mappings into this <see cref="DifficultyAttributes"/> object.
|
||||
@ -78,6 +103,10 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
/// <param name="onlineInfo">The <see cref="IBeatmapOnlineInfo"/> where more information about the beatmap may be extracted from (such as AR/CS/OD/etc).</param>
|
||||
public virtual void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values, IBeatmapOnlineInfo onlineInfo)
|
||||
{
|
||||
MaxCombo = (int)values[ATTRIB_ID_MAX_COMBO];
|
||||
LegacyAccuracyScore = (int)values[ATTRIB_ID_LEGACY_ACCURACY_SCORE];
|
||||
LegacyComboScore = (int)values[ATTRIB_ID_LEGACY_COMBO_SCORE];
|
||||
LegacyBonusScoreRatio = (int)values[ATTRIB_ID_LEGACY_BONUS_SCORE_RATIO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,13 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
{
|
||||
public abstract class DifficultyCalculator
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether legacy scoring values (ScoreV1) should be computed to populate the difficulty attributes
|
||||
/// <see cref="DifficultyAttributes.LegacyAccuracyScore"/>, <see cref="DifficultyAttributes.LegacyComboScore"/>,
|
||||
/// and <see cref="DifficultyAttributes.LegacyBonusScoreRatio"/>.
|
||||
/// </summary>
|
||||
public bool ComputeLegacyScoringValues;
|
||||
|
||||
/// <summary>
|
||||
/// The beatmap for which difficulty will be calculated.
|
||||
/// </summary>
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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 osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets
|
||||
{
|
||||
public interface ILegacyRuleset
|
||||
@ -11,5 +13,7 @@ namespace osu.Game.Rulesets
|
||||
/// Identifies the server-side ID of a legacy ruleset.
|
||||
/// </summary>
|
||||
int LegacyID { get; }
|
||||
|
||||
ILegacyScoreSimulator CreateLegacyScoreSimulator();
|
||||
}
|
||||
}
|
||||
|
@ -98,9 +98,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
public virtual bool DisplayResult => true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this <see cref="DrawableHitObject"/> and all of its nested <see cref="DrawableHitObject"/>s have been judged.
|
||||
/// The scoring result of this <see cref="DrawableHitObject"/>.
|
||||
/// </summary>
|
||||
public bool AllJudged => Judged && NestedHitObjects.All(h => h.AllJudged);
|
||||
public JudgementResult Result => Entry?.Result;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this <see cref="DrawableHitObject"/> has been hit. This occurs if <see cref="Result"/> is hit.
|
||||
@ -112,12 +112,12 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
/// Whether this <see cref="DrawableHitObject"/> has been judged.
|
||||
/// Note: This does NOT include nested hitobjects.
|
||||
/// </summary>
|
||||
public bool Judged => Result?.HasResult ?? true;
|
||||
public bool Judged => Entry?.Judged ?? false;
|
||||
|
||||
/// <summary>
|
||||
/// The scoring result of this <see cref="DrawableHitObject"/>.
|
||||
/// Whether this <see cref="DrawableHitObject"/> and all of its nested <see cref="DrawableHitObject"/>s have been judged.
|
||||
/// </summary>
|
||||
public JudgementResult Result => Entry?.Result;
|
||||
public bool AllJudged => Entry?.AllJudged ?? false;
|
||||
|
||||
/// <summary>
|
||||
/// The relative X position of this hit object for sample playback balance adjustment.
|
||||
@ -218,6 +218,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
|
||||
protected sealed override void OnApply(HitObjectLifetimeEntry entry)
|
||||
{
|
||||
Debug.Assert(Entry != null);
|
||||
|
||||
// LifetimeStart is already computed using HitObjectLifetimeEntry's InitialLifetimeOffset.
|
||||
// We override this with DHO's InitialLifetimeOffset for a non-pooled DHO.
|
||||
if (entry is SyntheticHitObjectEntry)
|
||||
@ -247,6 +249,12 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
drawableNested.ParentHitObject = this;
|
||||
|
||||
nestedHitObjects.Add(drawableNested);
|
||||
|
||||
// assume that synthetic entries are not pooled and therefore need to be managed from within the DHO.
|
||||
// this is important for the correctness of value of flags such as `AllJudged`.
|
||||
if (drawableNested.Entry is SyntheticHitObjectEntry syntheticNestedEntry)
|
||||
Entry.NestedEntries.Add(syntheticNestedEntry);
|
||||
|
||||
AddNestedHitObject(drawableNested);
|
||||
}
|
||||
|
||||
@ -290,6 +298,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
|
||||
protected sealed override void OnFree(HitObjectLifetimeEntry entry)
|
||||
{
|
||||
Debug.Assert(Entry != null);
|
||||
|
||||
StartTimeBindable.UnbindFrom(HitObject.StartTimeBindable);
|
||||
|
||||
if (HitObject is IHasComboInformation combo)
|
||||
@ -318,6 +328,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
}
|
||||
|
||||
nestedHitObjects.Clear();
|
||||
// clean up synthetic entries manually added in `Apply()`.
|
||||
Entry.NestedEntries.RemoveAll(nestedEntry => nestedEntry is SyntheticHitObjectEntry);
|
||||
ClearNestedHitObjects();
|
||||
|
||||
HitObject.DefaultsApplied -= onDefaultsApplied;
|
||||
|
@ -2,6 +2,8 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Performance;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
@ -19,12 +21,28 @@ namespace osu.Game.Rulesets.Objects
|
||||
/// </summary>
|
||||
public readonly HitObject HitObject;
|
||||
|
||||
/// <summary>
|
||||
/// The list of <see cref="HitObjectLifetimeEntry"/> for the <see cref="HitObject"/>'s nested objects (if any).
|
||||
/// </summary>
|
||||
public List<HitObjectLifetimeEntry> NestedEntries { get; internal set; } = new List<HitObjectLifetimeEntry>();
|
||||
|
||||
/// <summary>
|
||||
/// The result that <see cref="HitObject"/> was judged with.
|
||||
/// This is set by the accompanying <see cref="DrawableHitObject"/>, and reused when required for rewinding.
|
||||
/// </summary>
|
||||
internal JudgementResult? Result;
|
||||
|
||||
/// <summary>
|
||||
/// Whether <see cref="HitObject"/> has been judged.
|
||||
/// Note: This does NOT include nested hitobjects.
|
||||
/// </summary>
|
||||
public bool Judged => Result?.HasResult ?? false;
|
||||
|
||||
/// <summary>
|
||||
/// Whether <see cref="HitObject"/> and all of its nested objects have been judged.
|
||||
/// </summary>
|
||||
public bool AllJudged => Judged && NestedEntries.All(h => h.AllJudged);
|
||||
|
||||
private readonly IBindable<double> startTimeBindable = new BindableDouble();
|
||||
|
||||
internal event Action? RevertResult;
|
||||
|
@ -43,11 +43,6 @@ namespace osu.Game.Rulesets.Objects.Pooling
|
||||
/// </remarks>
|
||||
private readonly Dictionary<HitObjectLifetimeEntry, HitObject> parentMap = new Dictionary<HitObjectLifetimeEntry, HitObject>();
|
||||
|
||||
/// <summary>
|
||||
/// Stores the list of child entries for each hit object managed by this <see cref="HitObjectEntryManager"/>.
|
||||
/// </summary>
|
||||
private readonly Dictionary<HitObject, List<HitObjectLifetimeEntry>> childrenMap = new Dictionary<HitObject, List<HitObjectLifetimeEntry>>();
|
||||
|
||||
public void Add(HitObjectLifetimeEntry entry, HitObject? parent)
|
||||
{
|
||||
HitObject hitObject = entry.HitObject;
|
||||
@ -57,22 +52,24 @@ namespace osu.Game.Rulesets.Objects.Pooling
|
||||
|
||||
// Add the entry.
|
||||
entryMap[hitObject] = entry;
|
||||
childrenMap[hitObject] = new List<HitObjectLifetimeEntry>();
|
||||
|
||||
// If the entry has a parent, set it and add the entry to the parent's children.
|
||||
if (parent != null)
|
||||
{
|
||||
parentMap[entry] = parent;
|
||||
if (childrenMap.TryGetValue(parent, out var parentChildEntries))
|
||||
parentChildEntries.Add(entry);
|
||||
if (entryMap.TryGetValue(parent, out var parentEntry))
|
||||
parentEntry.NestedEntries.Add(entry);
|
||||
}
|
||||
|
||||
hitObject.DefaultsApplied += onDefaultsApplied;
|
||||
OnEntryAdded?.Invoke(entry, parent);
|
||||
}
|
||||
|
||||
public void Remove(HitObjectLifetimeEntry entry)
|
||||
public bool Remove(HitObjectLifetimeEntry entry)
|
||||
{
|
||||
if (entry is SyntheticHitObjectEntry)
|
||||
return false;
|
||||
|
||||
HitObject hitObject = entry.HitObject;
|
||||
|
||||
if (!entryMap.ContainsKey(hitObject))
|
||||
@ -81,18 +78,16 @@ namespace osu.Game.Rulesets.Objects.Pooling
|
||||
entryMap.Remove(hitObject);
|
||||
|
||||
// If the entry has a parent, unset it and remove the entry from the parents' children.
|
||||
if (parentMap.Remove(entry, out var parent) && childrenMap.TryGetValue(parent, out var parentChildEntries))
|
||||
parentChildEntries.Remove(entry);
|
||||
if (parentMap.Remove(entry, out var parent) && entryMap.TryGetValue(parent, out var parentEntry))
|
||||
parentEntry.NestedEntries.Remove(entry);
|
||||
|
||||
// Remove all the entries' children.
|
||||
if (childrenMap.Remove(hitObject, out var childEntries))
|
||||
{
|
||||
foreach (var childEntry in childEntries)
|
||||
Remove(childEntry);
|
||||
}
|
||||
foreach (var childEntry in entry.NestedEntries)
|
||||
Remove(childEntry);
|
||||
|
||||
hitObject.DefaultsApplied -= onDefaultsApplied;
|
||||
OnEntryRemoved?.Invoke(entry, parent);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryGet(HitObject hitObject, [MaybeNullWhen(false)] out HitObjectLifetimeEntry entry)
|
||||
@ -105,16 +100,16 @@ namespace osu.Game.Rulesets.Objects.Pooling
|
||||
/// </summary>
|
||||
private void onDefaultsApplied(HitObject hitObject)
|
||||
{
|
||||
if (!childrenMap.Remove(hitObject, out var childEntries))
|
||||
if (!entryMap.TryGetValue(hitObject, out var entry))
|
||||
return;
|
||||
|
||||
// Remove all the entries' children. At this point the parents' (this entries') children list has been removed from the map, so this does not cause upwards traversal.
|
||||
foreach (var entry in childEntries)
|
||||
Remove(entry);
|
||||
// Replace the entire list rather than clearing to prevent circular traversal later.
|
||||
var previousEntries = entry.NestedEntries;
|
||||
entry.NestedEntries = new List<HitObjectLifetimeEntry>();
|
||||
|
||||
// The removed children list needs to be added back to the map for the entry to potentially receive children.
|
||||
childEntries.Clear();
|
||||
childrenMap[hitObject] = childEntries;
|
||||
// Remove all the entries' children. At this point the parents' (this entries') children list has been reconstructed, so this does not cause upwards traversal.
|
||||
foreach (var nested in previousEntries)
|
||||
Remove(nested);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
40
osu.Game/Rulesets/Scoring/ILegacyScoreSimulator.cs
Normal file
40
osu.Game/Rulesets/Scoring/ILegacyScoreSimulator.cs
Normal file
@ -0,0 +1,40 @@
|
||||
// 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 osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Scoring
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates attributes which are required to calculate old-style Score V1 scores.
|
||||
/// </summary>
|
||||
public interface ILegacyScoreSimulator
|
||||
{
|
||||
/// <summary>
|
||||
/// The accuracy portion of the legacy (ScoreV1) total score.
|
||||
/// </summary>
|
||||
int AccuracyScore { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The combo-multiplied portion of the legacy (ScoreV1) total score.
|
||||
/// </summary>
|
||||
int ComboScore { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
double BonusScoreRatio { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Performs the simulation, computing the maximum <see cref="AccuracyScore"/>, <see cref="ComboScore"/>,
|
||||
/// and <see cref="BonusScoreRatio"/> achievable for the given beatmap.
|
||||
/// </summary>
|
||||
/// <param name="workingBeatmap">The working beatmap.</param>
|
||||
/// <param name="playableBeatmap">A playable version of the beatmap for the ruleset.</param>
|
||||
/// <param name="mods">The applied mods.</param>
|
||||
void Simulate(IWorkingBeatmap workingBeatmap, IBeatmap playableBeatmap, IReadOnlyList<Mod> mods);
|
||||
}
|
||||
}
|
@ -28,10 +28,11 @@ namespace osu.Game.Scoring.Legacy
|
||||
/// <remarks>
|
||||
/// <list type="bullet">
|
||||
/// <item><description>30000001: Appends <see cref="LegacyReplaySoloScoreInfo"/> to the end of scores.</description></item>
|
||||
/// <item><description>30000002: Score stored to replay calculated using the Score V2 algorithm.</description></item>
|
||||
/// <item><description>30000002: Score stored to replay calculated using the Score V2 algorithm. Legacy scores on this version are candidate to Score V1 -> V2 conversion.</description></item>
|
||||
/// <item><description>30000003: First version after converting legacy total score to standardised.</description></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public const int LATEST_VERSION = 30000002;
|
||||
public const int LATEST_VERSION = 30000003;
|
||||
|
||||
/// <summary>
|
||||
/// The first stable-compatible YYYYMMDD format version given to lazer usage of replays.
|
||||
|
@ -14,13 +14,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
=> getDisplayScore(scoreProcessor.Ruleset.RulesetInfo.OnlineID, scoreProcessor.TotalScore.Value, mode, scoreProcessor.MaximumStatistics);
|
||||
|
||||
public static long GetDisplayScore(this ScoreInfo scoreInfo, ScoringMode mode)
|
||||
{
|
||||
// Temporary to not scale stable scores that are already in the XX-millions with the classic scoring mode.
|
||||
if (scoreInfo.IsLegacyScore)
|
||||
return scoreInfo.TotalScore;
|
||||
|
||||
return getDisplayScore(scoreInfo.Ruleset.OnlineID, scoreInfo.TotalScore, mode, scoreInfo.MaximumStatistics);
|
||||
}
|
||||
=> getDisplayScore(scoreInfo.Ruleset.OnlineID, scoreInfo.TotalScore, mode, scoreInfo.MaximumStatistics);
|
||||
|
||||
private static long getDisplayScore(int rulesetId, long score, ScoringMode mode, IReadOnlyDictionary<HitResult, int> maximumStatistics)
|
||||
{
|
||||
|
@ -90,6 +90,11 @@ namespace osu.Game.Scoring
|
||||
// this requires: max combo, statistics, max statistics (where available), and mods to already be populated on the score.
|
||||
if (StandardisedScoreMigrationTools.ShouldMigrateToNewStandardised(model))
|
||||
model.TotalScore = StandardisedScoreMigrationTools.GetNewStandardised(model);
|
||||
else if (model.IsLegacyScore)
|
||||
{
|
||||
model.LegacyTotalScore = model.TotalScore;
|
||||
model.TotalScore = StandardisedScoreMigrationTools.ConvertFromLegacyTotalScore(model, beatmaps());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -15,6 +15,7 @@ using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring.Legacy;
|
||||
using osu.Game.Users;
|
||||
using osu.Game.Utils;
|
||||
using Realms;
|
||||
@ -60,6 +61,26 @@ namespace osu.Game.Scoring
|
||||
|
||||
public long TotalScore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The version of processing applied to calculate total score as stored in the database.
|
||||
/// If this does not match <see cref="LegacyScoreEncoder.LATEST_VERSION"/>,
|
||||
/// the total score has not yet been updated to reflect the current scoring values.
|
||||
///
|
||||
/// See <see cref="BackgroundBeatmapProcessor"/>'s conversion logic.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This may not match the version stored in the replay files.
|
||||
/// </remarks>
|
||||
public int TotalScoreVersion { get; set; } = LegacyScoreEncoder.LATEST_VERSION;
|
||||
|
||||
/// <summary>
|
||||
/// Used to preserve the total score for legacy scores.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Not populated if <see cref="IsLegacyScore"/> is <c>false</c>.
|
||||
/// </remarks>
|
||||
public long? LegacyTotalScore { get; set; }
|
||||
|
||||
public int MaxCombo { get; set; }
|
||||
|
||||
public double Accuracy { get; set; }
|
||||
|
@ -3,10 +3,8 @@
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Events;
|
||||
using osuTK;
|
||||
using osu.Game.Screens.Play.PlayerSettings;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
@ -14,16 +12,12 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
private const int fade_duration = 200;
|
||||
|
||||
public bool ReplayLoaded;
|
||||
|
||||
public readonly PlaybackSettings PlaybackSettings;
|
||||
|
||||
public readonly VisualSettings VisualSettings;
|
||||
|
||||
public PlayerSettingsOverlay()
|
||||
{
|
||||
AlwaysPresent = true;
|
||||
|
||||
Anchor = Anchor.TopRight;
|
||||
Origin = Anchor.TopRight;
|
||||
AutoSizeAxes = Axes.Both;
|
||||
@ -37,8 +31,6 @@ namespace osu.Game.Screens.Play.HUD
|
||||
Spacing = new Vector2(0, 20),
|
||||
Children = new PlayerSettingsGroup[]
|
||||
{
|
||||
//CollectionSettings = new CollectionSettings(),
|
||||
//DiscussionSettings = new DiscussionSettings(),
|
||||
PlaybackSettings = new PlaybackSettings { Expanded = { Value = false } },
|
||||
VisualSettings = new VisualSettings { Expanded = { Value = false } },
|
||||
new AudioSettings { Expanded = { Value = false } }
|
||||
@ -48,24 +40,5 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
protected override void PopIn() => this.FadeIn(fade_duration);
|
||||
protected override void PopOut() => this.FadeOut(fade_duration);
|
||||
|
||||
// We want to handle keyboard inputs all the time in order to trigger ToggleVisibility() when not visible
|
||||
public override bool PropagateNonPositionalInputSubTree => true;
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
if (e.Repeat) return false;
|
||||
|
||||
if (e.ControlPressed)
|
||||
{
|
||||
if (e.Key == Key.H && ReplayLoaded)
|
||||
{
|
||||
ToggleVisibility();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnKeyDown(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ namespace osu.Game.Screens.Play
|
||||
public Bindable<bool> ShowHud { get; } = new BindableBool();
|
||||
|
||||
private Bindable<HUDVisibilityMode> configVisibilityMode;
|
||||
private Bindable<bool> configSettingsOverlay;
|
||||
|
||||
private readonly BindableBool replayLoaded = new BindableBool();
|
||||
|
||||
@ -178,6 +179,7 @@ namespace osu.Game.Screens.Play
|
||||
ModDisplay.Current.Value = mods;
|
||||
|
||||
configVisibilityMode = config.GetBindable<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode);
|
||||
configSettingsOverlay = config.GetBindable<bool>(OsuSetting.ReplaySettingsOverlay);
|
||||
|
||||
if (configVisibilityMode.Value == HUDVisibilityMode.Never && !hasShownNotificationOnce)
|
||||
{
|
||||
@ -204,9 +206,24 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
holdingForHUD.BindValueChanged(_ => updateVisibility());
|
||||
IsPlaying.BindValueChanged(_ => updateVisibility());
|
||||
configVisibilityMode.BindValueChanged(_ => updateVisibility(), true);
|
||||
configVisibilityMode.BindValueChanged(_ => updateVisibility());
|
||||
configSettingsOverlay.BindValueChanged(_ => updateVisibility());
|
||||
|
||||
replayLoaded.BindValueChanged(replayLoadedValueChanged, true);
|
||||
replayLoaded.BindValueChanged(e =>
|
||||
{
|
||||
if (e.NewValue)
|
||||
{
|
||||
ModDisplay.FadeIn(200);
|
||||
InputCountController.Margin = new MarginPadding(10) { Bottom = 30 };
|
||||
}
|
||||
else
|
||||
{
|
||||
ModDisplay.Delay(2000).FadeOut(200);
|
||||
InputCountController.Margin = new MarginPadding(10);
|
||||
}
|
||||
|
||||
updateVisibility();
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
@ -280,6 +297,11 @@ namespace osu.Game.Screens.Play
|
||||
return;
|
||||
}
|
||||
|
||||
if (configSettingsOverlay.Value && replayLoaded.Value)
|
||||
PlayerSettingsOverlay.Show();
|
||||
else
|
||||
PlayerSettingsOverlay.Hide();
|
||||
|
||||
switch (configVisibilityMode.Value)
|
||||
{
|
||||
case HUDVisibilityMode.Never:
|
||||
@ -297,26 +319,6 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
|
||||
private void replayLoadedValueChanged(ValueChangedEvent<bool> e)
|
||||
{
|
||||
PlayerSettingsOverlay.ReplayLoaded = e.NewValue;
|
||||
|
||||
if (e.NewValue)
|
||||
{
|
||||
PlayerSettingsOverlay.Show();
|
||||
ModDisplay.FadeIn(200);
|
||||
InputCountController.Margin = new MarginPadding(10) { Bottom = 30 };
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerSettingsOverlay.Hide();
|
||||
ModDisplay.Delay(2000).FadeOut(200);
|
||||
InputCountController.Margin = new MarginPadding(10);
|
||||
}
|
||||
|
||||
updateVisibility();
|
||||
}
|
||||
|
||||
protected virtual void BindDrawableRuleset(DrawableRuleset drawableRuleset)
|
||||
{
|
||||
if (drawableRuleset is ICanAttachHUDPieces attachTarget)
|
||||
@ -354,6 +356,10 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
switch (e.Action)
|
||||
{
|
||||
case GlobalAction.ToggleReplaySettings:
|
||||
configSettingsOverlay.Value = !configSettingsOverlay.Value;
|
||||
return true;
|
||||
|
||||
case GlobalAction.HoldForHUD:
|
||||
holdingForHUD.Value = true;
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user