1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:17:26 +08:00

Fix remaining use cases

This commit is contained in:
Andrei Zavatski 2024-02-10 14:16:45 +03:00
parent c500264306
commit 5fa54c8c63
8 changed files with 19 additions and 22 deletions

View File

@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.EmptyFreeform.Objects
{ {
public class EmptyFreeformHitObject : HitObject, IHasPosition public class EmptyFreeformHitObject : HitObject, IHasPosition
{ {
public override Judgement CreateJudgement() => new Judgement(); protected override Judgement CreateJudgement() => new Judgement();
public Vector2 Position { get; set; } public Vector2 Position { get; set; }

View File

@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Pippidon.Objects
{ {
public class PippidonHitObject : HitObject, IHasPosition public class PippidonHitObject : HitObject, IHasPosition
{ {
public override Judgement CreateJudgement() => new Judgement(); protected override Judgement CreateJudgement() => new Judgement();
public Vector2 Position { get; set; } public Vector2 Position { get; set; }

View File

@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.EmptyScrolling.Objects
{ {
public class EmptyScrollingHitObject : HitObject public class EmptyScrollingHitObject : HitObject
{ {
public override Judgement CreateJudgement() => new Judgement(); protected override Judgement CreateJudgement() => new Judgement();
} }
} }

View File

@ -13,6 +13,6 @@ namespace osu.Game.Rulesets.Pippidon.Objects
/// </summary> /// </summary>
public int Lane; public int Lane;
public override Judgement CreateJudgement() => new Judgement(); protected override Judgement CreateJudgement() => new Judgement();
} }
} }

View File

@ -358,7 +358,7 @@ namespace osu.Game.Tests.Gameplay
this.maxResult = maxResult; this.maxResult = maxResult;
} }
public override Judgement CreateJudgement() => new TestJudgement(maxResult); protected override Judgement CreateJudgement() => new TestJudgement(maxResult);
protected override HitWindows CreateHitWindows() => new HitWindows(); protected override HitWindows CreateHitWindows() => new HitWindows();
private class TestJudgement : Judgement private class TestJudgement : Judgement

View File

@ -175,7 +175,7 @@ namespace osu.Game.Tests.Gameplay
var hitObject = new HitObject { StartTime = Time.Current }; var hitObject = new HitObject { StartTime = Time.Current };
lifetimeEntry = new HitObjectLifetimeEntry(hitObject) lifetimeEntry = new HitObjectLifetimeEntry(hitObject)
{ {
Result = new JudgementResult(hitObject, hitObject.CreateJudgement()) Result = new JudgementResult(hitObject, hitObject.Judgement)
{ {
Type = HitResult.Great Type = HitResult.Great
} }

View File

@ -129,10 +129,10 @@ namespace osu.Game.Tests.Gameplay
var scoreProcessor = new ScoreProcessor(new OsuRuleset()); var scoreProcessor = new ScoreProcessor(new OsuRuleset());
scoreProcessor.ApplyBeatmap(beatmap); scoreProcessor.ApplyBeatmap(beatmap);
scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], beatmap.HitObjects[0].CreateJudgement()) { Type = HitResult.Ok }); scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], beatmap.HitObjects[0].Judgement) { Type = HitResult.Ok });
scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[1], beatmap.HitObjects[1].CreateJudgement()) { Type = HitResult.LargeTickHit }); scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[1], beatmap.HitObjects[1].Judgement) { Type = HitResult.LargeTickHit });
scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[2], beatmap.HitObjects[2].CreateJudgement()) { Type = HitResult.SmallTickMiss }); scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[2], beatmap.HitObjects[2].Judgement) { Type = HitResult.SmallTickMiss });
scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[3], beatmap.HitObjects[3].CreateJudgement()) { Type = HitResult.SmallBonus }); scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[3], beatmap.HitObjects[3].Judgement) { Type = HitResult.SmallBonus });
var score = new ScoreInfo { Ruleset = new OsuRuleset().RulesetInfo }; var score = new ScoreInfo { Ruleset = new OsuRuleset().RulesetInfo };
scoreProcessor.FailScore(score); scoreProcessor.FailScore(score);
@ -169,8 +169,8 @@ namespace osu.Game.Tests.Gameplay
Assert.That(scoreProcessor.MinimumAccuracy.Value, Is.EqualTo(0)); Assert.That(scoreProcessor.MinimumAccuracy.Value, Is.EqualTo(0));
Assert.That(scoreProcessor.MaximumAccuracy.Value, Is.EqualTo(1)); Assert.That(scoreProcessor.MaximumAccuracy.Value, Is.EqualTo(1));
scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], beatmap.HitObjects[0].CreateJudgement()) { Type = HitResult.Ok }); scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], beatmap.HitObjects[0].Judgement) { Type = HitResult.Ok });
scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[1], beatmap.HitObjects[1].CreateJudgement()) { Type = HitResult.Great }); scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[1], beatmap.HitObjects[1].Judgement) { Type = HitResult.Great });
Assert.That(scoreProcessor.Accuracy.Value, Is.EqualTo((double)(100 + 300) / (2 * 300)).Within(Precision.DOUBLE_EPSILON)); Assert.That(scoreProcessor.Accuracy.Value, Is.EqualTo((double)(100 + 300) / (2 * 300)).Within(Precision.DOUBLE_EPSILON));
Assert.That(scoreProcessor.MinimumAccuracy.Value, Is.EqualTo((double)(100 + 300) / (4 * 300)).Within(Precision.DOUBLE_EPSILON)); Assert.That(scoreProcessor.MinimumAccuracy.Value, Is.EqualTo((double)(100 + 300) / (4 * 300)).Within(Precision.DOUBLE_EPSILON));
@ -196,7 +196,7 @@ namespace osu.Game.Tests.Gameplay
this.maxResult = maxResult; this.maxResult = maxResult;
} }
public override Judgement CreateJudgement() => new TestJudgement(maxResult); protected override Judgement CreateJudgement() => new TestJudgement(maxResult);
} }
} }
} }

