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

52 lines
1.7 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 osu.Framework.Graphics.Sprites;
2018-04-13 09:19:50 +00:00
using osu.Game.Beatmaps;
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
{
2019-04-03 20:58:17 +00:00
public abstract class ModEasy : Mod, IApplicableToDifficulty, IApplicableToScoreProcessor
2018-04-13 09:19:50 +00:00
{
2019-04-03 22:32:29 +00:00
public static int Lives = 2;
2018-04-13 09:19:50 +00:00
public override string Name => "Easy";
public override string Acronym => "EZ";
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) };
public void ApplyToDifficulty(BeatmapDifficulty difficulty)
{
const float ratio = 0.5f;
difficulty.CircleSize *= ratio;
difficulty.ApproachRate *= ratio;
difficulty.DrainRate *= ratio;
difficulty.OverallDifficulty *= ratio;
}
2019-04-03 20:58:17 +00:00
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
{
2019-04-03 22:20:20 +00:00
scoreProcessor.Health.ValueChanged += valueChanged =>
{
2019-04-03 20:58:17 +00:00
if (scoreProcessor.Health.Value == 0)
{
if (Lives != 0)
{
Lives--;
scoreProcessor.Health.Value = 100;
}
2019-04-03 22:32:29 +00:00
else
{
Lives = 2;
}
2019-04-03 20:58:17 +00:00
}
2019-04-03 21:05:47 +00:00
};
2019-04-03 20:58:17 +00:00
}
2018-04-13 09:19:50 +00:00
}
}