-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using NUnit.Framework.Internal; | ||
using OpenTabletDriver.Plugin; | ||
using osu.Framework.Bindables; | ||
using osu.Game.Graphics; | ||
using osu.Framework.Graphics.Sprites; | ||
using osu.Game.Configuration; | ||
using osu.Game.Rulesets.Judgements; | ||
using osu.Game.Rulesets.Objects.Drawables; | ||
using osu.Game.Rulesets.Scoring; | ||
using osu.Game.Rulesets.UI; | ||
using osu.Game.Scoring; | ||
using Logger = osu.Framework.Logging.Logger; | ||
using LogLevel = osu.Framework.Logging.LogLevel; | ||
|
||
namespace osu.Game.Rulesets.Mods | ||
{ | ||
|
@@ -16,9 +26,17 @@ public abstract class ModHidden : ModWithVisibilityAdjustment, IApplicableToScor | |
public override ModType Type => ModType.DifficultyIncrease; | ||
public override bool Ranked => UsesDefaultConfiguration; | ||
|
||
public virtual void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) | ||
private bool lastShown; | ||
Check failure on line 29 in osu.Game/Rulesets/Mods/ModHidden.cs GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)
Check failure on line 29 in osu.Game/Rulesets/Mods/ModHidden.cs GitHub Actions / Test (Linux, ubuntu-latest, SingleThread)
Check failure on line 29 in osu.Game/Rulesets/Mods/ModHidden.cs GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)
Check failure on line 29 in osu.Game/Rulesets/Mods/ModHidden.cs GitHub Actions / Test (Linux, ubuntu-latest, MultiThreaded)
Check warning on line 29 in osu.Game/Rulesets/Mods/ModHidden.cs GitHub Actions / Build only (iOS)
Check warning on line 29 in osu.Game/Rulesets/Mods/ModHidden.cs GitHub Actions / Build only (iOS)
Check failure on line 29 in osu.Game/Rulesets/Mods/ModHidden.cs GitHub Actions / Code Quality
Check failure on line 29 in osu.Game/Rulesets/Mods/ModHidden.cs GitHub Actions / Test (Windows, windows-latest, MultiThreaded)
Check failure on line 29 in osu.Game/Rulesets/Mods/ModHidden.cs GitHub Actions / Test (Windows, windows-latest, MultiThreaded)
Check failure on line 29 in osu.Game/Rulesets/Mods/ModHidden.cs GitHub Actions / Test (Windows, windows-latest, SingleThread)
|
||
private uint _combo; | ||
private bool Show => _combo < EnableAtCombo.Value; | ||
Check failure on line 31 in osu.Game/Rulesets/Mods/ModHidden.cs GitHub Actions / Code Quality
|
||
|
||
[SettingSource("Enable at combo", "The combo at which the hidden effect will start to take effect.")] | ||
public BindableNumber<int> EnableAtCombo { get; } = new BindableNumber<int>(10) | ||
{ | ||
} | ||
MinValue = 0, | ||
MaxValue = 100, | ||
Precision = 1, | ||
}; | ||
|
||
public virtual ScoreRank AdjustRank(ScoreRank rank, double accuracy) | ||
{ | ||
|
@@ -34,5 +52,26 @@ public virtual ScoreRank AdjustRank(ScoreRank rank, double accuracy) | |
return rank; | ||
} | ||
} | ||
|
||
public virtual void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) | ||
{ | ||
_combo = (uint)EnableAtCombo.Value; | ||
lastShown = false; | ||
|
||
scoreProcessor.NewJudgement += result => ScoreProcessorOnNewJudgement(result); | ||
scoreProcessor.JudgementReverted += result => ScoreProcessorOnNewJudgement(result, true); | ||
|
||
void ScoreProcessorOnNewJudgement(JudgementResult obj, bool revert = false) | ||
Check failure on line 64 in osu.Game/Rulesets/Mods/ModHidden.cs GitHub Actions / Code Quality
|
||
{ | ||
if (revert) return; | ||
uint abs = GetHiddenComboInfluence(obj); | ||
_combo = !obj.IsHit && abs > 0 ? 0 : _combo + abs; | ||
Logger.Log($"Combo: {_combo}", level: LogLevel.Verbose); | ||
} | ||
} | ||
|
||
protected virtual bool OverrideShowHitObjects() => Show; | ||
|
||
protected virtual uint GetHiddenComboInfluence(JudgementResult judgementResult) => 0; | ||
} | ||
} |