mirror of https://github.com/ppy/osu
49 lines
1.6 KiB
C#
49 lines
1.6 KiB
C#
// 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 System;
|
|
using osu.Framework.Graphics.Sprites;
|
|
using osu.Game.Beatmaps;
|
|
using osu.Game.Graphics;
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
namespace osu.Game.Rulesets.Mods
|
|
{
|
|
public abstract class ModEasy : Mod, IApplicableToDifficulty, IApplicableToScoreProcessor
|
|
{
|
|
public static int Lives = 2;
|
|
public override string Name => "Easy";
|
|
public override string Acronym => "EZ";
|
|
public override IconUsage Icon => OsuIcon.ModEasy;
|
|
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;
|
|
}
|
|
|
|
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
|
{
|
|
scoreProcessor.Health.ValueChanged += ValueChanged =>{
|
|
if (scoreProcessor.Health.Value == 0)
|
|
{
|
|
if (Lives != 0)
|
|
{
|
|
Lives--;
|
|
scoreProcessor.Health.Value = 100;
|
|
}
|
|
}
|
|
|
|
} ;
|
|
|
|
}
|
|
}
|
|
}
|