mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:02:54 +08:00
Fix fail check ordering not being enforced correctly
This commit is contained in:
parent
9ed8528a40
commit
278e227115
@ -25,6 +25,11 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// </summary>
|
||||
public readonly Bindable<IReadOnlyList<Mod>> Mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||
|
||||
/// <summary>
|
||||
/// Mods which can override fail ordered in the correct order for checks.
|
||||
/// </summary>
|
||||
public IApplicableFailOverride[] OrderedFailOverrideMods { get; private set; } = Array.Empty<IApplicableFailOverride>();
|
||||
|
||||
/// <summary>
|
||||
/// The current health.
|
||||
/// </summary>
|
||||
@ -59,6 +64,14 @@ namespace osu.Game.Rulesets.Scoring
|
||||
ModTriggeringFailure = triggeringMod;
|
||||
}
|
||||
|
||||
protected HealthProcessor()
|
||||
{
|
||||
Mods.BindValueChanged(mods =>
|
||||
{
|
||||
OrderedFailOverrideMods = mods.NewValue.OfType<IApplicableFailOverride>().OrderByDescending(m => m.RestartOnFail).ToArray();
|
||||
});
|
||||
}
|
||||
|
||||
protected override void ApplyResultInternal(JudgementResult result)
|
||||
{
|
||||
result.HealthAtJudgement = Health.Value;
|
||||
@ -102,7 +115,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
if (CheckDefaultFailCondition(result))
|
||||
return true;
|
||||
|
||||
foreach (var condition in Mods.Value.OfType<IApplicableFailOverride>())
|
||||
foreach (var condition in OrderedFailOverrideMods)
|
||||
{
|
||||
if (condition.CheckFail(result) == FailState.Force)
|
||||
{
|
||||
|
@ -152,7 +152,7 @@ namespace osu.Game.Screens.Play
|
||||
/// Whether failing should be allowed.
|
||||
/// By default, this checks whether all selected mods allow failing.
|
||||
/// </summary>
|
||||
protected virtual bool CheckModsAllowFailure() => HealthProcessor.Mods.Value.OfType<IApplicableFailOverride>().All(m => m.CheckFail(null) != FailState.Block);
|
||||
protected virtual bool CheckModsAllowFailure() => HealthProcessor.OrderedFailOverrideMods.All(m => m.CheckFail(null) != FailState.Block);
|
||||
|
||||
public readonly PlayerConfiguration Configuration;
|
||||
|
||||
@ -244,7 +244,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
HealthProcessor = gameplayMods.OfType<IApplicableHealthProcessor>().FirstOrDefault()?.CreateHealthProcessor(playableBeatmap.HitObjects[0].StartTime);
|
||||
HealthProcessor ??= ruleset.CreateHealthProcessor(playableBeatmap.HitObjects[0].StartTime);
|
||||
HealthProcessor.Mods.Value = gameplayMods.OrderByDescending(m => m is IApplicableFailOverride mod && mod.RestartOnFail).ToArray();
|
||||
HealthProcessor.Mods.Value = gameplayMods;
|
||||
HealthProcessor.ApplyBeatmap(playableBeatmap);
|
||||
|
||||
dependencies.CacheAs(HealthProcessor);
|
||||
|
Loading…
Reference in New Issue
Block a user