mirror of
https://github.com/ppy/osu.git
synced 2026-06-02 04:40:03 +08:00
45234b5b72
- Part of https://github.com/ppy/osu/issues/37818 Access to difficulty info is required for the upcoming multiplier proposals. All places providing difficulty info intentionally use `IBeatmapInfo` as the difficulty info exposed to the calculator should _always_ be pre-mods for our usecase. There's a couple of quirks: - The usage in `ScoreProcessor` is a bit troubling to me but I can't see a way to make it better without refactoring it. Essentially, we don't have a beatmap until `ApplyBeatmap` is called, but most usages of `ScoreProcessor` are setting `Mods` prior to `ApplyBeatmap` so there is a `null` check in the logic for when mods change. Additionally, this means a new bindable of the beatmap via `ApplyBeatmap` which also feels a bit dirty. Open to suggestions. - ~~`BeatmapLeaderboardScore.Tooltip` is using a null-forgiving on the `BeatmapInfo`, but there's basically no context available on if this is an issue - the only code path which sets the score is `SetContent` which has no callers, so it's essentially dead code. Makes sense given it's Select V1.~~ --------- Co-authored-by: Bartłomiej Dach <dach.bartlomiej@gmail.com>
78 lines
2.9 KiB
C#
78 lines
2.9 KiB
C#
// 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 NUnit.Framework;
|
|
using osu.Framework.Utils;
|
|
using osu.Game.Beatmaps;
|
|
using osu.Game.Rulesets.Mania.Mods;
|
|
using osu.Game.Rulesets.Mania.Objects;
|
|
using osu.Game.Rulesets.Mania.Replays;
|
|
using osu.Game.Rulesets.Mania.Scoring;
|
|
using osu.Game.Rulesets.Objects;
|
|
using osu.Game.Rulesets.Replays;
|
|
using osu.Game.Rulesets.Scoring;
|
|
using osu.Game.Tests.Visual;
|
|
|
|
namespace osu.Game.Rulesets.Mania.Tests.Mods
|
|
{
|
|
public partial class TestSceneManiaModDoubleTime : ModTestScene
|
|
{
|
|
private const double offset = 18;
|
|
|
|
protected override bool AllowFail => true;
|
|
|
|
protected override Ruleset CreatePlayerRuleset() => new ManiaRuleset();
|
|
|
|
[Test]
|
|
public void TestHitWindowWithoutDoubleTime() => CreateModTest(new ModTestData
|
|
{
|
|
PassCondition = () => Player.ScoreProcessor.JudgedHits > 0
|
|
&& Precision.AlmostEquals(Player.ScoreProcessor.Accuracy.Value, 0.9836, 0.01)
|
|
&& Player.ScoreProcessor.TotalScore.Value == 946_049,
|
|
Autoplay = false,
|
|
CreateBeatmap = () => new Beatmap
|
|
{
|
|
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo },
|
|
Difficulty = { OverallDifficulty = 10 },
|
|
HitObjects = new List<HitObject>
|
|
{
|
|
new Note { StartTime = 1000 }
|
|
},
|
|
},
|
|
ReplayFrames = new List<ReplayFrame>
|
|
{
|
|
new ManiaReplayFrame(1000 + offset, ManiaAction.Key1)
|
|
}
|
|
});
|
|
|
|
[Test]
|
|
public void TestHitWindowWithDoubleTime()
|
|
{
|
|
var doubleTime = new ManiaModDoubleTime();
|
|
|
|
CreateModTest(new ModTestData
|
|
{
|
|
Mod = doubleTime,
|
|
PassCondition = () => Player.ScoreProcessor.JudgedHits > 0
|
|
&& Player.ScoreProcessor.Accuracy.Value == 1
|
|
&& Player.ScoreProcessor.TotalScore.Value == (long)(1_000_000 * new ManiaScoreMultiplierCalculator(new ScoreMultiplierContext(new BeatmapDifficulty())).CalculateFor([doubleTime])),
|
|
Autoplay = false,
|
|
CreateBeatmap = () => new Beatmap
|
|
{
|
|
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo },
|
|
Difficulty = { OverallDifficulty = 10 },
|
|
HitObjects = new List<HitObject>
|
|
{
|
|
new Note { StartTime = 1000 }
|
|
},
|
|
},
|
|
ReplayFrames = new List<ReplayFrame>
|
|
{
|
|
new ManiaReplayFrame(1000 + offset, ManiaAction.Key1)
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|