mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Remove settings
This commit is contained in:
parent
c7580a5177
commit
b52153e73d
@ -1,7 +1,6 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -11,8 +10,6 @@ using System.Collections.Generic;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||
using osu.Game.Rulesets.Mania.Difficulty;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Tests.Mods
|
||||
{
|
||||
@ -42,24 +39,17 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
|
||||
Assert.AreEqual(noteValues, new List<double> { 0.125, 0.250, 0.500, 1.000, 2.000 });
|
||||
}
|
||||
|
||||
[TestCase(ManiaModHoldOff.BeatDivisors.Whole)]
|
||||
[TestCase(ManiaModHoldOff.BeatDivisors.Half)]
|
||||
[TestCase(ManiaModHoldOff.BeatDivisors.Quarter)]
|
||||
[TestCase(ManiaModHoldOff.BeatDivisors.Eighth)]
|
||||
public void TestCorrectObjectCount(ManiaModHoldOff.BeatDivisors minBeatSnap)
|
||||
[Test]
|
||||
public void TestCorrectObjectCount()
|
||||
{
|
||||
/*
|
||||
This test is to ensure that, given that end notes are enabled,
|
||||
the mod produces the expected number of objects when the mod is applied.
|
||||
*/
|
||||
// Ensure that the mod produces the expected number of objects when applied.
|
||||
|
||||
// Mod settings will be set to include the correct beat snap value
|
||||
var rawBeatmap = createRawBeatmap();
|
||||
var testBeatmap = createModdedBeatmap(minBeatSnap);
|
||||
var testBeatmap = createModdedBeatmap();
|
||||
|
||||
// Calculate expected number of objects
|
||||
int expectedObjectCount = 0;
|
||||
double beatSnapValue = 1 / (Math.Pow(2, (int)minBeatSnap));
|
||||
double beatSnapValue = ManiaModHoldOff.Threshold;
|
||||
|
||||
foreach (ManiaHitObject h in rawBeatmap.HitObjects)
|
||||
{
|
||||
@ -81,44 +71,10 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
|
||||
Assert.That(testBeatmap.HitObjects.Count == expectedObjectCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDifficultyIncrease()
|
||||
{
|
||||
// A lower minimum beat snap divisor should only make the map harder, never easier
|
||||
// (as more notes can be spawned)
|
||||
var beatmaps = new[]
|
||||
{
|
||||
createModdedBeatmap(),
|
||||
createModdedBeatmap(ManiaModHoldOff.BeatDivisors.Half),
|
||||
createModdedBeatmap(ManiaModHoldOff.BeatDivisors.Quarter),
|
||||
createModdedBeatmap(ManiaModHoldOff.BeatDivisors.Eighth),
|
||||
createModdedBeatmap(ManiaModHoldOff.BeatDivisors.Sixteenth)
|
||||
};
|
||||
|
||||
double[] mapDifficulties = new double[beatmaps.Length];
|
||||
|
||||
for (int i = 0; i < mapDifficulties.Length; i++)
|
||||
{
|
||||
var workingBeatmap = new TestWorkingBeatmap(beatmaps[i]);
|
||||
var difficultyCalculator = new ManiaDifficultyCalculator(new ManiaRuleset().RulesetInfo, workingBeatmap);
|
||||
mapDifficulties[i] = difficultyCalculator.Calculate().StarRating;
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
Assert.LessOrEqual(mapDifficulties[i - 1], mapDifficulties[i]);
|
||||
Assert.LessOrEqual(beatmaps[i - 1].HitObjects.Count, beatmaps[i].HitObjects.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static ManiaBeatmap createModdedBeatmap(ManiaModHoldOff.BeatDivisors minBeatSnap = ManiaModHoldOff.BeatDivisors.Whole)
|
||||
private static ManiaBeatmap createModdedBeatmap()
|
||||
{
|
||||
var beatmap = createRawBeatmap();
|
||||
var holdOffMod = new ManiaModHoldOff
|
||||
{
|
||||
MinBeatSnap = { Value = minBeatSnap }
|
||||
};
|
||||
Assert.AreEqual(holdOffMod.MinBeatSnap.Value, minBeatSnap);
|
||||
var holdOffMod = new ManiaModHoldOff();
|
||||
|
||||
foreach (var hitObject in beatmap.HitObjects)
|
||||
hitObject.ApplyDefaults(beatmap.ControlPointInfo, new BeatmapDifficulty());
|
||||
|
@ -6,11 +6,8 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Configuration;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Mods
|
||||
{
|
||||
@ -27,23 +24,13 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
public override IconUsage? Icon => FontAwesome.Solid.DotCircle;
|
||||
|
||||
public override ModType Type => ModType.Conversion;
|
||||
|
||||
[SettingSource("Add end notes", "Also add a note at the end of a hold note")]
|
||||
public BindableBool AddEndNotes { get; } = new BindableBool
|
||||
{
|
||||
Default = true,
|
||||
Value = true
|
||||
};
|
||||
|
||||
[SettingSource("Minimum end note beat snap", "Don't add end notes for hold notes shorter than this beat division")]
|
||||
public Bindable<BeatDivisors> MinBeatSnap { get; } = new Bindable<BeatDivisors>(defaultValue: BeatDivisors.Half);
|
||||
public const double Threshold = 1/2;
|
||||
|
||||
public void ApplyToBeatmap(IBeatmap beatmap)
|
||||
{
|
||||
var maniaBeatmap = (ManiaBeatmap)beatmap;
|
||||
|
||||
var newObjects = new List<ManiaHitObject>();
|
||||
double beatSnap = 1 / (Math.Pow(2, (double)MinBeatSnap.Value));
|
||||
|
||||
foreach (var h in beatmap.HitObjects.OfType<HoldNote>())
|
||||
{
|
||||
@ -55,10 +42,10 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
Samples = h.GetNodeSamples(0)
|
||||
});
|
||||
|
||||
// Don't add an end note if the duration is shorter than some threshold, or end notes are disabled
|
||||
// Don't add an end note if the duration is shorter than the threshold
|
||||
double noteValue = GetNoteDurationInBeatLength(h, maniaBeatmap); // 1/1, 1/2, 1/4, etc.
|
||||
|
||||
if (AddEndNotes.Value && noteValue >= beatSnap)
|
||||
if (noteValue >= Threshold)
|
||||
{
|
||||
newObjects.Add(new Note
|
||||
{
|
||||
@ -77,14 +64,5 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
double bpmAtNoteTime = beatmap.ControlPointInfo.TimingPointAt(holdNote.StartTime).BPM;
|
||||
return (60 * holdNote.Duration) / (1000 * bpmAtNoteTime);
|
||||
}
|
||||
|
||||
public enum BeatDivisors
|
||||
{
|
||||
Whole,
|
||||
Half,
|
||||
Quarter,
|
||||
Eighth,
|
||||
Sixteenth
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user