mirror of
https://github.com/ppy/osu.git
synced 2025-01-08 00:02:54 +08:00
add accuracy challenge mod
This commit is contained in:
parent
41b3fb0df0
commit
dde0756bed
@ -109,6 +109,7 @@ namespace osu.Game.Rulesets.Catch
|
|||||||
new MultiMod(new CatchModDoubleTime(), new CatchModNightcore()),
|
new MultiMod(new CatchModDoubleTime(), new CatchModNightcore()),
|
||||||
new CatchModHidden(),
|
new CatchModHidden(),
|
||||||
new CatchModFlashlight(),
|
new CatchModFlashlight(),
|
||||||
|
//new ModAccuracyChallenge(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.Conversion:
|
case ModType.Conversion:
|
||||||
|
@ -222,6 +222,7 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
new MultiMod(new ManiaModDoubleTime(), new ManiaModNightcore()),
|
new MultiMod(new ManiaModDoubleTime(), new ManiaModNightcore()),
|
||||||
new MultiMod(new ManiaModFadeIn(), new ManiaModHidden()),
|
new MultiMod(new ManiaModFadeIn(), new ManiaModHidden()),
|
||||||
new ManiaModFlashlight(),
|
new ManiaModFlashlight(),
|
||||||
|
//new ModAccuracyChallenge(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.Conversion:
|
case ModType.Conversion:
|
||||||
|
@ -159,7 +159,8 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
new MultiMod(new OsuModDoubleTime(), new OsuModNightcore()),
|
new MultiMod(new OsuModDoubleTime(), new OsuModNightcore()),
|
||||||
new OsuModHidden(),
|
new OsuModHidden(),
|
||||||
new MultiMod(new OsuModFlashlight(), new OsuModBlinds()),
|
new MultiMod(new OsuModFlashlight(), new OsuModBlinds()),
|
||||||
new OsuModStrictTracking()
|
new OsuModStrictTracking(),
|
||||||
|
new ModAccuracyChallenge(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.Conversion:
|
case ModType.Conversion:
|
||||||
|
@ -128,6 +128,7 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
new MultiMod(new TaikoModDoubleTime(), new TaikoModNightcore()),
|
new MultiMod(new TaikoModDoubleTime(), new TaikoModNightcore()),
|
||||||
new TaikoModHidden(),
|
new TaikoModHidden(),
|
||||||
new TaikoModFlashlight(),
|
new TaikoModFlashlight(),
|
||||||
|
//new ModAccuracyChallenge(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.Conversion:
|
case ModType.Conversion:
|
||||||
|
59
osu.Game/Rulesets/Mods/ModAccuracyChallenge.cs
Normal file
59
osu.Game/Rulesets/Mods/ModAccuracyChallenge.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// 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 System.Linq;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Overlays.Settings;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mods
|
||||||
|
{
|
||||||
|
public class ModAccuracyChallenge : ModFailCondition
|
||||||
|
{
|
||||||
|
public override string Name => "Accuracy Challenge";
|
||||||
|
public override string Acronym => "AC";
|
||||||
|
public override string Description => "Fail the map if you don't maintain a certain accuracy.";
|
||||||
|
public override IconUsage? Icon => FontAwesome.Solid.Calculator;
|
||||||
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
|
public override double ScoreMultiplier => 1.0;
|
||||||
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModEasyWithExtraLives)).Append(typeof(ModPerfect)).ToArray();
|
||||||
|
|
||||||
|
[SettingSource("Minimum accuracy", "Trigger a failure if your accuracy goes below this value.", SettingControlType = typeof(SettingsSlider<double, PercentSlider>))]
|
||||||
|
public BindableNumber<double> MinimumAccuracy { get; } = new BindableDouble
|
||||||
|
{
|
||||||
|
MinValue = 0,
|
||||||
|
MaxValue = 1,
|
||||||
|
Precision = 0.01,
|
||||||
|
Default = 0.9,
|
||||||
|
Value = 0.9,
|
||||||
|
};
|
||||||
|
|
||||||
|
private double baseScore;
|
||||||
|
private double maxBaseScore;
|
||||||
|
private double accuracy => maxBaseScore > 0 ? baseScore / maxBaseScore : 1;
|
||||||
|
|
||||||
|
protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result)
|
||||||
|
{
|
||||||
|
if (!result.Type.IsScorable() || result.Type.IsBonus())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
baseScore += result.Type.IsHit() ? result.Judgement.NumericResultFor(result) : 0;
|
||||||
|
maxBaseScore += result.Judgement.MaxNumericResult;
|
||||||
|
|
||||||
|
return accuracy < MinimumAccuracy.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PercentSlider : OsuSliderBar<double>
|
||||||
|
{
|
||||||
|
public PercentSlider()
|
||||||
|
{
|
||||||
|
DisplayAsPercentage = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -19,6 +21,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
};
|
};
|
||||||
|
|
||||||
public override string SettingDescription => Retries.IsDefault ? string.Empty : $"{"lives".ToQuantity(Retries.Value)}";
|
public override string SettingDescription => Retries.IsDefault ? string.Empty : $"{"lives".ToQuantity(Retries.Value)}";
|
||||||
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModAccuracyChallenge)).ToArray();
|
||||||
|
|
||||||
private int retries;
|
private int retries;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public override double ScoreMultiplier => 1;
|
public override double ScoreMultiplier => 1;
|
||||||
public override string Description => "SS or quit.";
|
public override string Description => "SS or quit.";
|
||||||
|
|
||||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModSuddenDeath)).ToArray();
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModSuddenDeath)).Append(typeof(ModAccuracyChallenge)).ToArray();
|
||||||
|
|
||||||
protected ModPerfect()
|
protected ModPerfect()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user