mirror of
https://github.com/osukey/osukey.git
synced 2025-06-25 05:07:59 +09:00
Merge pull request #5637 from iiSaLMaN/stop-counting-to-score-after-fail
Disallow adding to score after the player has failed Co-authored-by: Dan Balasescu <smoogipoo@smgi.me> Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
e5c3a906d7
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Framework.Extensions;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -22,8 +20,6 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
|
|
||||||
private float hpDrainRate;
|
private float hpDrainRate;
|
||||||
|
|
||||||
private readonly Dictionary<ComboResult, int> comboResultCounts = new Dictionary<ComboResult, int>();
|
|
||||||
|
|
||||||
protected override void ApplyBeatmap(Beatmap<OsuHitObject> beatmap)
|
protected override void ApplyBeatmap(Beatmap<OsuHitObject> beatmap)
|
||||||
{
|
{
|
||||||
base.ApplyBeatmap(beatmap);
|
base.ApplyBeatmap(beatmap);
|
||||||
@ -31,22 +27,6 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
hpDrainRate = beatmap.BeatmapInfo.BaseDifficulty.DrainRate;
|
hpDrainRate = beatmap.BeatmapInfo.BaseDifficulty.DrainRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Reset(bool storeResults)
|
|
||||||
{
|
|
||||||
base.Reset(storeResults);
|
|
||||||
comboResultCounts.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void ApplyResult(JudgementResult result)
|
|
||||||
{
|
|
||||||
base.ApplyResult(result);
|
|
||||||
|
|
||||||
var osuResult = (OsuJudgementResult)result;
|
|
||||||
|
|
||||||
if (result.Type != HitResult.None)
|
|
||||||
comboResultCounts[osuResult.ComboType] = comboResultCounts.GetOrDefault(osuResult.ComboType) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override double HealthAdjustmentFactorFor(JudgementResult result)
|
protected override double HealthAdjustmentFactorFor(JudgementResult result)
|
||||||
{
|
{
|
||||||
switch (result.Type)
|
switch (result.Type)
|
||||||
|
52
osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs
Normal file
52
osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// 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.Linq;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneFailJudgement : AllPlayersTestScene
|
||||||
|
{
|
||||||
|
protected override Player CreatePlayer(Ruleset ruleset)
|
||||||
|
{
|
||||||
|
Mods.Value = Array.Empty<Mod>();
|
||||||
|
|
||||||
|
var beatmap = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo, Array.Empty<Mod>());
|
||||||
|
return new FailPlayer(ruleset.GetAutoplayMod().CreateReplayScore(beatmap));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void AddCheckSteps()
|
||||||
|
{
|
||||||
|
AddUntilStep("wait for fail", () => Player.HasFailed);
|
||||||
|
AddUntilStep("wait for multiple judged objects", () => ((FailPlayer)Player).DrawableRuleset.Playfield.AllHitObjects.Count(h => h.AllJudged) > 1);
|
||||||
|
AddAssert("total judgements == 1", () => ((FailPlayer)Player).ScoreProcessor.JudgedHits == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class FailPlayer : ReplayPlayer
|
||||||
|
{
|
||||||
|
public new DrawableRuleset DrawableRuleset => base.DrawableRuleset;
|
||||||
|
|
||||||
|
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
|
||||||
|
|
||||||
|
protected override bool PauseOnFocusLost => false;
|
||||||
|
|
||||||
|
public FailPlayer(Score score)
|
||||||
|
: base(score, false, false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
ScoreProcessor.FailConditions += (_, __) => true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -51,6 +51,11 @@ namespace osu.Game.Rulesets.Judgements
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double HealthAtJudgement { get; internal set; }
|
public double HealthAtJudgement { get; internal set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the user was in a failed state prior to this <see cref="JudgementResult"/> occurring.
|
||||||
|
/// </summary>
|
||||||
|
public bool FailedAtJudgement { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether a miss or hit occurred.
|
/// Whether a miss or hit occurred.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -92,6 +92,11 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual bool HasCompleted => false;
|
public virtual bool HasCompleted => false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The total number of judged <see cref="HitObject"/>s at the current point in time.
|
||||||
|
/// </summary>
|
||||||
|
public int JudgedHits { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this ScoreProcessor has already triggered the failed state.
|
/// Whether this ScoreProcessor has already triggered the failed state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -142,6 +147,8 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
Rank.Value = ScoreRank.X;
|
Rank.Value = ScoreRank.X;
|
||||||
HighestCombo.Value = 0;
|
HighestCombo.Value = 0;
|
||||||
|
|
||||||
|
JudgedHits = 0;
|
||||||
|
|
||||||
HasFailed = false;
|
HasFailed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +200,7 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
score.Statistics[result] = GetStatistic(result);
|
score.Statistics[result] = GetStatistic(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract int GetStatistic(HitResult result);
|
public abstract int GetStatistic(HitResult result);
|
||||||
|
|
||||||
public abstract double GetStandardisedScore();
|
public abstract double GetStandardisedScore();
|
||||||
}
|
}
|
||||||
@ -208,7 +215,6 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
public sealed override bool HasCompleted => JudgedHits == MaxHits;
|
public sealed override bool HasCompleted => JudgedHits == MaxHits;
|
||||||
|
|
||||||
protected int MaxHits { get; private set; }
|
protected int MaxHits { get; private set; }
|
||||||
protected int JudgedHits { get; private set; }
|
|
||||||
|
|
||||||
private double maxHighestCombo;
|
private double maxHighestCombo;
|
||||||
|
|
||||||
@ -322,6 +328,10 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
result.ComboAtJudgement = Combo.Value;
|
result.ComboAtJudgement = Combo.Value;
|
||||||
result.HighestComboAtJudgement = HighestCombo.Value;
|
result.HighestComboAtJudgement = HighestCombo.Value;
|
||||||
result.HealthAtJudgement = Health.Value;
|
result.HealthAtJudgement = Health.Value;
|
||||||
|
result.FailedAtJudgement = HasFailed;
|
||||||
|
|
||||||
|
if (HasFailed)
|
||||||
|
return;
|
||||||
|
|
||||||
JudgedHits++;
|
JudgedHits++;
|
||||||
|
|
||||||
@ -369,6 +379,11 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
HighestCombo.Value = result.HighestComboAtJudgement;
|
HighestCombo.Value = result.HighestComboAtJudgement;
|
||||||
Health.Value = result.HealthAtJudgement;
|
Health.Value = result.HealthAtJudgement;
|
||||||
|
|
||||||
|
// Todo: Revert HasFailed state with proper player support
|
||||||
|
|
||||||
|
if (result.FailedAtJudgement)
|
||||||
|
return;
|
||||||
|
|
||||||
JudgedHits--;
|
JudgedHits--;
|
||||||
|
|
||||||
if (result.Judgement.IsBonus)
|
if (result.Judgement.IsBonus)
|
||||||
@ -415,7 +430,7 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override int GetStatistic(HitResult result) => scoreResultCounts.GetOrDefault(result);
|
public override int GetStatistic(HitResult result) => scoreResultCounts.GetOrDefault(result);
|
||||||
|
|
||||||
public override double GetStandardisedScore() => getScore(ScoringMode.Standardised);
|
public override double GetStandardisedScore() => getScore(ScoringMode.Standardised);
|
||||||
|
|
||||||
@ -432,7 +447,6 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
|
|
||||||
base.Reset(storeResults);
|
base.Reset(storeResults);
|
||||||
|
|
||||||
JudgedHits = 0;
|
|
||||||
baseScore = 0;
|
baseScore = 0;
|
||||||
rollingMaxBaseScore = 0;
|
rollingMaxBaseScore = 0;
|
||||||
bonusScore = 0;
|
bonusScore = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user