Merge pull request #25797 from smoogipoo/osu-ruleset-lazer-hp

Make osu! ruleset once again use the lazer default HP drain
This commit is contained in:
Dean Herbert 2023-12-17 22:22:43 +09:00 committed by GitHub
commit deef7dae1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 11 deletions

View File

@ -10,12 +10,12 @@ using osu.Game.Rulesets.Osu.Scoring;
namespace osu.Game.Rulesets.Osu.Tests
{
[TestFixture]
public class TestSceneOsuHealthProcessor
public class TestSceneOsuLegacyHealthProcessor
{
[Test]
public void TestNoBreak()
{
OsuHealthProcessor hp = new OsuHealthProcessor(-1000);
OsuLegacyHealthProcessor hp = new OsuLegacyHealthProcessor(-1000);
hp.ApplyBeatmap(new Beatmap<OsuHitObject>
{
HitObjects =
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Tests
[Test]
public void TestSingleBreak()
{
OsuHealthProcessor hp = new OsuHealthProcessor(-1000);
OsuLegacyHealthProcessor hp = new OsuLegacyHealthProcessor(-1000);
hp.ApplyBeatmap(new Beatmap<OsuHitObject>
{
HitObjects =
@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Osu.Tests
[Test]
public void TestOverlappingBreak()
{
OsuHealthProcessor hp = new OsuHealthProcessor(-1000);
OsuLegacyHealthProcessor hp = new OsuLegacyHealthProcessor(-1000);
hp.ApplyBeatmap(new Beatmap<OsuHitObject>
{
HitObjects =
@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Osu.Tests
[Test]
public void TestSequentialBreak()
{
OsuHealthProcessor hp = new OsuHealthProcessor(-1000);
OsuLegacyHealthProcessor hp = new OsuLegacyHealthProcessor(-1000);
hp.ApplyBeatmap(new Beatmap<OsuHitObject>
{
HitObjects =

View File

@ -18,7 +18,7 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Osu.Mods
{
public class OsuModClassic : ModClassic, IApplicableToHitObject, IApplicableToDrawableHitObject, IApplicableToDrawableRuleset<OsuHitObject>
public class OsuModClassic : ModClassic, IApplicableToHitObject, IApplicableToDrawableHitObject, IApplicableToDrawableRuleset<OsuHitObject>, IApplicableHealthProcessor
{
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModStrictTracking)).ToArray();
@ -34,6 +34,9 @@ namespace osu.Game.Rulesets.Osu.Mods
[SettingSource("Fade out hit circles earlier", "Make hit circles fade out into a miss, rather than after it.")]
public Bindable<bool> FadeHitCircleEarly { get; } = new Bindable<bool>(true);
[SettingSource("Classic health", "More closely resembles the original HP drain mechanics.")]
public Bindable<bool> ClassicHealth { get; } = new Bindable<bool>(true);
private bool usingHiddenFading;
public void ApplyToHitObject(HitObject hitObject)
@ -115,5 +118,7 @@ namespace osu.Game.Rulesets.Osu.Mods
}
};
}
public HealthProcessor? CreateHealthProcessor(double drainStartTime) => ClassicHealth.Value ? new OsuLegacyHealthProcessor(drainStartTime) : null;
}
}

View File

@ -48,8 +48,6 @@ namespace osu.Game.Rulesets.Osu
public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor();
public override HealthProcessor CreateHealthProcessor(double drainStartTime) => new OsuHealthProcessor(drainStartTime);
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new OsuBeatmapConverter(beatmap, this);
public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new OsuBeatmapProcessor(beatmap);

View File

@ -10,9 +10,9 @@ using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Scoring
{
public partial class OsuHealthProcessor : LegacyDrainingHealthProcessor
public partial class OsuLegacyHealthProcessor : LegacyDrainingHealthProcessor
{
public OsuHealthProcessor(double drainStartTime)
public OsuLegacyHealthProcessor(double drainStartTime)
: base(drainStartTime)
{
}

View File

@ -0,0 +1,18 @@
// 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 osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mods
{
/// <summary>
/// Interface for a <see cref="Mod"/> that provides its own health processor.
/// </summary>
public interface IApplicableHealthProcessor
{
/// <summary>
/// Creates the <see cref="HealthProcessor"/>. May be null to use the ruleset default.
/// </summary>
HealthProcessor? CreateHealthProcessor(double drainStartTime);
}
}

View File

@ -227,7 +227,8 @@ namespace osu.Game.Screens.Play
dependencies.CacheAs(ScoreProcessor);
HealthProcessor = ruleset.CreateHealthProcessor(playableBeatmap.HitObjects[0].StartTime);
HealthProcessor = gameplayMods.OfType<IApplicableHealthProcessor>().FirstOrDefault()?.CreateHealthProcessor(playableBeatmap.HitObjects[0].StartTime);
HealthProcessor ??= ruleset.CreateHealthProcessor(playableBeatmap.HitObjects[0].StartTime);
HealthProcessor.ApplyBeatmap(playableBeatmap);
dependencies.CacheAs(HealthProcessor);