1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-26 18:42:56 +08:00

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

View File

@ -18,7 +18,7 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Osu.Mods 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(); 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.")] [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); 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; private bool usingHiddenFading;
public void ApplyToHitObject(HitObject hitObject) 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 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 IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new OsuBeatmapConverter(beatmap, this);
public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new OsuBeatmapProcessor(beatmap); 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 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) : 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); 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); HealthProcessor.ApplyBeatmap(playableBeatmap);
dependencies.CacheAs(HealthProcessor); dependencies.CacheAs(HealthProcessor);