1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 12:43:09 +08:00

Merge pull request #10846 from PercyDan54/change-taiko-ez

Make EZ mod able to fail in Taiko
This commit is contained in:
Bartłomiej Dach 2020-11-22 14:30:10 +01:00 committed by GitHub
commit 417d6d4915
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 57 additions and 43 deletions

View File

@ -5,7 +5,7 @@ using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Catch.Mods namespace osu.Game.Rulesets.Catch.Mods
{ {
public class CatchModEasy : ModEasy public class CatchModEasy : ModEasyWithExtraLives
{ {
public override string Description => @"Larger fruits, more forgiving HP drain, less accuracy required, and three lives!"; public override string Description => @"Larger fruits, more forgiving HP drain, less accuracy required, and three lives!";
} }

View File

@ -5,7 +5,7 @@ using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Mania.Mods namespace osu.Game.Rulesets.Mania.Mods
{ {
public class ManiaModEasy : ModEasy public class ManiaModEasy : ModEasyWithExtraLives
{ {
public override string Description => @"More forgiving HP drain, less accuracy required, and three lives!"; public override string Description => @"More forgiving HP drain, less accuracy required, and three lives!";
} }

View File

@ -5,7 +5,7 @@ using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Osu.Mods namespace osu.Game.Rulesets.Osu.Mods
{ {
public class OsuModEasy : ModEasy public class OsuModEasy : ModEasyWithExtraLives
{ {
public override string Description => @"Larger circles, more forgiving HP drain, less accuracy required, and three lives!"; public override string Description => @"Larger circles, more forgiving HP drain, less accuracy required, and three lives!";
} }

View File

@ -7,6 +7,6 @@ namespace osu.Game.Rulesets.Taiko.Mods
{ {
public class TaikoModEasy : ModEasy public class TaikoModEasy : ModEasy
{ {
public override string Description => @"Beats move slower, less accuracy required, and three lives!"; public override string Description => @"Beats move slower, and less accuracy required!";
} }
} }

View File

@ -2,17 +2,13 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using Humanizer;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mods namespace osu.Game.Rulesets.Mods
{ {
public abstract class ModEasy : Mod, IApplicableToDifficulty, IApplicableFailOverride, IApplicableToHealthProcessor public abstract class ModEasy : Mod, IApplicableToDifficulty
{ {
public override string Name => "Easy"; public override string Name => "Easy";
public override string Acronym => "EZ"; public override string Acronym => "EZ";
@ -22,49 +18,17 @@ namespace osu.Game.Rulesets.Mods
public override bool Ranked => true; public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock), typeof(ModDifficultyAdjust) }; public override Type[] IncompatibleMods => new[] { typeof(ModHardRock), typeof(ModDifficultyAdjust) };
[SettingSource("Extra Lives", "Number of extra lives")] public virtual void ReadFromDifficulty(BeatmapDifficulty difficulty)
public Bindable<int> Retries { get; } = new BindableInt(2)
{
MinValue = 0,
MaxValue = 10
};
public override string SettingDescription => Retries.IsDefault ? string.Empty : $"{"lives".ToQuantity(Retries.Value)}";
private int retries;
private BindableNumber<double> health;
public void ReadFromDifficulty(BeatmapDifficulty difficulty)
{ {
} }
public void ApplyToDifficulty(BeatmapDifficulty difficulty) public virtual void ApplyToDifficulty(BeatmapDifficulty difficulty)
{ {
const float ratio = 0.5f; const float ratio = 0.5f;
difficulty.CircleSize *= ratio; difficulty.CircleSize *= ratio;
difficulty.ApproachRate *= ratio; difficulty.ApproachRate *= ratio;
difficulty.DrainRate *= ratio; difficulty.DrainRate *= ratio;
difficulty.OverallDifficulty *= ratio; difficulty.OverallDifficulty *= ratio;
retries = Retries.Value;
}
public bool PerformFail()
{
if (retries == 0) return true;
health.Value = health.MaxValue;
retries--;
return false;
}
public bool RestartOnFail => false;
public void ApplyToHealthProcessor(HealthProcessor healthProcessor)
{
health = healthProcessor.Health.GetBoundCopy();
} }
} }
} }

View File

@ -0,0 +1,50 @@
// 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 Humanizer;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Mods
{
public abstract class ModEasyWithExtraLives : ModEasy, IApplicableFailOverride, IApplicableToHealthProcessor
{
[SettingSource("Extra Lives", "Number of extra lives")]
public Bindable<int> Retries { get; } = new BindableInt(2)
{
MinValue = 0,
MaxValue = 10
};
public override string SettingDescription => Retries.IsDefault ? string.Empty : $"{"lives".ToQuantity(Retries.Value)}";
private int retries;
private BindableNumber<double> health;
public override void ApplyToDifficulty(BeatmapDifficulty difficulty)
{
base.ApplyToDifficulty(difficulty);
retries = Retries.Value;
}
public bool PerformFail()
{
if (retries == 0) return true;
health.Value = health.MaxValue;
retries--;
return false;
}
public bool RestartOnFail => false;
public void ApplyToHealthProcessor(HealthProcessor healthProcessor)
{
health = healthProcessor.Health.GetBoundCopy();
}
}
}