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;
|
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;
|
|
|
|
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-04-04 04:58:17 +08:00
|
|
|
public abstract class ModEasy : Mod, IApplicableToDifficulty, IApplicableToScoreProcessor
|
2018-04-13 17:19:50 +08:00
|
|
|
{
|
2019-04-05 05:04:49 +08:00
|
|
|
private int lives;
|
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";
|
2019-03-27 18:29:27 +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;
|
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) };
|
2019-04-05 05:04:49 +08:00
|
|
|
|
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-04-04 04:58:17 +08:00
|
|
|
|
|
|
|
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
|
|
|
{
|
2019-04-05 00:21:53 +08:00
|
|
|
//Note : The lives has to be instaciated here in order to prevent the values from different plays to interfear
|
|
|
|
//with each other / not reseting after a restart , as this method is called once a play starts (to my knowlegde).
|
|
|
|
//This will be better implemented with a List<double> once I know how to reliably get the game time and update it.
|
|
|
|
//If you know any information about that, please contact me because I didn't find a sollution to that.
|
2019-04-05 05:04:49 +08:00
|
|
|
lives = 2;
|
2019-04-04 06:20:20 +08:00
|
|
|
scoreProcessor.Health.ValueChanged += valueChanged =>
|
|
|
|
{
|
2019-04-05 05:04:49 +08:00
|
|
|
if (scoreProcessor.Health.Value == scoreProcessor.Health.MinValue && lives > 0)
|
2019-04-04 04:58:17 +08:00
|
|
|
{
|
2019-04-05 05:04:49 +08:00
|
|
|
lives--;
|
2019-04-05 00:21:53 +08:00
|
|
|
scoreProcessor.Health.Value = scoreProcessor.Health.MaxValue;
|
2019-04-04 04:58:17 +08:00
|
|
|
}
|
2019-04-04 05:05:47 +08:00
|
|
|
};
|
2019-04-04 04:58:17 +08:00
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
}
|
|
|
|
}
|