From 5a3e5036ed81c3a67292fb0eac1bccf8eca82a5f Mon Sep 17 00:00:00 2001 From: RORIdev Date: Thu, 4 Apr 2019 13:21:53 -0300 Subject: [PATCH] All suggestions were applied. --- osu.Game/Rulesets/Mods/ModEasy.cs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/osu.Game/Rulesets/Mods/ModEasy.cs b/osu.Game/Rulesets/Mods/ModEasy.cs index 85cac872b8..bdfa4f9bb5 100644 --- a/osu.Game/Rulesets/Mods/ModEasy.cs +++ b/osu.Game/Rulesets/Mods/ModEasy.cs @@ -2,7 +2,11 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; using osu.Framework.Graphics.Sprites; +using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Rulesets.Scoring; @@ -11,7 +15,7 @@ namespace osu.Game.Rulesets.Mods { public abstract class ModEasy : Mod, IApplicableToDifficulty, IApplicableToScoreProcessor { - public static int Lives; + private int Lives; public override string Name => "Easy"; public override string Acronym => "EZ"; public override IconUsage Icon => OsuIcon.ModEasy; @@ -19,7 +23,7 @@ public abstract class ModEasy : Mod, IApplicableToDifficulty, IApplicableToScore public override double ScoreMultiplier => 0.5; public override bool Ranked => true; public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) }; - + public void ApplyToDifficulty(BeatmapDifficulty difficulty) { const float ratio = 0.5f; @@ -31,16 +35,17 @@ public void ApplyToDifficulty(BeatmapDifficulty difficulty) public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) { + //Note : The lives has to be instaciated here in order to prevent the values from different plays to interfear + //with each other / not reseting after a restart , as this method is called once a play starts (to my knowlegde). + //This will be better implemented with a List once I know how to reliably get the game time and update it. + //If you know any information about that, please contact me because I didn't find a sollution to that. Lives = 2; scoreProcessor.Health.ValueChanged += valueChanged => { - if (scoreProcessor.Health.Value == 0) + if (scoreProcessor.Health.Value == scoreProcessor.Health.MinValue && Lives > 0) { - if (Lives != 0) - { - Lives--; - scoreProcessor.Health.Value = 100; - } + Lives--; + scoreProcessor.Health.Value = scoreProcessor.Health.MaxValue; } }; }