View File

@ -112,7 +112,7 @@ namespace osu.Game.Tests.Rulesets.Scoring
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
var judgementResult = new JudgementResult(fourObjectBeatmap.HitObjects[i], fourObjectBeatmap.HitObjects[i].CreateJudgement()) var judgementResult = new JudgementResult(fourObjectBeatmap.HitObjects[i], fourObjectBeatmap.HitObjects[i].Judgement)
{ {
Type = i == 2 ? minResult : hitResult Type = i == 2 ? minResult : hitResult
}; };
@ -141,7 +141,7 @@ namespace osu.Game.Tests.Rulesets.Scoring
for (int i = 0; i < object_count; ++i) for (int i = 0; i < object_count; ++i)
{ {
var judgementResult = new JudgementResult(largeBeatmap.HitObjects[i], largeBeatmap.HitObjects[i].CreateJudgement()) var judgementResult = new JudgementResult(largeBeatmap.HitObjects[i], largeBeatmap.HitObjects[i].Judgement)
{ {
Type = HitResult.Great Type = HitResult.Great
}; };
@ -325,11 +325,11 @@ namespace osu.Game.Tests.Rulesets.Scoring
scoreProcessor = new TestScoreProcessor(); scoreProcessor = new TestScoreProcessor();
scoreProcessor.ApplyBeatmap(beatmap); scoreProcessor.ApplyBeatmap(beatmap);
scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], beatmap.HitObjects[0].CreateJudgement()) { Type = HitResult.Great }); scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[0], beatmap.HitObjects[0].Judgement) { Type = HitResult.Great });
Assert.That(scoreProcessor.Combo.Value, Is.EqualTo(1)); Assert.That(scoreProcessor.Combo.Value, Is.EqualTo(1));
Assert.That(scoreProcessor.Accuracy.Value, Is.EqualTo(1)); Assert.That(scoreProcessor.Accuracy.Value, Is.EqualTo(1));
scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[1], beatmap.HitObjects[1].CreateJudgement()) { Type = HitResult.ComboBreak }); scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[1], beatmap.HitObjects[1].Judgement) { Type = HitResult.ComboBreak });
Assert.That(scoreProcessor.Combo.Value, Is.EqualTo(0)); Assert.That(scoreProcessor.Combo.Value, Is.EqualTo(0));
Assert.That(scoreProcessor.Accuracy.Value, Is.EqualTo(1)); Assert.That(scoreProcessor.Accuracy.Value, Is.EqualTo(1));
} }
@ -350,7 +350,7 @@ namespace osu.Game.Tests.Rulesets.Scoring
for (int i = 0; i < beatmap.HitObjects.Count; i++) for (int i = 0; i < beatmap.HitObjects.Count; i++)
{ {
scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[i], beatmap.HitObjects[i].CreateJudgement()) scoreProcessor.ApplyResult(new JudgementResult(beatmap.HitObjects[i], beatmap.HitObjects[i].Judgement)
{ {
Type = i == 0 ? HitResult.Miss : HitResult.Great Type = i == 0 ? HitResult.Miss : HitResult.Great
}); });
@ -441,10 +441,7 @@ namespace osu.Game.Tests.Rulesets.Scoring
private readonly HitResult maxResult; private readonly HitResult maxResult;
private readonly HitResult? minResult; private readonly HitResult? minResult;
public override Judgement CreateJudgement() protected override Judgement CreateJudgement() => new TestJudgement(maxResult, minResult);
{
return new TestJudgement(maxResult, minResult);
}
public TestHitObject(HitResult maxResult, HitResult? minResult = null) public TestHitObject(HitResult maxResult, HitResult? minResult = null)
{ {