mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 17:52:56 +08:00
Changed the logic to ModEasy.
This commit is contained in:
parent
9cfe17cbf1
commit
f6e1cb07a1
@ -5,11 +5,13 @@ using System;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public abstract class ModEasy : Mod, IApplicableToDifficulty
|
||||
public abstract class ModEasy : Mod, IApplicableToDifficulty, IApplicableToScoreProcessor
|
||||
{
|
||||
public static int Lives = 2;
|
||||
public override string Name => "Easy";
|
||||
public override string Acronym => "EZ";
|
||||
public override IconUsage Icon => OsuIcon.ModEasy;
|
||||
@ -26,5 +28,21 @@ namespace osu.Game.Rulesets.Mods
|
||||
difficulty.DrainRate *= ratio;
|
||||
difficulty.OverallDifficulty *= ratio;
|
||||
}
|
||||
|
||||
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
||||
{
|
||||
scoreProcessor.Health.ValueChanged += ValueChanged =>{
|
||||
if (scoreProcessor.Health.Value == 0)
|
||||
{
|
||||
if (Lives != 0)
|
||||
{
|
||||
Lives--;
|
||||
scoreProcessor.Health.Value = 100;
|
||||
}
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,38 +325,21 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected FailOverlay FailOverlay { get; private set; }
|
||||
|
||||
private void fail()
|
||||
{
|
||||
GameplayClockContainer.Stop();
|
||||
HasFailed = true;
|
||||
FailOverlay.Retries = RestartCount;
|
||||
FailOverlay.Show();
|
||||
}
|
||||
|
||||
private bool onFail()
|
||||
{
|
||||
//issue #3372
|
||||
if (Beatmap.Value.Mods.Value.Any(x => x is ModEasy))
|
||||
{
|
||||
if (Lives != 0)
|
||||
{
|
||||
Lives--;
|
||||
ScoreProcessor.Health.Value = 100;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (Beatmap.Value.Mods.Value.OfType<IApplicableFailOverride>().Any(m => !m.AllowFail))
|
||||
return false;
|
||||
GameplayClockContainer.Stop();
|
||||
HasFailed = true;
|
||||
// There is a chance that we could be in a paused state as the ruleset's internal clock (see FrameStabilityContainer)
|
||||
// could process an extra frame after the GameplayClock is stopped.
|
||||
// In such cases we want the fail state to precede a user triggered pause.
|
||||
if (PauseOverlay.State == Visibility.Visible)
|
||||
PauseOverlay.Hide();
|
||||
fail();
|
||||
FailOverlay.Retries = RestartCount;
|
||||
FailOverlay.Show();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user