osu/osu.Game/Rulesets/Mods/ModEasy.cs

71 lines
2.2 KiB
C#
Raw Normal View History

// 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.
2018-04-13 09:19:50 +00:00
using System;
using Humanizer;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
2018-04-13 09:19:50 +00:00
using osu.Game.Beatmaps;
using osu.Game.Configuration;
2018-04-13 09:19:50 +00:00
using osu.Game.Graphics;
2019-04-03 20:58:17 +00:00
using osu.Game.Rulesets.Scoring;
2018-04-13 09:19:50 +00:00
namespace osu.Game.Rulesets.Mods
{
public abstract class ModEasy : Mod, IApplicableToDifficulty, IApplicableFailOverride, IApplicableToHealthProcessor
2018-04-13 09:19:50 +00:00
{
public override string Name => "Easy";
public override string Acronym => "EZ";
2020-01-14 13:22:00 +00:00
public override IconUsage? Icon => OsuIcon.ModEasy;
2018-04-13 09:19:50 +00:00
public override ModType Type => ModType.DifficultyReduction;
public override double ScoreMultiplier => 0.5;
public override bool Ranked => true;
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock), typeof(ModDifficultyAdjust) };
2019-04-04 21:04:49 +00:00
[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;
2020-06-09 14:38:54 +00:00
public void ReadFromDifficulty(BeatmapDifficulty difficulty)
{
}
2018-04-13 09:19:50 +00:00
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
{
const float ratio = 0.5f;
difficulty.CircleSize *= ratio;
difficulty.ApproachRate *= ratio;
difficulty.DrainRate *= ratio;
difficulty.OverallDifficulty *= ratio;
retries = Retries.Value;
2018-04-13 09:19:50 +00:00
}
2019-04-03 20:58:17 +00:00
public bool PerformFail()
2019-04-03 20:58:17 +00:00
{
if (retries == 0) return true;
health.Value = health.MaxValue;
retries--;
return false;
2019-04-03 20:58:17 +00:00
}
public bool RestartOnFail => false;
public void ApplyToHealthProcessor(HealthProcessor healthProcessor)
{
health = healthProcessor.Health.GetBoundCopy();
}
2018-04-13 09:19:50 +00:00
}
}