mirror of
https://github.com/ppy/osu
synced 2025-04-07 01:31:43 +00:00
Implement AdjustRank and Hidden mod grades (S+ and SS+) (#4655)
Implement AdjustRank and Hidden mod grades (S+ and SS+) Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
bd0704c575
@ -12,6 +12,7 @@ using osu.Game.Rulesets.Mods;
|
|||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Scoring;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -41,6 +42,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
scoreProcessor.Health.ValueChanged += health => { blinds.AnimateClosedness((float)health.NewValue); };
|
scoreProcessor.Health.ValueChanged += health => { blinds.AnimateClosedness((float)health.NewValue); };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Element for the Blinds mod drawing 2 black boxes covering the whole screen which resize inside a restricted area with some leniency.
|
/// Element for the Blinds mod drawing 2 black boxes covering the whole screen which resize inside a restricted area with some leniency.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -12,6 +12,7 @@ using osu.Framework.Screens;
|
|||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens;
|
using osu.Game.Screens;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
@ -96,6 +97,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
Applied = true;
|
Applied = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestPlayer : Player
|
private class TestPlayer : Player
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// 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 osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
{
|
{
|
||||||
@ -10,6 +11,14 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IApplicableToScoreProcessor : IApplicableMod
|
public interface IApplicableToScoreProcessor : IApplicableMod
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provide a <see cref="ScoreProcessor"/> to a mod. Called once on initialisation of a play instance.
|
||||||
|
/// </summary>
|
||||||
void ApplyToScoreProcessor(ScoreProcessor scoreProcessor);
|
void ApplyToScoreProcessor(ScoreProcessor scoreProcessor);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called every time a rank calculation is requested. Allows mods to adjust the final rank.
|
||||||
|
/// </summary>
|
||||||
|
ScoreRank AdjustRank(ScoreRank rank, double accuracy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Scoring;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -46,6 +47,8 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
Combo.BindTo(scoreProcessor.Combo);
|
Combo.BindTo(scoreProcessor.Combo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;
|
||||||
|
|
||||||
public virtual void ApplyToDrawableRuleset(DrawableRuleset<T> drawableRuleset)
|
public virtual void ApplyToDrawableRuleset(DrawableRuleset<T> drawableRuleset)
|
||||||
{
|
{
|
||||||
var flashlight = CreateFlashlight();
|
var flashlight = CreateFlashlight();
|
||||||
|
@ -8,10 +8,12 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
{
|
{
|
||||||
public abstract class ModHidden : Mod, IReadFromConfig, IApplicableToDrawableHitObjects
|
public abstract class ModHidden : Mod, IReadFromConfig, IApplicableToDrawableHitObjects, IApplicableToScoreProcessor
|
||||||
{
|
{
|
||||||
public override string Name => "Hidden";
|
public override string Name => "Hidden";
|
||||||
public override string Acronym => "HD";
|
public override string Acronym => "HD";
|
||||||
@ -32,6 +34,25 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
d.ApplyCustomUpdateState += ApplyHiddenState;
|
d.ApplyCustomUpdateState += ApplyHiddenState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
||||||
|
{
|
||||||
|
// Default value of ScoreProcessor's Rank in Hidden Mod should be SS+
|
||||||
|
scoreProcessor.Rank.Value = ScoreRank.XH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScoreRank AdjustRank(ScoreRank rank, double accuracy)
|
||||||
|
{
|
||||||
|
switch (rank)
|
||||||
|
{
|
||||||
|
case ScoreRank.X:
|
||||||
|
return ScoreRank.XH;
|
||||||
|
case ScoreRank.S:
|
||||||
|
return ScoreRank.SH;
|
||||||
|
default:
|
||||||
|
return rank;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void ApplyHiddenState(DrawableHitObject hitObject, ArmedState state)
|
protected virtual void ApplyHiddenState(DrawableHitObject hitObject, ArmedState state)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using System;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
{
|
{
|
||||||
@ -24,6 +25,8 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
scoreProcessor.FailConditions += FailCondition;
|
scoreProcessor.FailConditions += FailCondition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;
|
||||||
|
|
||||||
protected virtual bool FailCondition(ScoreProcessor scoreProcessor) => scoreProcessor.Combo.Value == 0;
|
protected virtual bool FailCondition(ScoreProcessor scoreProcessor) => scoreProcessor.Combo.Value == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Extensions;
|
|||||||
using osu.Framework.Extensions.TypeExtensions;
|
using osu.Framework.Extensions.TypeExtensions;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
@ -60,6 +61,11 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly BindableInt Combo = new BindableInt();
|
public readonly BindableInt Combo = new BindableInt();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current selected mods
|
||||||
|
/// </summary>
|
||||||
|
public readonly Bindable<IReadOnlyList<Mod>> Mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a <see cref="HitWindows"/> for this processor.
|
/// Create a <see cref="HitWindows"/> for this processor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -98,7 +104,12 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
protected ScoreProcessor()
|
protected ScoreProcessor()
|
||||||
{
|
{
|
||||||
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
|
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
|
||||||
Accuracy.ValueChanged += delegate { Rank.Value = rankFrom(Accuracy.Value); };
|
Accuracy.ValueChanged += delegate
|
||||||
|
{
|
||||||
|
Rank.Value = rankFrom(Accuracy.Value);
|
||||||
|
foreach (var mod in Mods.Value.OfType<IApplicableToScoreProcessor>())
|
||||||
|
Rank.Value = mod.AdjustRank(Rank.Value, Accuracy.Value);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScoreRank rankFrom(double acc)
|
private ScoreRank rankFrom(double acc)
|
||||||
|
@ -106,6 +106,8 @@ namespace osu.Game.Screens.Play
|
|||||||
showStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
showStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||||
|
|
||||||
ScoreProcessor = DrawableRuleset.CreateScoreProcessor();
|
ScoreProcessor = DrawableRuleset.CreateScoreProcessor();
|
||||||
|
ScoreProcessor.Mods.BindTo(Mods);
|
||||||
|
|
||||||
if (!ScoreProcessor.Mode.Disabled)
|
if (!ScoreProcessor.Mode.Disabled)
|
||||||
config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
|
config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user