1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 15:27:30 +08:00

Add IApplicableHealthProcessor

This commit is contained in:
Dan Balasescu 2023-12-17 19:27:03 +09:00
parent 7573e316bf
commit d7aca2f641
No known key found for this signature in database
2 changed files with 20 additions and 1 deletions

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"/>.
/// </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);