2019-01-24 16:43:03 +08:00
|
|
|
// 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 17:19:50 +08:00
|
|
|
|
|
|
|
using System;
|
2020-03-21 04:42:35 +08:00
|
|
|
using Humanizer;
|
2019-09-21 22:30:54 +08:00
|
|
|
using osu.Framework.Bindables;
|
2019-03-27 18:29:27 +08:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
2018-04-13 17:19:50 +08:00
|
|
|
using osu.Game.Beatmaps;
|
2019-12-23 18:23:03 +08:00
|
|
|
using osu.Game.Configuration;
|
2018-04-13 17:19:50 +08:00
|
|
|
using osu.Game.Graphics;
|
2019-04-04 04:58:17 +08:00
|
|
|
using osu.Game.Rulesets.Scoring;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mods
|
|
|
|
{
|
2019-12-19 19:03:14 +08:00
|
|
|
public abstract class ModEasy : Mod, IApplicableToDifficulty, IApplicableFailOverride, IApplicableToHealthProcessor
|
2018-04-13 17:19:50 +08:00
|
|
|
{
|
|
|
|
public override string Name => "Easy";
|
2018-11-30 16:16:00 +08:00
|
|
|
public override string Acronym => "EZ";
|
2020-01-14 21:22:00 +08:00
|
|
|
public override IconUsage? Icon => OsuIcon.ModEasy;
|
2018-04-13 17:19:50 +08:00
|
|
|
public override ModType Type => ModType.DifficultyReduction;
|
|
|
|
public override double ScoreMultiplier => 0.5;
|
|
|
|
public override bool Ranked => true;
|
2019-12-12 08:25:51 +08:00
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock), typeof(ModDifficultyAdjust) };
|
2019-04-05 05:04:49 +08:00
|
|
|
|
2020-03-21 04:05:12 +08:00
|
|
|
[SettingSource("Extra Lives", "Number of extra lives")]
|
2019-12-23 18:23:03 +08:00
|
|
|
public Bindable<int> Retries { get; } = new BindableInt(2)
|
|
|
|
{
|
|
|
|
MinValue = 0,
|
|
|
|
MaxValue = 10
|
|
|
|
};
|
|
|
|
|
2020-03-23 06:49:45 +08:00
|
|
|
public override string SettingDescription => Retries.IsDefault ? string.Empty : $"{"lives".ToQuantity(Retries.Value)}";
|
2020-03-21 04:05:12 +08:00
|
|
|
|
2019-12-23 18:23:03 +08:00
|
|
|
private int retries;
|
2019-09-21 22:30:54 +08:00
|
|
|
|
|
|
|
private BindableNumber<double> health;
|
|
|
|
|
2019-12-26 13:52:08 +08:00
|
|
|
public void ReadFromDifficulty(BeatmapDifficulty difficulty) { }
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
|
|
|
|
{
|
|
|
|
const float ratio = 0.5f;
|
|
|
|
difficulty.CircleSize *= ratio;
|
|
|
|
difficulty.ApproachRate *= ratio;
|
|
|
|
difficulty.DrainRate *= ratio;
|
|
|
|
difficulty.OverallDifficulty *= ratio;
|
2019-12-23 18:23:03 +08:00
|
|
|
|
|
|
|
retries = Retries.Value;
|
2018-04-13 17:19:50 +08:00
|
|
|
}
|
2019-04-04 04:58:17 +08:00
|
|
|
|
2020-05-12 19:08:35 +08:00
|
|
|
public bool PerformFail()
|
2019-04-04 04:58:17 +08:00
|
|
|
{
|
2020-05-12 19:08:35 +08:00
|
|
|
if (retries == 0) return true;
|
2019-09-21 22:30:54 +08:00
|
|
|
|
2020-05-12 19:08:35 +08:00
|
|
|
health.Value = health.MaxValue;
|
|
|
|
retries--;
|
2019-09-21 22:30:54 +08:00
|
|
|
|
2020-05-12 19:08:35 +08:00
|
|
|
return false;
|
2019-04-04 04:58:17 +08:00
|
|
|
}
|
2019-09-21 22:30:54 +08:00
|
|
|
|
|
|
|
public bool RestartOnFail => false;
|
|
|
|
|
2019-12-19 19:03:14 +08:00
|
|
|
public void ApplyToHealthProcessor(HealthProcessor healthProcessor)
|
2019-09-21 22:30:54 +08:00
|
|
|
{
|
2019-12-19 19:03:14 +08:00
|
|
|
health = healthProcessor.Health.GetBoundCopy();
|
2019-09-21 22:30:54 +08:00
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
}
|
|
|
|
}
|