From 2aeda548656d230f1cbf2f084ffa8d2ba552de26 Mon Sep 17 00:00:00 2001 From: Peter-io <93472377+Peter-io@users.noreply.github.com> Date: Thu, 11 Jul 2024 17:49:43 +0200 Subject: [PATCH] Store FailTrigger in HealthProcessor --- osu.Game/Rulesets/Scoring/HealthProcessor.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Scoring/HealthProcessor.cs b/osu.Game/Rulesets/Scoring/HealthProcessor.cs index 2799cd4b36..5457b157a7 100644 --- a/osu.Game/Rulesets/Scoring/HealthProcessor.cs +++ b/osu.Game/Rulesets/Scoring/HealthProcessor.cs @@ -5,6 +5,7 @@ using System; using osu.Framework.Bindables; using osu.Framework.Utils; using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Scoring { @@ -31,16 +32,24 @@ namespace osu.Game.Rulesets.Scoring /// public bool HasFailed { get; private set; } + /// + /// Object that triggered fail + /// + public object? FailTrigger; + /// /// Immediately triggers a failure for this HealthProcessor. /// - public void TriggerFailure() + public void TriggerFailure(object? Trigger = null) { if (HasFailed) return; if (Failed?.Invoke() != false) HasFailed = true; + + if (Trigger != null) + FailTrigger = Trigger; } protected override void ApplyResultInternal(JudgementResult result) @@ -92,7 +101,10 @@ namespace osu.Game.Rulesets.Scoring { bool conditionResult = (bool)condition.Method.Invoke(condition.Target, new object[] { this, result })!; if (conditionResult) + { + FailTrigger = condition.Target; return true; + } } }