2019-01-24 08:43:03 +00: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 09:19:50 +00:00
|
|
|
|
|
2020-11-16 10:15:15 +00:00
|
|
|
|
using Humanizer;
|
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Configuration;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2020-11-16 10:15:15 +00:00
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Mods
|
|
|
|
|
{
|
2020-11-16 10:28:50 +00:00
|
|
|
|
public class CatchModEasy : ModEasy, IApplicableFailOverride, IApplicableToHealthProcessor
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
public override string Description => @"Larger fruits, more forgiving HP drain, less accuracy required, and three lives!";
|
2020-11-16 10:15:15 +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;
|
|
|
|
|
|
|
|
|
|
public override void ReadFromDifficulty(BeatmapDifficulty difficulty)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void ApplyToDifficulty(BeatmapDifficulty difficulty)
|
|
|
|
|
{
|
|
|
|
|
const float ratio = 0.5f;
|
|
|
|
|
difficulty.CircleSize *= ratio;
|
|
|
|
|
difficulty.ApproachRate *= ratio;
|
|
|
|
|
difficulty.DrainRate *= 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;
|
2020-11-16 10:22:17 +00:00
|
|
|
|
|
|
|
|
|
public void ApplyToHealthProcessor(HealthProcessor healthProcessor)
|
|
|
|
|
{
|
|
|
|
|
health = healthProcessor.Health.GetBoundCopy();
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|