mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 14:03:21 +08:00
Merge branch 'master' into add-button-tooltip
This commit is contained in:
commit
96590156cd
5
.gitignore
vendored
5
.gitignore
vendored
@ -11,8 +11,9 @@
|
||||
*.userprefs
|
||||
|
||||
### Cake ###
|
||||
tools/*
|
||||
!tools/cakebuild.csproj
|
||||
tools/**
|
||||
build/tools/**
|
||||
|
||||
|
||||
# Build results
|
||||
bin/[Dd]ebug/
|
||||
|
14
.vscode/launch.json
vendored
14
.vscode/launch.json
vendored
@ -68,6 +68,20 @@
|
||||
}
|
||||
},
|
||||
"console": "internalConsole"
|
||||
},
|
||||
{
|
||||
"name": "Cake: Debug Script",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/build/tools/Cake.CoreCLR/0.30.0/Cake.dll",
|
||||
"args": [
|
||||
"${workspaceRoot}/build/build.cake",
|
||||
"--debug",
|
||||
"--verbosity=diagnostic"
|
||||
],
|
||||
"cwd": "${workspaceRoot}/build",
|
||||
"stopAtEntry": true,
|
||||
"externalConsole": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
13
build.ps1
13
build.ps1
@ -41,27 +41,28 @@ Param(
|
||||
[switch]$ShowDescription,
|
||||
[Alias("WhatIf", "Noop")]
|
||||
[switch]$DryRun,
|
||||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
|
||||
[Parameter(Position = 0, Mandatory = $false, ValueFromRemainingArguments = $true)]
|
||||
[string[]]$ScriptArgs
|
||||
)
|
||||
|
||||
Write-Host "Preparing to run build script..."
|
||||
|
||||
# Determine the script root for resolving other paths.
|
||||
if(!$PSScriptRoot){
|
||||
if(!$PSScriptRoot) {
|
||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
}
|
||||
|
||||
# Resolve the paths for resources used for debugging.
|
||||
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
|
||||
$CAKE_CSPROJ = Join-Path $TOOLS_DIR "cakebuild.csproj"
|
||||
$BUILD_DIR = Join-Path $PSScriptRoot "build"
|
||||
$TOOLS_DIR = Join-Path $BUILD_DIR "tools"
|
||||
$CAKE_CSPROJ = Join-Path $BUILD_DIR "cakebuild.csproj"
|
||||
|
||||
# Install the required tools locally.
|
||||
Write-Host "Restoring cake tools..."
|
||||
Invoke-Expression "dotnet restore `"$CAKE_CSPROJ`" --packages `"$TOOLS_DIR`"" | Out-Null
|
||||
|
||||
# Find the Cake executable
|
||||
$CAKE_EXECUTABLE = (Get-ChildItem -Path ./tools/cake.coreclr/ -Filter Cake.dll -Recurse).FullName
|
||||
$CAKE_EXECUTABLE = (Get-ChildItem -Path "$TOOLS_DIR/cake.coreclr/" -Filter Cake.dll -Recurse).FullName
|
||||
|
||||
# Build Cake arguments
|
||||
$cakeArguments = @("$Script");
|
||||
@ -75,5 +76,7 @@ $cakeArguments += $ScriptArgs
|
||||
|
||||
# Start Cake
|
||||
Write-Host "Running build script..."
|
||||
Push-Location -Path $BUILD_DIR
|
||||
Invoke-Expression "dotnet `"$CAKE_EXECUTABLE`" $cakeArguments"
|
||||
Pop-Location
|
||||
exit $LASTEXITCODE
|
||||
|
3
build.sh
3
build.sh
@ -6,12 +6,13 @@
|
||||
|
||||
echo "Preparing to run build script..."
|
||||
|
||||
cd build
|
||||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
TOOLS_DIR=$SCRIPT_DIR/tools
|
||||
CAKE_BINARY_PATH=$TOOLS_DIR/"cake.coreclr"
|
||||
|
||||
SCRIPT="build.cake"
|
||||
CAKE_CSPROJ=$TOOLS_DIR/"cakebuild.csproj"
|
||||
CAKE_CSPROJ=$SCRIPT_DIR/"cakebuild.csproj"
|
||||
|
||||
# Parse arguments.
|
||||
CAKE_ARGUMENTS=()
|
||||
|
@ -1,6 +1,7 @@
|
||||
#addin "nuget:?package=CodeFileSanity&version=0.0.21"
|
||||
#addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2018.2.2"
|
||||
#tool "nuget:?package=NVika.MSBuild&version=1.0.1"
|
||||
var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ARGUMENTS
|
||||
@ -9,30 +10,24 @@
|
||||
var target = Argument("target", "Build");
|
||||
var configuration = Argument("configuration", "Release");
|
||||
|
||||
var osuSolution = new FilePath("./osu.sln");
|
||||
var rootDirectory = new DirectoryPath("..");
|
||||
var solution = rootDirectory.CombineWithFilePath("osu.sln");
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// TASKS
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task("Restore")
|
||||
.Does(() => {
|
||||
DotNetCoreRestore(osuSolution.FullPath);
|
||||
});
|
||||
|
||||
Task("Compile")
|
||||
.IsDependentOn("Restore")
|
||||
.Does(() => {
|
||||
DotNetCoreBuild(osuSolution.FullPath, new DotNetCoreBuildSettings {
|
||||
DotNetCoreBuild(solution.FullPath, new DotNetCoreBuildSettings {
|
||||
Configuration = configuration,
|
||||
NoRestore = true,
|
||||
});
|
||||
});
|
||||
|
||||
Task("Test")
|
||||
.IsDependentOn("Compile")
|
||||
.Does(() => {
|
||||
var testAssemblies = GetFiles("**/*.Tests/bin/**/*.Tests.dll");
|
||||
var testAssemblies = GetFiles(rootDirectory + "/**/*.Tests/bin/**/*.Tests.dll");
|
||||
|
||||
DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings {
|
||||
Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx",
|
||||
@ -46,9 +41,7 @@ Task("InspectCode")
|
||||
.WithCriteria(IsRunningOnWindows())
|
||||
.IsDependentOn("Compile")
|
||||
.Does(() => {
|
||||
var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First();
|
||||
|
||||
InspectCode(osuSolution, new InspectCodeSettings {
|
||||
InspectCode(solution, new InspectCodeSettings {
|
||||
CachesHome = "inspectcode",
|
||||
OutputFile = "inspectcodereport.xml",
|
||||
});
|
||||
@ -59,7 +52,7 @@ Task("InspectCode")
|
||||
Task("CodeFileSanity")
|
||||
.Does(() => {
|
||||
ValidateCodeSanity(new ValidateCodeSanitySettings {
|
||||
RootDirectory = ".",
|
||||
RootDirectory = rootDirectory.FullPath,
|
||||
IsAppveyorBuild = AppVeyor.IsRunningOnAppVeyor
|
||||
});
|
||||
});
|
@ -0,0 +1,24 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Catch.Difficulty;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Tests
|
||||
{
|
||||
public class CatchDifficultyCalculatorTest : DifficultyCalculatorTest
|
||||
{
|
||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Catch";
|
||||
|
||||
[TestCase(3.8701854263563118d, "diffcalc-test")]
|
||||
public void Test(double expected, string name)
|
||||
=> base.Test(expected, name);
|
||||
|
||||
protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchDifficultyCalculator(new CatchRuleset(), beatmap);
|
||||
|
||||
protected override Ruleset CreateRuleset() => new CatchRuleset();
|
||||
}
|
||||
}
|
@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Catch
|
||||
|
||||
public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_fruits_o };
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchDifficultyCalculator(this, beatmap);
|
||||
public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchDifficultyCalculator(this, beatmap);
|
||||
|
||||
public override int? LegacyID => 2;
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Difficulty
|
||||
{
|
||||
@ -10,10 +9,5 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
||||
{
|
||||
public double ApproachRate;
|
||||
public int MaxCombo;
|
||||
|
||||
public CatchDifficultyAttributes(Mod[] mods, double starRating)
|
||||
: base(mods, starRating)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,148 +1,86 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Catch.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Catch.Difficulty.Skills;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Catch.UI;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Difficulty.Skills;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Difficulty
|
||||
{
|
||||
public class CatchDifficultyCalculator : DifficultyCalculator
|
||||
{
|
||||
/// <summary>
|
||||
/// In milliseconds. For difficulty calculation we will only look at the highest strain value in each time interval of size STRAIN_STEP.
|
||||
/// This is to eliminate higher influence of stream over aim by simply having more HitObjects with high strain.
|
||||
/// The higher this value, the less strains there will be, indirectly giving long beatmaps an advantage.
|
||||
/// </summary>
|
||||
private const double strain_step = 750;
|
||||
|
||||
/// <summary>
|
||||
/// The weighting of each strain value decays to this number * it's previous value
|
||||
/// </summary>
|
||||
private const double decay_weight = 0.94;
|
||||
|
||||
private const double star_scaling_factor = 0.145;
|
||||
|
||||
protected override int SectionLength => 750;
|
||||
|
||||
private readonly float halfCatchWidth;
|
||||
|
||||
public CatchDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||
: base(ruleset, beatmap)
|
||||
{
|
||||
var catcher = new CatcherArea.Catcher(beatmap.BeatmapInfo.BaseDifficulty);
|
||||
halfCatchWidth = catcher.CatchWidth * 0.5f;
|
||||
}
|
||||
|
||||
protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate)
|
||||
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
|
||||
{
|
||||
if (!beatmap.HitObjects.Any())
|
||||
return new CatchDifficultyAttributes(mods, 0);
|
||||
if (beatmap.HitObjects.Count == 0)
|
||||
return new CatchDifficultyAttributes { Mods = mods };
|
||||
|
||||
var catcher = new CatcherArea.Catcher(beatmap.BeatmapInfo.BaseDifficulty);
|
||||
float halfCatchWidth = catcher.CatchWidth * 0.5f;
|
||||
// this is the same as osu!, so there's potential to share the implementation... maybe
|
||||
double preempt = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / clockRate;
|
||||
|
||||
var difficultyHitObjects = new List<CatchDifficultyHitObject>();
|
||||
|
||||
foreach (var hitObject in beatmap.HitObjects)
|
||||
return new CatchDifficultyAttributes
|
||||
{
|
||||
StarRating = Math.Sqrt(skills[0].DifficultyValue()) * star_scaling_factor,
|
||||
Mods = mods,
|
||||
ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0,
|
||||
MaxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType<JuiceStream>().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet))
|
||||
};
|
||||
}
|
||||
|
||||
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
||||
{
|
||||
CatchHitObject lastObject = null;
|
||||
|
||||
foreach (var hitObject in beatmap.HitObjects.OfType<CatchHitObject>())
|
||||
{
|
||||
if (lastObject == null)
|
||||
{
|
||||
lastObject = hitObject;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (hitObject)
|
||||
{
|
||||
// We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations.
|
||||
case Fruit fruit:
|
||||
difficultyHitObjects.Add(new CatchDifficultyHitObject(fruit, halfCatchWidth));
|
||||
yield return new CatchDifficultyHitObject(fruit, lastObject, clockRate, halfCatchWidth);
|
||||
lastObject = hitObject;
|
||||
break;
|
||||
case JuiceStream _:
|
||||
difficultyHitObjects.AddRange(hitObject.NestedHitObjects.OfType<CatchHitObject>().Where(o => !(o is TinyDroplet)).Select(o => new CatchDifficultyHitObject(o, halfCatchWidth)));
|
||||
foreach (var nested in hitObject.NestedHitObjects.OfType<CatchHitObject>().Where(o => !(o is TinyDroplet)))
|
||||
{
|
||||
yield return new CatchDifficultyHitObject(nested, lastObject, clockRate, halfCatchWidth);
|
||||
lastObject = nested;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
difficultyHitObjects.Sort((a, b) => a.BaseHitObject.StartTime.CompareTo(b.BaseHitObject.StartTime));
|
||||
|
||||
if (!calculateStrainValues(difficultyHitObjects, timeRate))
|
||||
return new CatchDifficultyAttributes(mods, 0);
|
||||
|
||||
// this is the same as osu!, so there's potential to share the implementation... maybe
|
||||
double preempt = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate;
|
||||
double starRating = Math.Sqrt(calculateDifficulty(difficultyHitObjects, timeRate)) * star_scaling_factor;
|
||||
|
||||
return new CatchDifficultyAttributes(mods, starRating)
|
||||
{
|
||||
ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0,
|
||||
MaxCombo = difficultyHitObjects.Count
|
||||
};
|
||||
}
|
||||
|
||||
private bool calculateStrainValues(List<CatchDifficultyHitObject> objects, double timeRate)
|
||||
protected override Skill[] CreateSkills(IBeatmap beatmap) => new Skill[]
|
||||
{
|
||||
CatchDifficultyHitObject lastObject = null;
|
||||
|
||||
if (!objects.Any()) return false;
|
||||
|
||||
// Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment.
|
||||
foreach (var currentObject in objects)
|
||||
{
|
||||
if (lastObject != null)
|
||||
currentObject.CalculateStrains(lastObject, timeRate);
|
||||
|
||||
lastObject = currentObject;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private double calculateDifficulty(List<CatchDifficultyHitObject> objects, double timeRate)
|
||||
{
|
||||
// The strain step needs to be adjusted for the algorithm to be considered equal with speed changing mods
|
||||
double actualStrainStep = strain_step * timeRate;
|
||||
|
||||
// Find the highest strain value within each strain step
|
||||
var highestStrains = new List<double>();
|
||||
double intervalEndTime = actualStrainStep;
|
||||
double maximumStrain = 0; // We need to keep track of the maximum strain in the current interval
|
||||
|
||||
CatchDifficultyHitObject previousHitObject = null;
|
||||
foreach (CatchDifficultyHitObject hitObject in objects)
|
||||
{
|
||||
// While we are beyond the current interval push the currently available maximum to our strain list
|
||||
while (hitObject.BaseHitObject.StartTime > intervalEndTime)
|
||||
{
|
||||
highestStrains.Add(maximumStrain);
|
||||
|
||||
// The maximum strain of the next interval is not zero by default! We need to take the last hitObject we encountered, take its strain and apply the decay
|
||||
// until the beginning of the next interval.
|
||||
if (previousHitObject == null)
|
||||
{
|
||||
maximumStrain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
double decay = Math.Pow(CatchDifficultyHitObject.DECAY_BASE, (intervalEndTime - previousHitObject.BaseHitObject.StartTime) / 1000);
|
||||
maximumStrain = previousHitObject.Strain * decay;
|
||||
}
|
||||
|
||||
// Go to the next time interval
|
||||
intervalEndTime += actualStrainStep;
|
||||
}
|
||||
|
||||
// Obtain maximum strain
|
||||
maximumStrain = Math.Max(hitObject.Strain, maximumStrain);
|
||||
|
||||
previousHitObject = hitObject;
|
||||
}
|
||||
|
||||
// Build the weighted sum over the highest strains for each interval
|
||||
double difficulty = 0;
|
||||
double weight = 1;
|
||||
highestStrains.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain.
|
||||
|
||||
foreach (double strain in highestStrains)
|
||||
{
|
||||
difficulty += weight * strain;
|
||||
weight *= decay_weight;
|
||||
}
|
||||
|
||||
return difficulty;
|
||||
}
|
||||
new Movement(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,130 +0,0 @@
|
||||
// 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.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Catch.UI;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Difficulty
|
||||
{
|
||||
public class CatchDifficultyHitObject
|
||||
{
|
||||
internal static readonly double DECAY_BASE = 0.20;
|
||||
private const float normalized_hitobject_radius = 41.0f;
|
||||
private const float absolute_player_positioning_error = 16f;
|
||||
private readonly float playerPositioningError;
|
||||
|
||||
internal CatchHitObject BaseHitObject;
|
||||
|
||||
/// <summary>
|
||||
/// Measures jump difficulty. CtB doesn't have something like button pressing speed or accuracy
|
||||
/// </summary>
|
||||
internal double Strain = 1;
|
||||
|
||||
/// <summary>
|
||||
/// This is required to keep track of lazy player movement (always moving only as far as necessary)
|
||||
/// Without this quick repeat sliders / weirdly shaped streams might become ridiculously overrated
|
||||
/// </summary>
|
||||
internal float PlayerPositionOffset;
|
||||
internal float LastMovement;
|
||||
|
||||
internal float NormalizedPosition;
|
||||
internal float ActualNormalizedPosition => NormalizedPosition + PlayerPositionOffset;
|
||||
|
||||
internal CatchDifficultyHitObject(CatchHitObject baseHitObject, float catcherWidthHalf)
|
||||
{
|
||||
BaseHitObject = baseHitObject;
|
||||
|
||||
// We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps.
|
||||
float scalingFactor = normalized_hitobject_radius / catcherWidthHalf;
|
||||
|
||||
playerPositioningError = absolute_player_positioning_error; // * scalingFactor;
|
||||
NormalizedPosition = baseHitObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor;
|
||||
}
|
||||
|
||||
private const double direction_change_bonus = 12.5;
|
||||
internal void CalculateStrains(CatchDifficultyHitObject previousHitObject, double timeRate)
|
||||
{
|
||||
// Rather simple, but more specialized things are inherently inaccurate due to the big difference playstyles and opinions make.
|
||||
// See Taiko feedback thread.
|
||||
double timeElapsed = (BaseHitObject.StartTime - previousHitObject.BaseHitObject.StartTime) / timeRate;
|
||||
double decay = Math.Pow(DECAY_BASE, timeElapsed / 1000);
|
||||
|
||||
// Update new position with lazy movement.
|
||||
PlayerPositionOffset =
|
||||
MathHelper.Clamp(
|
||||
previousHitObject.ActualNormalizedPosition,
|
||||
NormalizedPosition - (normalized_hitobject_radius - playerPositioningError),
|
||||
NormalizedPosition + (normalized_hitobject_radius - playerPositioningError)) // Obtain new lazy position, but be stricter by allowing for an error of a certain degree of the player.
|
||||
- NormalizedPosition; // Subtract HitObject position to obtain offset
|
||||
|
||||
LastMovement = DistanceTo(previousHitObject);
|
||||
double addition = spacingWeight(LastMovement);
|
||||
|
||||
if (NormalizedPosition < previousHitObject.NormalizedPosition)
|
||||
{
|
||||
LastMovement = -LastMovement;
|
||||
}
|
||||
|
||||
CatchHitObject previousHitCircle = previousHitObject.BaseHitObject;
|
||||
|
||||
double additionBonus = 0;
|
||||
double sqrtTime = Math.Sqrt(Math.Max(timeElapsed, 25));
|
||||
|
||||
// Direction changes give an extra point!
|
||||
if (Math.Abs(LastMovement) > 0.1)
|
||||
{
|
||||
if (Math.Abs(previousHitObject.LastMovement) > 0.1 && Math.Sign(LastMovement) != Math.Sign(previousHitObject.LastMovement))
|
||||
{
|
||||
double bonus = direction_change_bonus / sqrtTime;
|
||||
|
||||
// Weight bonus by how
|
||||
double bonusFactor = Math.Min(playerPositioningError, Math.Abs(LastMovement)) / playerPositioningError;
|
||||
|
||||
// We want time to play a role twice here!
|
||||
addition += bonus * bonusFactor;
|
||||
|
||||
// Bonus for tougher direction switches and "almost" hyperdashes at this point
|
||||
if (previousHitCircle != null && previousHitCircle.DistanceToHyperDash <= 10.0f / CatchPlayfield.BASE_WIDTH)
|
||||
{
|
||||
additionBonus += 0.3 * bonusFactor;
|
||||
}
|
||||
}
|
||||
|
||||
// Base bonus for every movement, giving some weight to streams.
|
||||
addition += 7.5 * Math.Min(Math.Abs(LastMovement), normalized_hitobject_radius * 2) / (normalized_hitobject_radius * 6) / sqrtTime;
|
||||
}
|
||||
|
||||
// Bonus for "almost" hyperdashes at corner points
|
||||
if (previousHitCircle != null && previousHitCircle.DistanceToHyperDash <= 10.0f / CatchPlayfield.BASE_WIDTH)
|
||||
{
|
||||
if (!previousHitCircle.HyperDash)
|
||||
{
|
||||
additionBonus += 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// After a hyperdash we ARE in the correct position. Always!
|
||||
PlayerPositionOffset = 0;
|
||||
}
|
||||
|
||||
addition *= 1.0 + additionBonus * ((10 - previousHitCircle.DistanceToHyperDash * CatchPlayfield.BASE_WIDTH) / 10);
|
||||
}
|
||||
|
||||
addition *= 850.0 / Math.Max(timeElapsed, 25);
|
||||
|
||||
Strain = previousHitObject.Strain * decay + addition;
|
||||
}
|
||||
|
||||
private static double spacingWeight(float distance)
|
||||
{
|
||||
return Math.Pow(distance, 1.3) / 500;
|
||||
}
|
||||
|
||||
internal float DistanceTo(CatchDifficultyHitObject other)
|
||||
{
|
||||
return Math.Abs(ActualNormalizedPosition - other.ActualNormalizedPosition);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
// 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.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Catch.UI;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing
|
||||
{
|
||||
public class CatchDifficultyHitObject : DifficultyHitObject
|
||||
{
|
||||
private const float normalized_hitobject_radius = 41.0f;
|
||||
|
||||
public new CatchHitObject BaseObject => (CatchHitObject)base.BaseObject;
|
||||
|
||||
public new CatchHitObject LastObject => (CatchHitObject)base.LastObject;
|
||||
|
||||
public readonly float NormalizedPosition;
|
||||
|
||||
/// <summary>
|
||||
/// Milliseconds elapsed since the start time of the previous <see cref="CatchDifficultyHitObject"/>, with a minimum of 25ms.
|
||||
/// </summary>
|
||||
public readonly double StrainTime;
|
||||
|
||||
public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth)
|
||||
: base(hitObject, lastObject, clockRate)
|
||||
{
|
||||
// We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps.
|
||||
var scalingFactor = normalized_hitobject_radius / halfCatcherWidth;
|
||||
|
||||
NormalizedPosition = BaseObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor;
|
||||
|
||||
// Every strain interval is hard capped at the equivalent of 600 BPM streaming speed as a safety measure
|
||||
StrainTime = Math.Max(25, DeltaTime);
|
||||
}
|
||||
}
|
||||
}
|
82
osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs
Normal file
82
osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs
Normal file
@ -0,0 +1,82 @@
|
||||
// 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.Game.Rulesets.Catch.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Catch.UI;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Difficulty.Skills;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Difficulty.Skills
|
||||
{
|
||||
public class Movement : Skill
|
||||
{
|
||||
private const float absolute_player_positioning_error = 16f;
|
||||
private const float normalized_hitobject_radius = 41.0f;
|
||||
private const double direction_change_bonus = 12.5;
|
||||
|
||||
protected override double SkillMultiplier => 850;
|
||||
protected override double StrainDecayBase => 0.2;
|
||||
|
||||
protected override double DecayWeight => 0.94;
|
||||
|
||||
private float lastPlayerPosition;
|
||||
private float lastDistanceMoved;
|
||||
|
||||
protected override double StrainValueOf(DifficultyHitObject current)
|
||||
{
|
||||
var catchCurrent = (CatchDifficultyHitObject)current;
|
||||
|
||||
float playerPosition = MathHelper.Clamp(
|
||||
lastPlayerPosition,
|
||||
catchCurrent.NormalizedPosition - (normalized_hitobject_radius - absolute_player_positioning_error),
|
||||
catchCurrent.NormalizedPosition + (normalized_hitobject_radius - absolute_player_positioning_error)
|
||||
);
|
||||
|
||||
float distanceMoved = playerPosition - lastPlayerPosition;
|
||||
|
||||
double distanceAddition = Math.Pow(Math.Abs(distanceMoved), 1.3) / 500;
|
||||
double sqrtStrain = Math.Sqrt(catchCurrent.StrainTime);
|
||||
|
||||
double bonus = 0;
|
||||
|
||||
// Direction changes give an extra point!
|
||||
if (Math.Abs(distanceMoved) > 0.1)
|
||||
{
|
||||
if (Math.Abs(lastDistanceMoved) > 0.1 && Math.Sign(distanceMoved) != Math.Sign(lastDistanceMoved))
|
||||
{
|
||||
double bonusFactor = Math.Min(absolute_player_positioning_error, Math.Abs(distanceMoved)) / absolute_player_positioning_error;
|
||||
|
||||
distanceAddition += direction_change_bonus / sqrtStrain * bonusFactor;
|
||||
|
||||
// Bonus for tougher direction switches and "almost" hyperdashes at this point
|
||||
if (catchCurrent.LastObject.DistanceToHyperDash <= 10 / CatchPlayfield.BASE_WIDTH)
|
||||
bonus = 0.3 * bonusFactor;
|
||||
}
|
||||
|
||||
// Base bonus for every movement, giving some weight to streams.
|
||||
distanceAddition += 7.5 * Math.Min(Math.Abs(distanceMoved), normalized_hitobject_radius * 2) / (normalized_hitobject_radius * 6) / sqrtStrain;
|
||||
}
|
||||
|
||||
// Bonus for "almost" hyperdashes at corner points
|
||||
if (catchCurrent.LastObject.DistanceToHyperDash <= 10.0f / CatchPlayfield.BASE_WIDTH)
|
||||
{
|
||||
if (!catchCurrent.LastObject.HyperDash)
|
||||
bonus += 1.0;
|
||||
else
|
||||
{
|
||||
// After a hyperdash we ARE in the correct position. Always!
|
||||
playerPosition = catchCurrent.NormalizedPosition;
|
||||
}
|
||||
|
||||
distanceAddition *= 1.0 + bonus * ((10 - catchCurrent.LastObject.DistanceToHyperDash * CatchPlayfield.BASE_WIDTH) / 10);
|
||||
}
|
||||
|
||||
lastPlayerPosition = playerPosition;
|
||||
lastDistanceMoved = distanceMoved;
|
||||
|
||||
return distanceAddition / catchCurrent.StrainTime;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
osu file format v14
|
||||
|
||||
[General]
|
||||
StackLeniency: 0.3
|
||||
Mode: 2
|
||||
|
||||
[Difficulty]
|
||||
CircleSize:4
|
||||
OverallDifficulty:7
|
||||
ApproachRate:8.3
|
||||
SliderMultiplier:1.6
|
||||
SliderTickRate:1
|
||||
|
||||
[TimingPoints]
|
||||
500,500,4,2,1,50,1,0
|
||||
34500,-50,4,2,1,50,0,0
|
||||
|
||||
[HitObjects]
|
||||
// fruits spaced 1/1 beat apart
|
||||
32,128,0,5,0,0:0:0:0:
|
||||
96,128,500,1,0,0:0:0:0:
|
||||
160,128,1000,1,0,0:0:0:0:
|
||||
224,128,1500,1,0,0:0:0:0:
|
||||
288,128,2000,1,0,0:0:0:0:
|
||||
352,128,2500,1,0,0:0:0:0:
|
||||
416,128,3000,1,0,0:0:0:0:
|
||||
480,128,3500,1,0,0:0:0:0:
|
||||
|
||||
// fruits spaced 1/2 beat apart
|
||||
32,160,4500,1,0,0:0:0:0:
|
||||
64,160,4750,1,0,0:0:0:0:
|
||||
96,160,5000,1,0,0:0:0:0:
|
||||
128,160,5250,1,0,0:0:0:0:
|
||||
160,160,5500,1,0,0:0:0:0:
|
||||
192,160,5750,1,0,0:0:0:0:
|
||||
224,160,6000,1,0,0:0:0:0:
|
||||
256,160,6250,1,0,0:0:0:0:
|
||||
288,160,6500,1,0,0:0:0:0:
|
||||
|
||||
// fruits spaced 1/4 beat apart
|
||||
96,128,7500,1,0,0:0:0:0:
|
||||
128,128,7625,1,0,0:0:0:0:
|
||||
160,128,7750,1,0,0:0:0:0:
|
||||
192,128,7875,1,0,0:0:0:0:
|
||||
224,128,8000,1,0,0:0:0:0:
|
||||
256,128,8125,1,0,0:0:0:0:
|
||||
288,128,8250,1,0,0:0:0:0:
|
||||
320,128,8375,1,0,0:0:0:0:
|
||||
352,128,8500,1,0,0:0:0:0:
|
||||
|
||||
// fruit hyperdashes, spaced 1/2 beat apart
|
||||
32,160,9500,1,0,0:0:0:0:
|
||||
480,160,9750,1,0,0:0:0:0:
|
||||
32,160,10000,1,0,0:0:0:0:
|
||||
480,160,10250,1,0,0:0:0:0:
|
||||
32,160,10500,1,0,0:0:0:0:
|
||||
480,160,10750,1,0,0:0:0:0:
|
||||
32,160,11000,1,0,0:0:0:0:
|
||||
|
||||
// fruit hyperdashes, spaced 1/4 beat apart
|
||||
32,192,12000,1,0,0:0:0:0:
|
||||
480,192,12125,1,0,0:0:0:0:
|
||||
32,192,12250,1,0,0:0:0:0:
|
||||
480,192,12375,1,0,0:0:0:0:
|
||||
32,192,12500,1,0,0:0:0:0:
|
||||
480,192,12625,1,0,0:0:0:0:
|
||||
32,192,12750,1,0,0:0:0:0:
|
||||
480,192,12875,1,0,0:0:0:0:
|
||||
32,192,13000,1,0,0:0:0:0:
|
||||
|
||||
// stream + hyperdash + stream, spaced 1/4 beat apart
|
||||
32,192,14000,1,0,0:0:0:0:
|
||||
64,192,14125,1,0,0:0:0:0:
|
||||
96,192,14250,1,0,0:0:0:0:
|
||||
128,192,14375,1,0,0:0:0:0:
|
||||
480,192,14500,1,0,0:0:0:0:
|
||||
448,192,14625,1,0,0:0:0:0:
|
||||
416,192,14750,1,0,0:0:0:0:
|
||||
384,192,14875,1,0,0:0:0:0:
|
||||
32,192,15000,1,0,0:0:0:0:
|
||||
|
||||
// basic sliders
|
||||
32,192,16000,2,0,L|192:192,1,160
|
||||
224,192,17000,2,0,L|384:192,1,160
|
||||
416,192,17875,2,0,L|480:192,1,40
|
||||
|
||||
// slider hyperdashes, spaced 1/4 beat apart
|
||||
32,192,19000,2,0,L|128:192,1,80
|
||||
480,192,19375,2,0,L|384:192,1,80
|
||||
352,192,19750,2,0,L|256:192,1,80
|
||||
0,192,20125,2,0,L|128:192,1,120
|
||||
|
||||
// stream + slider hyperdashes, spaced 1/4 beat apart
|
||||
32,192,21500,1,0,0:0:0:0:
|
||||
64,192,21625,1,0,0:0:0:0:
|
||||
96,192,21750,1,0,0:0:0:0:
|
||||
512,192,21875,2,0,L|320:192,1,160
|
||||
320,192,22500,1,0,0:0:0:0:
|
||||
288,192,22625,1,0,0:0:0:0:
|
||||
256,192,22750,1,0,0:0:0:0:
|
||||
0,192,22875,2,0,L|64:192,1,40
|
||||
|
||||
// streams, spaced 1/4 beat apart
|
||||
64,192,24000,1,0,0:0:0:0:
|
||||
160,192,24125,1,0,0:0:0:0:
|
||||
64,192,24250,1,0,0:0:0:0:
|
||||
160,192,24375,1,0,0:0:0:0:
|
||||
64,192,24500,1,0,0:0:0:0:
|
||||
160,192,24625,1,0,0:0:0:0:
|
||||
64,192,24750,1,0,0:0:0:0:
|
||||
160,192,24875,1,0,0:0:0:0:
|
||||
64,192,25000,1,0,0:0:0:0:
|
||||
160,192,25125,1,0,0:0:0:0:
|
||||
64,192,25250,1,0,0:0:0:0:
|
||||
160,192,25375,1,0,0:0:0:0:
|
||||
64,192,25500,1,0,0:0:0:0:
|
||||
|
||||
// stream + spinner combo, spaced 1/4 beat apart
|
||||
256,192,26500,12,0,27000,0:0:0:0:
|
||||
128,192,27250,5,0,0:0:0:0:
|
||||
128,192,27375,1,0,0:0:0:0:
|
||||
160,192,27500,1,0,0:0:0:0:
|
||||
192,192,27625,1,0,0:0:0:0:
|
||||
256,192,27750,12,0,28500,0:0:0:0:
|
||||
192,192,28625,5,0,0:0:0:0:
|
||||
224,192,28750,1,0,0:0:0:0:
|
||||
256,192,28875,1,0,0:0:0:0:
|
||||
256,192,29000,1,0,0:0:0:0:
|
||||
256,192,29125,12,0,29500,0:0:0:0:
|
||||
|
||||
// long slow slider
|
||||
0,192,30500,6,0,B|480:192|480:192|0:192,2,960
|
||||
|
||||
// long fast slider
|
||||
0,192,37500,6,0,B|480:192|480:192|0:192,2,960
|
||||
|
||||
// long hyperdash slider
|
||||
0,192,41500,2,0,P|544:192|544:192,5,480
|
@ -0,0 +1,24 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Mania.Difficulty;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Tests
|
||||
{
|
||||
public class ManiaDifficultyCalculatorTest : DifficultyCalculatorTest
|
||||
{
|
||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Mania";
|
||||
|
||||
[TestCase(2.3683365342338796d, "diffcalc-test")]
|
||||
public void Test(double expected, string name)
|
||||
=> base.Test(expected, name);
|
||||
|
||||
protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaDifficultyCalculator(new ManiaRuleset(), beatmap);
|
||||
|
||||
protected override Ruleset CreateRuleset() => new ManiaRuleset();
|
||||
}
|
||||
}
|
@ -2,17 +2,11 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Difficulty
|
||||
{
|
||||
public class ManiaDifficultyAttributes : DifficultyAttributes
|
||||
{
|
||||
public double GreatHitWindow;
|
||||
|
||||
public ManiaDifficultyAttributes(Mod[] mods, double starRating)
|
||||
: base(mods, starRating)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +1,24 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Difficulty.Skills;
|
||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||
using osu.Game.Rulesets.Mania.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Mania.Difficulty.Skills;
|
||||
using osu.Game.Rulesets.Mania.Mods;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Difficulty
|
||||
{
|
||||
internal class ManiaDifficultyCalculator : DifficultyCalculator
|
||||
public class ManiaDifficultyCalculator : DifficultyCalculator
|
||||
{
|
||||
private const double star_scaling_factor = 0.018;
|
||||
|
||||
/// <summary>
|
||||
/// In milliseconds. For difficulty calculation we will only look at the highest strain value in each time interval of size strain_step.
|
||||
/// This is to eliminate higher influence of stream over aim by simply having more HitObjects with high strain.
|
||||
/// The higher this value, the less strains there will be, indirectly giving long beatmaps an advantage.
|
||||
/// </summary>
|
||||
private const double strain_step = 400;
|
||||
|
||||
/// <summary>
|
||||
/// The weighting of each strain value decays to this number * it's previous value
|
||||
/// </summary>
|
||||
private const double decay_weight = 0.9;
|
||||
|
||||
private readonly bool isForCurrentRuleset;
|
||||
|
||||
public ManiaDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||
@ -37,108 +27,70 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
||||
isForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.Equals(ruleset.RulesetInfo);
|
||||
}
|
||||
|
||||
protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate)
|
||||
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
|
||||
{
|
||||
if (!beatmap.HitObjects.Any())
|
||||
return new ManiaDifficultyAttributes(mods, 0);
|
||||
if (beatmap.HitObjects.Count == 0)
|
||||
return new ManiaDifficultyAttributes { Mods = mods };
|
||||
|
||||
var difficultyHitObjects = new List<ManiaHitObjectDifficulty>();
|
||||
|
||||
int columnCount = ((ManiaBeatmap)beatmap).TotalColumns;
|
||||
|
||||
// Sort DifficultyHitObjects by StartTime of the HitObjects - just to make sure.
|
||||
// Note: Stable sort is done so that the ordering of hitobjects with equal start times doesn't change
|
||||
difficultyHitObjects.AddRange(beatmap.HitObjects.Select(h => new ManiaHitObjectDifficulty((ManiaHitObject)h, columnCount)).OrderBy(h => h.BaseHitObject.StartTime));
|
||||
|
||||
if (!calculateStrainValues(difficultyHitObjects, timeRate))
|
||||
return new ManiaDifficultyAttributes(mods, 0);
|
||||
|
||||
double starRating = calculateDifficulty(difficultyHitObjects, timeRate) * star_scaling_factor;
|
||||
|
||||
return new ManiaDifficultyAttributes(mods, starRating)
|
||||
return new ManiaDifficultyAttributes
|
||||
{
|
||||
// Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be remoevd in the future
|
||||
GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate
|
||||
StarRating = difficultyValue(skills) * star_scaling_factor,
|
||||
Mods = mods,
|
||||
// Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future
|
||||
GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / clockRate,
|
||||
};
|
||||
}
|
||||
|
||||
private bool calculateStrainValues(List<ManiaHitObjectDifficulty> objects, double timeRate)
|
||||
private double difficultyValue(Skill[] skills)
|
||||
{
|
||||
// Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment.
|
||||
using (var hitObjectsEnumerator = objects.GetEnumerator())
|
||||
// Preprocess the strains to find the maximum overall + individual (aggregate) strain from each section
|
||||
var overall = skills.OfType<Overall>().Single();
|
||||
var aggregatePeaks = new List<double>(Enumerable.Repeat(0.0, overall.StrainPeaks.Count));
|
||||
|
||||
foreach (var individual in skills.OfType<Individual>())
|
||||
{
|
||||
if (!hitObjectsEnumerator.MoveNext())
|
||||
return false;
|
||||
|
||||
ManiaHitObjectDifficulty current = hitObjectsEnumerator.Current;
|
||||
|
||||
// First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See DifficultyHitObject.
|
||||
while (hitObjectsEnumerator.MoveNext())
|
||||
for (int i = 0; i < individual.StrainPeaks.Count; i++)
|
||||
{
|
||||
var next = hitObjectsEnumerator.Current;
|
||||
next?.CalculateStrains(current, timeRate);
|
||||
current = next;
|
||||
double aggregate = individual.StrainPeaks[i] + overall.StrainPeaks[i];
|
||||
|
||||
if (aggregate > aggregatePeaks[i])
|
||||
aggregatePeaks[i] = aggregate;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private double calculateDifficulty(List<ManiaHitObjectDifficulty> objects, double timeRate)
|
||||
{
|
||||
double actualStrainStep = strain_step * timeRate;
|
||||
|
||||
// Find the highest strain value within each strain step
|
||||
List<double> highestStrains = new List<double>();
|
||||
double intervalEndTime = actualStrainStep;
|
||||
double maximumStrain = 0; // We need to keep track of the maximum strain in the current interval
|
||||
|
||||
ManiaHitObjectDifficulty previousHitObject = null;
|
||||
foreach (var hitObject in objects)
|
||||
{
|
||||
// While we are beyond the current interval push the currently available maximum to our strain list
|
||||
while (hitObject.BaseHitObject.StartTime > intervalEndTime)
|
||||
{
|
||||
highestStrains.Add(maximumStrain);
|
||||
|
||||
// The maximum strain of the next interval is not zero by default! We need to take the last hitObject we encountered, take its strain and apply the decay
|
||||
// until the beginning of the next interval.
|
||||
if (previousHitObject == null)
|
||||
{
|
||||
maximumStrain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
double individualDecay = Math.Pow(ManiaHitObjectDifficulty.INDIVIDUAL_DECAY_BASE, (intervalEndTime - previousHitObject.BaseHitObject.StartTime) / 1000);
|
||||
double overallDecay = Math.Pow(ManiaHitObjectDifficulty.OVERALL_DECAY_BASE, (intervalEndTime - previousHitObject.BaseHitObject.StartTime) / 1000);
|
||||
maximumStrain = previousHitObject.IndividualStrain * individualDecay + previousHitObject.OverallStrain * overallDecay;
|
||||
}
|
||||
|
||||
// Go to the next time interval
|
||||
intervalEndTime += actualStrainStep;
|
||||
}
|
||||
|
||||
// Obtain maximum strain
|
||||
double strain = hitObject.IndividualStrain + hitObject.OverallStrain;
|
||||
maximumStrain = Math.Max(strain, maximumStrain);
|
||||
|
||||
previousHitObject = hitObject;
|
||||
}
|
||||
|
||||
// Build the weighted sum over the highest strains for each interval
|
||||
aggregatePeaks.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain.
|
||||
|
||||
double difficulty = 0;
|
||||
double weight = 1;
|
||||
highestStrains.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain.
|
||||
|
||||
foreach (double strain in highestStrains)
|
||||
// Difficulty is the weighted sum of the highest strains from every section.
|
||||
foreach (double strain in aggregatePeaks)
|
||||
{
|
||||
difficulty += weight * strain;
|
||||
weight *= decay_weight;
|
||||
difficulty += strain * weight;
|
||||
weight *= 0.9;
|
||||
}
|
||||
|
||||
return difficulty;
|
||||
}
|
||||
|
||||
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
||||
{
|
||||
for (int i = 1; i < beatmap.HitObjects.Count; i++)
|
||||
yield return new ManiaDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate);
|
||||
}
|
||||
|
||||
protected override Skill[] CreateSkills(IBeatmap beatmap)
|
||||
{
|
||||
int columnCount = ((ManiaBeatmap)beatmap).TotalColumns;
|
||||
|
||||
var skills = new List<Skill> { new Overall(columnCount) };
|
||||
|
||||
for (int i = 0; i < columnCount; i++)
|
||||
skills.Add(new Individual(i, columnCount));
|
||||
|
||||
return skills.ToArray();
|
||||
}
|
||||
|
||||
protected override Mod[] DifficultyAdjustmentMods
|
||||
{
|
||||
get
|
||||
|
@ -0,0 +1,19 @@
|
||||
// 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 osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Difficulty.Preprocessing
|
||||
{
|
||||
public class ManiaDifficultyHitObject : DifficultyHitObject
|
||||
{
|
||||
public new ManiaHitObject BaseObject => (ManiaHitObject)base.BaseObject;
|
||||
|
||||
public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate)
|
||||
: base(hitObject, lastObject, clockRate)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
47
osu.Game.Rulesets.Mania/Difficulty/Skills/Individual.cs
Normal file
47
osu.Game.Rulesets.Mania/Difficulty/Skills/Individual.cs
Normal file
@ -0,0 +1,47 @@
|
||||
// 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.Linq;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Difficulty.Skills;
|
||||
using osu.Game.Rulesets.Mania.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Difficulty.Skills
|
||||
{
|
||||
public class Individual : Skill
|
||||
{
|
||||
protected override double SkillMultiplier => 1;
|
||||
protected override double StrainDecayBase => 0.125;
|
||||
|
||||
private readonly double[] holdEndTimes;
|
||||
|
||||
private readonly int column;
|
||||
|
||||
public Individual(int column, int columnCount)
|
||||
{
|
||||
this.column = column;
|
||||
|
||||
holdEndTimes = new double[columnCount];
|
||||
}
|
||||
|
||||
protected override double StrainValueOf(DifficultyHitObject current)
|
||||
{
|
||||
var maniaCurrent = (ManiaDifficultyHitObject)current;
|
||||
var endTime = (maniaCurrent.BaseObject as HoldNote)?.EndTime ?? maniaCurrent.BaseObject.StartTime;
|
||||
|
||||
try
|
||||
{
|
||||
if (maniaCurrent.BaseObject.Column != column)
|
||||
return 0;
|
||||
|
||||
// We give a slight bonus if something is held meanwhile
|
||||
return holdEndTimes.Any(t => t > endTime) ? 2.5 : 2;
|
||||
}
|
||||
finally
|
||||
{
|
||||
holdEndTimes[maniaCurrent.BaseObject.Column] = endTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
56
osu.Game.Rulesets.Mania/Difficulty/Skills/Overall.cs
Normal file
56
osu.Game.Rulesets.Mania/Difficulty/Skills/Overall.cs
Normal file
@ -0,0 +1,56 @@
|
||||
// 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 osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Difficulty.Skills;
|
||||
using osu.Game.Rulesets.Mania.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Difficulty.Skills
|
||||
{
|
||||
public class Overall : Skill
|
||||
{
|
||||
protected override double SkillMultiplier => 1;
|
||||
protected override double StrainDecayBase => 0.3;
|
||||
|
||||
private readonly double[] holdEndTimes;
|
||||
|
||||
private readonly int columnCount;
|
||||
|
||||
public Overall(int columnCount)
|
||||
{
|
||||
this.columnCount = columnCount;
|
||||
|
||||
holdEndTimes = new double[columnCount];
|
||||
}
|
||||
|
||||
protected override double StrainValueOf(DifficultyHitObject current)
|
||||
{
|
||||
var maniaCurrent = (ManiaDifficultyHitObject)current;
|
||||
var endTime = (maniaCurrent.BaseObject as HoldNote)?.EndTime ?? maniaCurrent.BaseObject.StartTime;
|
||||
|
||||
double holdFactor = 1.0; // Factor in case something else is held
|
||||
double holdAddition = 0; // Addition to the current note in case it's a hold and has to be released awkwardly
|
||||
|
||||
for (int i = 0; i < columnCount; i++)
|
||||
{
|
||||
// If there is at least one other overlapping end or note, then we get an addition, buuuuuut...
|
||||
if (current.BaseObject.StartTime < holdEndTimes[i] && endTime > holdEndTimes[i])
|
||||
holdAddition = 1.0;
|
||||
|
||||
// ... this addition only is valid if there is _no_ other note with the same ending.
|
||||
// Releasing multiple notes at the same time is just as easy as releasing one
|
||||
if (endTime == holdEndTimes[i])
|
||||
holdAddition = 0;
|
||||
|
||||
// We give a slight bonus if something is held meanwhile
|
||||
if (holdEndTimes[i] > endTime)
|
||||
holdFactor = 1.25;
|
||||
}
|
||||
|
||||
holdEndTimes[maniaCurrent.BaseObject.Column] = endTime;
|
||||
|
||||
return (1 + holdAddition) * holdFactor;
|
||||
}
|
||||
}
|
||||
}
|
@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Mania
|
||||
|
||||
public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_mania_o };
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaDifficultyCalculator(this, beatmap);
|
||||
public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaDifficultyCalculator(this, beatmap);
|
||||
|
||||
public override int? LegacyID => 3;
|
||||
|
||||
|
@ -1,112 +0,0 @@
|
||||
// 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 osu.Game.Rulesets.Objects.Types;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Objects
|
||||
{
|
||||
internal class ManiaHitObjectDifficulty
|
||||
{
|
||||
/// <summary>
|
||||
/// Factor by how much individual / overall strain decays per second.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// These values are results of tweaking a lot and taking into account general feedback.
|
||||
/// </remarks>
|
||||
internal const double INDIVIDUAL_DECAY_BASE = 0.125;
|
||||
internal const double OVERALL_DECAY_BASE = 0.30;
|
||||
|
||||
internal ManiaHitObject BaseHitObject;
|
||||
|
||||
private readonly int beatmapColumnCount;
|
||||
|
||||
private readonly double endTime;
|
||||
private readonly double[] heldUntil;
|
||||
|
||||
/// <summary>
|
||||
/// Measures jacks or more generally: repeated presses of the same button
|
||||
/// </summary>
|
||||
private readonly double[] individualStrains;
|
||||
|
||||
internal double IndividualStrain
|
||||
{
|
||||
get
|
||||
{
|
||||
return individualStrains[BaseHitObject.Column];
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
individualStrains[BaseHitObject.Column] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Measures note density in a way
|
||||
/// </summary>
|
||||
internal double OverallStrain = 1;
|
||||
|
||||
public ManiaHitObjectDifficulty(ManiaHitObject baseHitObject, int columnCount)
|
||||
{
|
||||
BaseHitObject = baseHitObject;
|
||||
|
||||
endTime = (baseHitObject as IHasEndTime)?.EndTime ?? baseHitObject.StartTime;
|
||||
|
||||
beatmapColumnCount = columnCount;
|
||||
heldUntil = new double[beatmapColumnCount];
|
||||
individualStrains = new double[beatmapColumnCount];
|
||||
|
||||
for (int i = 0; i < beatmapColumnCount; ++i)
|
||||
{
|
||||
individualStrains[i] = 0;
|
||||
heldUntil[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
internal void CalculateStrains(ManiaHitObjectDifficulty previousHitObject, double timeRate)
|
||||
{
|
||||
// TODO: Factor in holds
|
||||
double timeElapsed = (BaseHitObject.StartTime - previousHitObject.BaseHitObject.StartTime) / timeRate;
|
||||
double individualDecay = Math.Pow(INDIVIDUAL_DECAY_BASE, timeElapsed / 1000);
|
||||
double overallDecay = Math.Pow(OVERALL_DECAY_BASE, timeElapsed / 1000);
|
||||
|
||||
double holdFactor = 1.0; // Factor to all additional strains in case something else is held
|
||||
double holdAddition = 0; // Addition to the current note in case it's a hold and has to be released awkwardly
|
||||
|
||||
// Fill up the heldUntil array
|
||||
for (int i = 0; i < beatmapColumnCount; ++i)
|
||||
{
|
||||
heldUntil[i] = previousHitObject.heldUntil[i];
|
||||
|
||||
// If there is at least one other overlapping end or note, then we get an addition, buuuuuut...
|
||||
if (BaseHitObject.StartTime < heldUntil[i] && endTime > heldUntil[i])
|
||||
{
|
||||
holdAddition = 1.0;
|
||||
}
|
||||
|
||||
// ... this addition only is valid if there is _no_ other note with the same ending. Releasing multiple notes at the same time is just as easy as releasing 1
|
||||
if (endTime == heldUntil[i])
|
||||
{
|
||||
holdAddition = 0;
|
||||
}
|
||||
|
||||
// We give a slight bonus to everything if something is held meanwhile
|
||||
if (heldUntil[i] > endTime)
|
||||
{
|
||||
holdFactor = 1.25;
|
||||
}
|
||||
|
||||
// Decay individual strains
|
||||
individualStrains[i] = previousHitObject.individualStrains[i] * individualDecay;
|
||||
}
|
||||
|
||||
heldUntil[BaseHitObject.Column] = endTime;
|
||||
|
||||
// Increase individual strain in own column
|
||||
IndividualStrain += 2.0 * holdFactor;
|
||||
|
||||
OverallStrain = previousHitObject.OverallStrain * overallDecay + (1.0 + holdAddition) * holdFactor;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,180 @@
|
||||
osu file format v14
|
||||
|
||||
[General]
|
||||
Mode: 3
|
||||
|
||||
[Difficulty]
|
||||
CircleSize:4
|
||||
OverallDifficulty:7
|
||||
ApproachRate:8.3
|
||||
SliderMultiplier:1.6
|
||||
SliderTickRate:1
|
||||
|
||||
[TimingPoints]
|
||||
500,500,4,2,1,50,1,0
|
||||
37500,-50,4,2,1,50,0,0
|
||||
41500,-25,4,2,1,50,0,0
|
||||
|
||||
[HitObjects]
|
||||
// jacks spaced 1/1 beat apart
|
||||
64,192,0,1,0,0:0:0:0:
|
||||
64,192,500,1,0,0:0:0:0:
|
||||
64,192,1000,1,0,0:0:0:0:
|
||||
64,192,1500,1,0,0:0:0:0:
|
||||
64,192,2000,1,0,0:0:0:0:
|
||||
64,192,2500,1,0,0:0:0:0:
|
||||
|
||||
// jacks spaced 1/2 beat apart
|
||||
64,192,3500,1,0,0:0:0:0:
|
||||
64,192,3750,1,0,0:0:0:0:
|
||||
64,192,4000,1,0,0:0:0:0:
|
||||
64,192,4250,1,0,0:0:0:0:
|
||||
64,192,4500,1,0,0:0:0:0:
|
||||
64,192,4750,1,0,0:0:0:0:
|
||||
64,192,5000,1,0,0:0:0:0:
|
||||
64,192,6000,1,0,0:0:0:0:
|
||||
|
||||
// doubles jacks spaced 1/2 beat apart
|
||||
192,192,6000,1,0,0:0:0:0:
|
||||
64,192,6250,1,0,0:0:0:0:
|
||||
192,192,6250,1,0,0:0:0:0:
|
||||
64,192,6500,1,0,0:0:0:0:
|
||||
192,192,6500,1,0,0:0:0:0:
|
||||
64,192,6750,1,0,0:0:0:0:
|
||||
192,192,6750,1,0,0:0:0:0:
|
||||
64,192,7000,1,0,0:0:0:0:
|
||||
192,192,7000,1,0,0:0:0:0:
|
||||
64,192,7250,1,0,0:0:0:0:
|
||||
192,192,7250,1,0,0:0:0:0:
|
||||
64,192,7500,1,0,0:0:0:0:
|
||||
192,192,7500,1,0,0:0:0:0:
|
||||
|
||||
// trill spaced 1/2 beat apart
|
||||
64,192,8500,1,0,0:0:0:0:
|
||||
192,192,8750,1,0,0:0:0:0:
|
||||
64,192,9000,1,0,0:0:0:0:
|
||||
192,192,9250,1,0,0:0:0:0:
|
||||
64,192,9500,1,0,0:0:0:0:
|
||||
192,192,9750,1,0,0:0:0:0:
|
||||
64,192,10000,1,0,0:0:0:0:
|
||||
192,192,10250,1,0,0:0:0:0:
|
||||
64,192,10500,1,0,0:0:0:0:
|
||||
|
||||
// stair spaced 1/4 apart
|
||||
64,192,11500,1,0,0:0:0:0:
|
||||
192,192,11625,1,0,0:0:0:0:
|
||||
320,192,11750,1,0,0:0:0:0:
|
||||
448,192,11875,1,0,0:0:0:0:
|
||||
320,192,12000,1,0,0:0:0:0:
|
||||
192,192,12125,1,0,0:0:0:0:
|
||||
64,192,12250,1,0,0:0:0:0:
|
||||
192,192,12375,1,0,0:0:0:0:
|
||||
320,192,12500,1,0,0:0:0:0:
|
||||
448,192,12625,1,0,0:0:0:0:
|
||||
|
||||
// jumpstreams?
|
||||
64,192,13500,1,0,0:0:0:0:
|
||||
192,192,13625,1,0,0:0:0:0:
|
||||
320,192,13750,1,0,0:0:0:0:
|
||||
448,192,13875,1,0,0:0:0:0:
|
||||
320,192,14000,1,0,0:0:0:0:
|
||||
192,192,14000,1,0,0:0:0:0:
|
||||
64,192,14125,1,0,0:0:0:0:
|
||||
192,192,14250,1,0,0:0:0:0:
|
||||
320,192,14250,1,0,0:0:0:0:
|
||||
448,192,14250,1,0,0:0:0:0:
|
||||
64,192,14375,1,0,0:0:0:0:
|
||||
64,192,14500,1,0,0:0:0:0:
|
||||
320,192,14625,1,0,0:0:0:0:
|
||||
448,192,14625,1,0,0:0:0:0:
|
||||
192,192,14625,1,0,0:0:0:0:
|
||||
192,192,14750,1,0,0:0:0:0:
|
||||
64,192,14875,1,0,0:0:0:0:
|
||||
192,192,15000,1,0,0:0:0:0:
|
||||
320,192,15125,1,0,0:0:0:0:
|
||||
448,192,15125,1,0,0:0:0:0:
|
||||
|
||||
// double... jumps?
|
||||
64,192,16000,1,0,0:0:0:0:
|
||||
64,192,16250,1,0,0:0:0:0:
|
||||
192,192,16250,1,0,0:0:0:0:
|
||||
192,192,16500,1,0,0:0:0:0:
|
||||
320,192,16500,1,0,0:0:0:0:
|
||||
320,192,16750,1,0,0:0:0:0:
|
||||
448,192,16750,1,0,0:0:0:0:
|
||||
448,192,17000,1,0,0:0:0:0:
|
||||
|
||||
// notes alongside hold
|
||||
64,192,18000,128,0,18500:0:0:0:0:
|
||||
192,192,18000,1,0,0:0:0:0:
|
||||
192,192,18250,1,0,0:0:0:0:
|
||||
192,192,18500,1,0,0:0:0:0:
|
||||
|
||||
// notes overlapping hold
|
||||
64,192,19500,1,0,0:0:0:0:
|
||||
192,192,19625,128,0,20875:0:0:0:0:
|
||||
64,192,19750,1,0,0:0:0:0:
|
||||
64,192,20000,1,0,0:0:0:0:
|
||||
64,192,20250,1,0,0:0:0:0:
|
||||
64,192,20500,1,0,0:0:0:0:
|
||||
64,192,20750,1,0,0:0:0:0:
|
||||
64,192,21000,1,0,0:0:0:0:
|
||||
|
||||
// simultaneous holds
|
||||
64,192,22000,128,0,23000:0:0:0:0:
|
||||
192,192,22000,128,0,23000:0:0:0:0:
|
||||
320,192,22000,128,0,23000:0:0:0:0:
|
||||
448,192,22000,128,0,23000:0:0:0:0:
|
||||
|
||||
// hold stairs
|
||||
64,192,24500,128,0,25500:0:0:0:0:
|
||||
192,192,24625,128,0,25375:0:0:0:0:
|
||||
320,192,24750,128,0,25250:0:0:0:0:
|
||||
448,192,24875,128,0,25125:0:0:0:0:
|
||||
448,192,25375,128,0,26375:0:0:0:0:
|
||||
320,192,25500,128,0,26250:0:0:0:0:
|
||||
192,192,25625,128,0,26125:0:0:0:0:
|
||||
64,192,25750,128,0,26000:0:0:0:0:
|
||||
|
||||
// quads
|
||||
64,192,26500,1,0,0:0:0:0:
|
||||
64,192,27500,1,0,0:0:0:0:
|
||||
192,192,27500,1,0,0:0:0:0:
|
||||
320,192,27500,1,0,0:0:0:0:
|
||||
448,192,27500,1,0,0:0:0:0:
|
||||
64,192,27750,1,0,0:0:0:0:
|
||||
192,192,27750,1,0,0:0:0:0:
|
||||
320,192,27750,1,0,0:0:0:0:
|
||||
448,192,27750,1,0,0:0:0:0:
|
||||
64,192,28000,1,0,0:0:0:0:
|
||||
192,192,28000,1,0,0:0:0:0:
|
||||
320,192,28000,1,0,0:0:0:0:
|
||||
448,192,28000,1,0,0:0:0:0:
|
||||
64,192,28250,1,0,0:0:0:0:
|
||||
192,192,28250,1,0,0:0:0:0:
|
||||
320,192,28250,1,0,0:0:0:0:
|
||||
448,192,28250,1,0,0:0:0:0:
|
||||
64,192,28500,1,0,0:0:0:0:
|
||||
192,192,28500,1,0,0:0:0:0:
|
||||
320,192,28500,1,0,0:0:0:0:
|
||||
448,192,28500,1,0,0:0:0:0:
|
||||
|
||||
// double-trills
|
||||
64,192,29500,1,0,0:0:0:0:
|
||||
192,192,29500,1,0,0:0:0:0:
|
||||
320,192,29625,1,0,0:0:0:0:
|
||||
448,192,29625,1,0,0:0:0:0:
|
||||
64,192,29750,1,0,0:0:0:0:
|
||||
192,192,29750,1,0,0:0:0:0:
|
||||
320,192,29875,1,0,0:0:0:0:
|
||||
448,192,29875,1,0,0:0:0:0:
|
||||
64,192,30000,1,0,0:0:0:0:
|
||||
192,192,30000,1,0,0:0:0:0:
|
||||
320,192,30125,1,0,0:0:0:0:
|
||||
448,192,30125,1,0,0:0:0:0:
|
||||
64,192,30250,1,0,0:0:0:0:
|
||||
192,192,30250,1,0,0:0:0:0:
|
||||
320,192,30375,1,0,0:0:0:0:
|
||||
448,192,30375,1,0,0:0:0:0:
|
||||
64,192,30500,1,0,0:0:0:0:
|
||||
192,192,30500,1,0,0:0:0:0:
|
25
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
Normal file
25
osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs
Normal file
@ -0,0 +1,25 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Osu.Difficulty;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest
|
||||
{
|
||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu";
|
||||
|
||||
[TestCase(6.931145117263422, "diffcalc-test")]
|
||||
public void Test(double expected, string name)
|
||||
=> base.Test(expected, name);
|
||||
|
||||
protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap);
|
||||
|
||||
protected override Ruleset CreateRuleset() => new OsuRuleset();
|
||||
}
|
||||
}
|
36
osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleLongCombo.cs
Normal file
36
osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleLongCombo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestCaseHitCircleLongCombo : Game.Tests.Visual.TestCasePlayer
|
||||
{
|
||||
public TestCaseHitCircleLongCombo()
|
||||
: base(new OsuRuleset())
|
||||
{
|
||||
}
|
||||
|
||||
protected override IBeatmap CreateBeatmap(Ruleset ruleset)
|
||||
{
|
||||
var beatmap = new Beatmap
|
||||
{
|
||||
BeatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BaseDifficulty = new BeatmapDifficulty { CircleSize = 6 },
|
||||
Ruleset = ruleset.RulesetInfo
|
||||
}
|
||||
};
|
||||
|
||||
for (int i = 0; i < 512; i++)
|
||||
beatmap.HitObjects.Add(new HitCircle { Position = new Vector2(256, 192), StartTime = i * 100 });
|
||||
|
||||
return beatmap;
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
{
|
||||
@ -13,10 +12,5 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
public double ApproachRate;
|
||||
public double OverallDifficulty;
|
||||
public int MaxCombo;
|
||||
|
||||
public OsuDifficultyAttributes(Mod[] mods, double starRating)
|
||||
: base(mods, starRating)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Difficulty.Skills;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Osu.Difficulty.Skills;
|
||||
@ -15,7 +18,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
{
|
||||
public class OsuDifficultyCalculator : DifficultyCalculator
|
||||
{
|
||||
private const int section_length = 400;
|
||||
private const double difficulty_multiplier = 0.0675;
|
||||
|
||||
public OsuDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||
@ -23,58 +25,27 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
{
|
||||
}
|
||||
|
||||
protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate)
|
||||
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
|
||||
{
|
||||
if (!beatmap.HitObjects.Any())
|
||||
return new OsuDifficultyAttributes(mods, 0);
|
||||
|
||||
OsuDifficultyBeatmap difficultyBeatmap = new OsuDifficultyBeatmap(beatmap.HitObjects.Cast<OsuHitObject>().ToList(), timeRate);
|
||||
Skill[] skills =
|
||||
{
|
||||
new Aim(),
|
||||
new Speed()
|
||||
};
|
||||
|
||||
double sectionLength = section_length * timeRate;
|
||||
|
||||
// The first object doesn't generate a strain, so we begin with an incremented section end
|
||||
double currentSectionEnd = Math.Ceiling(beatmap.HitObjects.First().StartTime / sectionLength) * sectionLength;
|
||||
|
||||
foreach (OsuDifficultyHitObject h in difficultyBeatmap)
|
||||
{
|
||||
while (h.BaseObject.StartTime > currentSectionEnd)
|
||||
{
|
||||
foreach (Skill s in skills)
|
||||
{
|
||||
s.SaveCurrentPeak();
|
||||
s.StartNewSectionFrom(currentSectionEnd);
|
||||
}
|
||||
|
||||
currentSectionEnd += sectionLength;
|
||||
}
|
||||
|
||||
foreach (Skill s in skills)
|
||||
s.Process(h);
|
||||
}
|
||||
|
||||
// The peak strain will not be saved for the last section in the above loop
|
||||
foreach (Skill s in skills)
|
||||
s.SaveCurrentPeak();
|
||||
if (beatmap.HitObjects.Count == 0)
|
||||
return new OsuDifficultyAttributes { Mods = mods };
|
||||
|
||||
double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier;
|
||||
double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier;
|
||||
double starRating = aimRating + speedRating + Math.Abs(aimRating - speedRating) / 2;
|
||||
|
||||
// Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be removed in the future
|
||||
double hitWindowGreat = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate;
|
||||
double preempt = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate;
|
||||
double hitWindowGreat = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / clockRate;
|
||||
double preempt = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / clockRate;
|
||||
|
||||
int maxCombo = beatmap.HitObjects.Count;
|
||||
// Add the ticks + tail of the slider. 1 is subtracted because the head circle would be counted twice (once for the slider itself in the line above)
|
||||
maxCombo += beatmap.HitObjects.OfType<Slider>().Sum(s => s.NestedHitObjects.Count - 1);
|
||||
|
||||
return new OsuDifficultyAttributes(mods, starRating)
|
||||
return new OsuDifficultyAttributes
|
||||
{
|
||||
StarRating = starRating,
|
||||
Mods = mods,
|
||||
AimStrain = aimRating,
|
||||
SpeedStrain = speedRating,
|
||||
ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5,
|
||||
@ -83,6 +54,26 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
};
|
||||
}
|
||||
|
||||
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
||||
{
|
||||
// The first jump is formed by the first two hitobjects of the map.
|
||||
// If the map has less than two OsuHitObjects, the enumerator will not return anything.
|
||||
for (int i = 1; i < beatmap.HitObjects.Count; i++)
|
||||
{
|
||||
var lastLast = i > 1 ? beatmap.HitObjects[i - 2] : null;
|
||||
var last = beatmap.HitObjects[i - 1];
|
||||
var current = beatmap.HitObjects[i];
|
||||
|
||||
yield return new OsuDifficultyHitObject(current, lastLast, last, clockRate);
|
||||
}
|
||||
}
|
||||
|
||||
protected override Skill[] CreateSkills(IBeatmap beatmap) => new Skill[]
|
||||
{
|
||||
new Aim(),
|
||||
new Speed()
|
||||
};
|
||||
|
||||
protected override Mod[] DifficultyAdjustmentMods => new Mod[]
|
||||
{
|
||||
new OsuModDoubleTime(),
|
||||
|
@ -1,50 +0,0 @@
|
||||
// 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.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
{
|
||||
/// <summary>
|
||||
/// An enumerable container wrapping <see cref="OsuHitObject"/> input as <see cref="OsuDifficultyHitObject"/>
|
||||
/// which contains extra data required for difficulty calculation.
|
||||
/// </summary>
|
||||
public class OsuDifficultyBeatmap : IEnumerable<OsuDifficultyHitObject>
|
||||
{
|
||||
private readonly IEnumerator<OsuDifficultyHitObject> difficultyObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an enumerator, which preprocesses a list of <see cref="OsuHitObject"/>s recieved as input, wrapping them as
|
||||
/// <see cref="OsuDifficultyHitObject"/> which contains extra data required for difficulty calculation.
|
||||
/// </summary>
|
||||
public OsuDifficultyBeatmap(List<OsuHitObject> objects, double timeRate)
|
||||
{
|
||||
// Sort OsuHitObjects by StartTime - they are not correctly ordered in some cases.
|
||||
// This should probably happen before the objects reach the difficulty calculator.
|
||||
difficultyObjects = createDifficultyObjectEnumerator(objects.OrderBy(h => h.StartTime).ToList(), timeRate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that enumerates all <see cref="OsuDifficultyHitObject"/>s in the <see cref="OsuDifficultyBeatmap"/>.
|
||||
/// </summary>
|
||||
public IEnumerator<OsuDifficultyHitObject> GetEnumerator() => difficultyObjects;
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
|
||||
private IEnumerator<OsuDifficultyHitObject> createDifficultyObjectEnumerator(List<OsuHitObject> objects, double timeRate)
|
||||
{
|
||||
// The first jump is formed by the first two hitobjects of the map.
|
||||
// If the map has less than two OsuHitObjects, the enumerator will not return anything.
|
||||
for (int i = 1; i < objects.Count; i++)
|
||||
{
|
||||
var lastLast = i > 1 ? objects[i - 2] : null;
|
||||
var last = objects[i - 1];
|
||||
var current = objects[i];
|
||||
|
||||
yield return new OsuDifficultyHitObject(lastLast, last, current, timeRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,24 +1,20 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
{
|
||||
/// <summary>
|
||||
/// A wrapper around <see cref="OsuHitObject"/> extending it with additional data required for difficulty calculation.
|
||||
/// </summary>
|
||||
public class OsuDifficultyHitObject
|
||||
public class OsuDifficultyHitObject : DifficultyHitObject
|
||||
{
|
||||
private const int normalized_radius = 52;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="OsuHitObject"/> this <see cref="OsuDifficultyHitObject"/> refers to.
|
||||
/// </summary>
|
||||
public OsuHitObject BaseObject { get; }
|
||||
protected new OsuHitObject BaseObject => (OsuHitObject)base.BaseObject;
|
||||
|
||||
/// <summary>
|
||||
/// Normalized distance from the end position of the previous <see cref="OsuDifficultyHitObject"/> to the start position of this <see cref="OsuDifficultyHitObject"/>.
|
||||
@ -30,40 +26,30 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
/// </summary>
|
||||
public double TravelDistance { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Milliseconds elapsed since the StartTime of the previous <see cref="OsuDifficultyHitObject"/>.
|
||||
/// </summary>
|
||||
public double DeltaTime { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Milliseconds elapsed since the start time of the previous <see cref="OsuDifficultyHitObject"/>, with a minimum of 50ms.
|
||||
/// </summary>
|
||||
public double StrainTime { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Angle the player has to take to hit this <see cref="OsuDifficultyHitObject"/>.
|
||||
/// Calculated as the angle between the circles (current-2, current-1, current).
|
||||
/// </summary>
|
||||
public double? Angle { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Milliseconds elapsed since the start time of the previous <see cref="OsuDifficultyHitObject"/>, with a minimum of 50ms.
|
||||
/// </summary>
|
||||
public readonly double StrainTime;
|
||||
|
||||
private readonly OsuHitObject lastLastObject;
|
||||
private readonly OsuHitObject lastObject;
|
||||
private readonly double timeRate;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the object calculating extra data required for difficulty calculation.
|
||||
/// </summary>
|
||||
public OsuDifficultyHitObject(OsuHitObject lastLastObject, OsuHitObject lastObject, OsuHitObject currentObject, double timeRate)
|
||||
public OsuDifficultyHitObject(HitObject hitObject, HitObject lastLastObject, HitObject lastObject, double clockRate)
|
||||
: base(hitObject, lastObject, clockRate)
|
||||
{
|
||||
this.lastLastObject = lastLastObject;
|
||||
this.lastObject = lastObject;
|
||||
this.timeRate = timeRate;
|
||||
|
||||
BaseObject = currentObject;
|
||||
this.lastLastObject = (OsuHitObject)lastLastObject;
|
||||
this.lastObject = (OsuHitObject)lastObject;
|
||||
|
||||
setDistances();
|
||||
setTimingValues();
|
||||
// Calculate angle here
|
||||
|
||||
// Every strain interval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure
|
||||
StrainTime = Math.Max(50, DeltaTime);
|
||||
}
|
||||
|
||||
private void setDistances()
|
||||
@ -102,14 +88,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
}
|
||||
}
|
||||
|
||||
private void setTimingValues()
|
||||
{
|
||||
DeltaTime = (BaseObject.StartTime - lastObject.StartTime) / timeRate;
|
||||
|
||||
// Every strain interval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure
|
||||
StrainTime = Math.Max(50, DeltaTime);
|
||||
}
|
||||
|
||||
private void computeSliderCursorPosition(Slider slider)
|
||||
{
|
||||
if (slider.LazyEndPosition != null)
|
||||
|
@ -2,7 +2,10 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Difficulty.Skills;
|
||||
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
{
|
||||
@ -17,33 +20,40 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
protected override double SkillMultiplier => 26.25;
|
||||
protected override double StrainDecayBase => 0.15;
|
||||
|
||||
protected override double StrainValueOf(OsuDifficultyHitObject current)
|
||||
protected override double StrainValueOf(DifficultyHitObject current)
|
||||
{
|
||||
if (current.BaseObject is Spinner)
|
||||
return 0;
|
||||
|
||||
var osuCurrent = (OsuDifficultyHitObject)current;
|
||||
|
||||
double result = 0;
|
||||
|
||||
const double scale = 90;
|
||||
|
||||
double applyDiminishingExp(double val) => Math.Pow(val, 0.99);
|
||||
|
||||
if (Previous.Count > 0)
|
||||
{
|
||||
if (current.Angle != null && current.Angle.Value > angle_bonus_begin)
|
||||
var osuPrevious = (OsuDifficultyHitObject)Previous[0];
|
||||
|
||||
if (osuCurrent.Angle != null && osuCurrent.Angle.Value > angle_bonus_begin)
|
||||
{
|
||||
const double scale = 90;
|
||||
|
||||
var angleBonus = Math.Sqrt(
|
||||
Math.Max(Previous[0].JumpDistance - scale, 0)
|
||||
* Math.Pow(Math.Sin(current.Angle.Value - angle_bonus_begin), 2)
|
||||
* Math.Max(current.JumpDistance - scale, 0));
|
||||
result = 1.5 * applyDiminishingExp(Math.Max(0, angleBonus)) / Math.Max(timing_threshold, Previous[0].StrainTime);
|
||||
Math.Max(osuPrevious.JumpDistance - scale, 0)
|
||||
* Math.Pow(Math.Sin(osuCurrent.Angle.Value - angle_bonus_begin), 2)
|
||||
* Math.Max(osuCurrent.JumpDistance - scale, 0));
|
||||
result = 1.5 * applyDiminishingExp(Math.Max(0, angleBonus)) / Math.Max(timing_threshold, osuPrevious.StrainTime);
|
||||
}
|
||||
}
|
||||
|
||||
double jumpDistanceExp = applyDiminishingExp(current.JumpDistance);
|
||||
double travelDistanceExp = applyDiminishingExp(current.TravelDistance);
|
||||
double jumpDistanceExp = applyDiminishingExp(osuCurrent.JumpDistance);
|
||||
double travelDistanceExp = applyDiminishingExp(osuCurrent.TravelDistance);
|
||||
|
||||
return Math.Max(
|
||||
result + (jumpDistanceExp + travelDistanceExp + Math.Sqrt(travelDistanceExp * jumpDistanceExp)) / Math.Max(current.StrainTime, timing_threshold),
|
||||
(Math.Sqrt(travelDistanceExp * jumpDistanceExp) + jumpDistanceExp + travelDistanceExp) / current.StrainTime
|
||||
result + (jumpDistanceExp + travelDistanceExp + Math.Sqrt(travelDistanceExp * jumpDistanceExp)) / Math.Max(osuCurrent.StrainTime, timing_threshold),
|
||||
(Math.Sqrt(travelDistanceExp * jumpDistanceExp) + jumpDistanceExp + travelDistanceExp) / osuCurrent.StrainTime
|
||||
);
|
||||
}
|
||||
|
||||
private double applyDiminishingExp(double val) => Math.Pow(val, 0.99);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,10 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Difficulty.Skills;
|
||||
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
{
|
||||
@ -11,6 +14,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
/// </summary>
|
||||
public class Speed : Skill
|
||||
{
|
||||
private const double single_spacing_threshold = 125;
|
||||
|
||||
private const double angle_bonus_begin = 5 * Math.PI / 6;
|
||||
private const double pi_over_4 = Math.PI / 4;
|
||||
private const double pi_over_2 = Math.PI / 2;
|
||||
@ -22,9 +27,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
private const double max_speed_bonus = 45; // ~330BPM
|
||||
private const double speed_balancing_factor = 40;
|
||||
|
||||
protected override double StrainValueOf(OsuDifficultyHitObject current)
|
||||
protected override double StrainValueOf(DifficultyHitObject current)
|
||||
{
|
||||
double distance = Math.Min(SINGLE_SPACING_THRESHOLD, current.TravelDistance + current.JumpDistance);
|
||||
if (current.BaseObject is Spinner)
|
||||
return 0;
|
||||
|
||||
var osuCurrent = (OsuDifficultyHitObject)current;
|
||||
|
||||
double distance = Math.Min(single_spacing_threshold, osuCurrent.TravelDistance + osuCurrent.JumpDistance);
|
||||
double deltaTime = Math.Max(max_speed_bonus, current.DeltaTime);
|
||||
|
||||
double speedBonus = 1.0;
|
||||
@ -32,20 +42,20 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
speedBonus = 1 + Math.Pow((min_speed_bonus - deltaTime) / speed_balancing_factor, 2);
|
||||
|
||||
double angleBonus = 1.0;
|
||||
if (current.Angle != null && current.Angle.Value < angle_bonus_begin)
|
||||
if (osuCurrent.Angle != null && osuCurrent.Angle.Value < angle_bonus_begin)
|
||||
{
|
||||
angleBonus = 1 + Math.Pow(Math.Sin(1.5 * (angle_bonus_begin - current.Angle.Value)), 2) / 3.57;
|
||||
if (current.Angle.Value < pi_over_2)
|
||||
angleBonus = 1 + Math.Pow(Math.Sin(1.5 * (angle_bonus_begin - osuCurrent.Angle.Value)), 2) / 3.57;
|
||||
if (osuCurrent.Angle.Value < pi_over_2)
|
||||
{
|
||||
angleBonus = 1.28;
|
||||
if (distance < 90 && current.Angle.Value < pi_over_4)
|
||||
if (distance < 90 && osuCurrent.Angle.Value < pi_over_4)
|
||||
angleBonus += (1 - angleBonus) * Math.Min((90 - distance) / 10, 1);
|
||||
else if (distance < 90)
|
||||
angleBonus += (1 - angleBonus) * Math.Min((90 - distance) / 10, 1) * Math.Sin((pi_over_2 - current.Angle.Value) / pi_over_4);
|
||||
angleBonus += (1 - angleBonus) * Math.Min((90 - distance) / 10, 1) * Math.Sin((pi_over_2 - osuCurrent.Angle.Value) / pi_over_4);
|
||||
}
|
||||
}
|
||||
|
||||
return (1 + (speedBonus - 1) * 0.75) * angleBonus * (0.95 + speedBonus * Math.Pow(distance / SINGLE_SPACING_THRESHOLD, 3.5)) / current.StrainTime;
|
||||
return (1 + (speedBonus - 1) * 0.75) * angleBonus * (0.95 + speedBonus * Math.Pow(distance / single_spacing_threshold, 3.5)) / osuCurrent.StrainTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
74
osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs
Normal file
74
osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs
Normal file
@ -0,0 +1,74 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
internal class OsuModGrow : Mod, IApplicableToDrawableHitObjects
|
||||
{
|
||||
public override string Name => "Grow";
|
||||
|
||||
public override string Acronym => "GR";
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_arrows_v;
|
||||
|
||||
public override ModType Type => ModType.Fun;
|
||||
|
||||
public override string Description => "Hit them at the right size!";
|
||||
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
||||
{
|
||||
foreach (var drawable in drawables)
|
||||
{
|
||||
switch (drawable)
|
||||
{
|
||||
case DrawableSpinner _:
|
||||
continue;
|
||||
default:
|
||||
drawable.ApplyCustomUpdateState += ApplyCustomState;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void ApplyCustomState(DrawableHitObject drawable, ArmedState state)
|
||||
{
|
||||
var h = (OsuHitObject)drawable.HitObject;
|
||||
|
||||
// apply grow effect
|
||||
switch (drawable)
|
||||
{
|
||||
case DrawableSliderHead _:
|
||||
case DrawableSliderTail _:
|
||||
// special cases we should *not* be scaling.
|
||||
break;
|
||||
case DrawableSlider _:
|
||||
case DrawableHitCircle _:
|
||||
{
|
||||
using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
|
||||
drawable.ScaleTo(0.5f).Then().ScaleTo(1, h.TimePreempt, Easing.OutSine);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// remove approach circles
|
||||
switch (drawable)
|
||||
{
|
||||
case DrawableHitCircle circle:
|
||||
// we don't want to see the approach circle
|
||||
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
|
||||
circle.ApproachCircle.Hide();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||
using osuTK;
|
||||
@ -27,40 +28,58 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
private readonly IBindable<int> stackHeightBindable = new Bindable<int>();
|
||||
private readonly IBindable<float> scaleBindable = new Bindable<float>();
|
||||
|
||||
private readonly Container explodeContainer;
|
||||
|
||||
private readonly Container scaleContainer;
|
||||
|
||||
public DrawableHitCircle(HitCircle h)
|
||||
: base(h)
|
||||
{
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
Position = HitObject.StackedPosition;
|
||||
Scale = new Vector2(h.Scale);
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
glow = new GlowPiece(),
|
||||
circle = new CirclePiece
|
||||
scaleContainer = new Container
|
||||
{
|
||||
Hit = () =>
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Child = explodeContainer = new Container
|
||||
{
|
||||
if (AllJudged)
|
||||
return false;
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
glow = new GlowPiece(),
|
||||
circle = new CirclePiece
|
||||
{
|
||||
Hit = () =>
|
||||
{
|
||||
if (AllJudged)
|
||||
return false;
|
||||
|
||||
UpdateResult(true);
|
||||
return true;
|
||||
},
|
||||
UpdateResult(true);
|
||||
return true;
|
||||
},
|
||||
},
|
||||
number = new NumberPiece
|
||||
{
|
||||
Text = (HitObject.IndexInCurrentCombo + 1).ToString(),
|
||||
},
|
||||
ring = new RingPiece(),
|
||||
flash = new FlashPiece(),
|
||||
explode = new ExplodePiece(),
|
||||
ApproachCircle = new ApproachCircle
|
||||
{
|
||||
Alpha = 0,
|
||||
Scale = new Vector2(4),
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
number = new NumberPiece
|
||||
{
|
||||
Text = (HitObject.IndexInCurrentCombo + 1).ToString(),
|
||||
},
|
||||
ring = new RingPiece(),
|
||||
flash = new FlashPiece(),
|
||||
explode = new ExplodePiece(),
|
||||
ApproachCircle = new ApproachCircle
|
||||
{
|
||||
Alpha = 0,
|
||||
Scale = new Vector2(4),
|
||||
}
|
||||
};
|
||||
|
||||
//may not be so correct
|
||||
@ -72,7 +91,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
|
||||
stackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
|
||||
scaleBindable.BindValueChanged(v => Scale = new Vector2(v));
|
||||
scaleBindable.BindValueChanged(v => scaleContainer.Scale = new Vector2(v), true);
|
||||
|
||||
positionBindable.BindTo(HitObject.PositionBindable);
|
||||
stackHeightBindable.BindTo(HitObject.StackHeightBindable);
|
||||
@ -156,8 +175,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
circle.FadeOut();
|
||||
number.FadeOut();
|
||||
|
||||
this.FadeOut(800)
|
||||
.ScaleTo(Scale * 1.5f, 400, Easing.OutQuad);
|
||||
this.FadeOut(800);
|
||||
explodeContainer.ScaleTo(1.5f, 400, Easing.OutQuad);
|
||||
}
|
||||
|
||||
Expire();
|
||||
|
@ -124,6 +124,7 @@ namespace osu.Game.Rulesets.Osu
|
||||
return new Mod[] {
|
||||
new OsuModTransform(),
|
||||
new OsuModWiggle(),
|
||||
new OsuModGrow()
|
||||
};
|
||||
default:
|
||||
return new Mod[] { };
|
||||
@ -132,7 +133,7 @@ namespace osu.Game.Rulesets.Osu
|
||||
|
||||
public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_osu_o };
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(this, beatmap);
|
||||
public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(this, beatmap);
|
||||
|
||||
public override PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => new OsuPerformanceCalculator(this, beatmap, score);
|
||||
|
||||
|
@ -0,0 +1,179 @@
|
||||
osu file format v14
|
||||
|
||||
[General]
|
||||
StackLeniency: 0.3
|
||||
Mode: 0
|
||||
|
||||
[Difficulty]
|
||||
CircleSize:4
|
||||
OverallDifficulty:7
|
||||
ApproachRate:8.3
|
||||
SliderMultiplier:1.6
|
||||
SliderTickRate:1
|
||||
|
||||
[TimingPoints]
|
||||
500,500,4,2,1,50,1,0
|
||||
62500,-500,4,2,1,50,0,0
|
||||
71000,-100,4,2,1,50,0,0
|
||||
|
||||
[HitObjects]
|
||||
// Circles spaced 1 beat apart, with increasing jump distance
|
||||
126,112,500,5,0,0:0:0:0:
|
||||
130,155,1000,1,0,0:0:0:0:
|
||||
131,269,1500,1,0,0:0:0:0:
|
||||
341,269,2000,1,0,0:0:0:0:
|
||||
113,95,2500,1,0,0:0:0:0:
|
||||
|
||||
// Circles spaced 1/2 beat apart, with increasing jump distance
|
||||
108,104,3500,5,0,0:0:0:0:
|
||||
110,145,3750,1,0,0:0:0:0:
|
||||
115,262,4000,1,0,0:0:0:0:
|
||||
285,265,4250,1,0,0:0:0:0:
|
||||
458,48,4500,1,0,0:0:0:0:
|
||||
35,199,4750,1,0,0:0:0:0:
|
||||
251,340,5000,1,0,0:0:0:0:
|
||||
20,352,5250,1,0,0:0:0:0:
|
||||
426,62,5500,1,0,0:0:0:0:
|
||||
|
||||
// Circles spaced 1/4 beat apart, with increasing jump distances
|
||||
211,138,6500,5,0,0:0:0:0:
|
||||
99,256,6625,1,0,0:0:0:0:
|
||||
68,129,6750,1,0,0:0:0:0:
|
||||
371,340,6875,1,0,0:0:0:0:
|
||||
241,219,7000,1,0,0:0:0:0:
|
||||
252,148,7125,1,0,0:0:0:0:
|
||||
434,97,7250,1,0,0:0:0:0:
|
||||
40,38,7375,1,0,0:0:0:0:
|
||||
114,334,7500,1,0,0:0:0:0:
|
||||
301,19,7625,1,0,0:0:0:0:
|
||||
441,241,7750,1,0,0:0:0:0:
|
||||
121,91,7875,1,0,0:0:0:0:
|
||||
270,384,8000,1,0,0:0:0:0:
|
||||
488,92,8125,1,0,0:0:0:0:
|
||||
332,82,8250,1,0,0:0:0:0:
|
||||
108,240,8375,1,0,0:0:0:0:
|
||||
281,268,8500,1,0,0:0:0:0:
|
||||
|
||||
// Constant spaced circles spaced 1/2 beat apart, small jump distances, changing angles
|
||||
252,191,9500,5,0,0:0:0:0:
|
||||
356,191,9750,1,0,0:0:0:0:
|
||||
311,268,10000,1,0,0:0:0:0:
|
||||
190,270,10250,1,0,0:0:0:0:
|
||||
107,199,10500,1,0,0:0:0:0:
|
||||
172,105,10750,1,0,0:0:0:0:
|
||||
297,102,11000,1,0,0:0:0:0:
|
||||
373,178,11250,1,0,0:0:0:0:
|
||||
252,195,11500,1,0,0:0:0:0:
|
||||
|
||||
// Constant spaced circles spaced 1/2 beat apart, large jump distances, changing angles
|
||||
140,187,12500,5,0,0:0:0:0:
|
||||
451,331,12750,1,0,0:0:0:0:
|
||||
46,338,13000,1,0,0:0:0:0:
|
||||
204,50,13250,1,0,0:0:0:0:
|
||||
464,162,13500,1,0,0:0:0:0:
|
||||
252,346,13750,1,0,0:0:0:0:
|
||||
13,175,14000,1,0,0:0:0:0:
|
||||
488,181,14250,1,0,0:0:0:0:
|
||||
251,187,14500,1,0,0:0:0:0:
|
||||
|
||||
// Constant spaced circles spaced 1/4 beat apart, small jump distances, changing angles
|
||||
188,192,15500,5,0,0:0:0:0:
|
||||
298,194,15625,1,0,0:0:0:0:
|
||||
317,84,15750,1,0,0:0:0:0:
|
||||
185,85,15875,1,0,0:0:0:0:
|
||||
77,200,16000,1,0,0:0:0:0:
|
||||
184,303,16125,1,0,0:0:0:0:
|
||||
295,225,16250,1,0,0:0:0:0:
|
||||
300,84,16375,1,0,0:0:0:0:
|
||||
144,82,16500,1,0,0:0:0:0:
|
||||
141,215,16625,1,0,0:0:0:0:
|
||||
314,184,16750,1,0,0:0:0:0:
|
||||
188,192,16875,1,0,0:0:0:0:
|
||||
188,192,17000,1,0,0:0:0:0:
|
||||
|
||||
// Constant spaced circles spaced 1/4 beat apart, large jump distances, changing angles
|
||||
97,192,18000,5,0,0:0:0:0:
|
||||
336,38,18125,1,0,0:0:0:0:
|
||||
440,322,18250,1,0,0:0:0:0:
|
||||
39,331,18375,1,0,0:0:0:0:
|
||||
98,39,18500,1,0,0:0:0:0:
|
||||
460,179,18625,1,0,0:0:0:0:
|
||||
245,338,18750,1,0,0:0:0:0:
|
||||
12,184,18875,1,0,0:0:0:0:
|
||||
250,41,19000,1,0,0:0:0:0:
|
||||
265,193,19125,1,0,0:0:0:0:
|
||||
486,22,19250,1,0,0:0:0:0:
|
||||
411,205,19375,1,0,0:0:0:0:
|
||||
107,198,19500,1,0,0:0:0:0:
|
||||
|
||||
// Short sliders spaced 1 beat apart
|
||||
28,108,20500,2,0,L|196:107,1,160
|
||||
25,177,21500,2,0,L|193:176,1,160
|
||||
26,308,22500,2,0,L|194:307,1,160
|
||||
320,89,23500,2,0,L|488:88,1,160
|
||||
|
||||
// Short sliders spaced 1/2 beat apart
|
||||
28,108,25000,6,0,L|196:107,1,160
|
||||
27,173,25750,2,0,L|195:172,1,160
|
||||
25,292,26500,2,0,L|193:291,1,160
|
||||
340,213,27250,2,0,L|508:212,1,160
|
||||
21,44,28000,2,0,L|189:43,1,160
|
||||
|
||||
// Short sliders spaced 1/4 beat apart
|
||||
28,108,29500,6,0,L|196:107,1,160
|
||||
30,169,30125,2,0,L|198:168,1,160
|
||||
35,282,30750,2,0,L|203:281,1,160
|
||||
327,286,31375,2,0,L|495:285,1,160
|
||||
51,61,32000,2,0,L|219:60,1,160
|
||||
|
||||
// Large, medium-paced slider shapes
|
||||
// PerfectCurve
|
||||
66,86,33500,6,0,P|246:348|427:44,1,800
|
||||
66,86,36500,2,0,P|246:348|427:44,1,800
|
||||
66,86,39500,2,0,P|246:348|427:44,1,800
|
||||
// Linear
|
||||
66,72,42500,2,0,B|419:65|419:65|66:316|66:316|426:318,1,1120
|
||||
66,72,46500,2,0,B|419:65|419:65|66:316|66:316|426:318,1,1120
|
||||
66,72,50500,2,0,B|419:65|419:65|66:316|66:316|426:318,1,1120
|
||||
// Bezier
|
||||
76,287,54500,2,0,B|440:325|138:128|470:302|500:30|130:85|66:82,1,640
|
||||
76,287,57000,2,0,B|440:325|138:128|470:302|500:30|130:85|66:82,1,640
|
||||
76,287,59500,2,0,B|440:325|138:128|470:302|500:30|130:85|66:82,1,640
|
||||
|
||||
// Large slow slider with many ticks
|
||||
81,170,62500,6,0,P|263:78|168:268,1,480
|
||||
|
||||
// Fast slider with many repeats
|
||||
102,152,71000,6,0,L|175:153,18,64
|
||||
|
||||
// Slider-circle combos, spaced 1/2 beat apart
|
||||
106,204,75500,6,0,P|275:33|171:304,1,800
|
||||
255,179,78250,1,0,0:0:0:0:
|
||||
106,204,78500,2,0,P|275:33|171:304,1,800
|
||||
255,179,81250,1,0,0:0:0:0:
|
||||
106,204,81500,2,0,P|275:33|171:304,1,800
|
||||
|
||||
// Circle-spinner combos, spaced 1/2 beat apart
|
||||
82,69,85000,5,0,0:0:0:0:
|
||||
256,192,85250,8,0,86000,0:0:0:0:
|
||||
384,189,86250,5,0,0:0:0:0:
|
||||
256,192,86500,12,0,87000,0:0:0:0:
|
||||
|
||||
// Spinner-spinner combos, spaced 1/2 beat apart
|
||||
256,192,88000,12,0,89000,0:0:0:0:
|
||||
256,192,89250,12,0,90250,0:0:0:0:
|
||||
256,192,90500,12,0,91500,0:0:0:0:
|
||||
256,192,91750,12,0,92750,0:0:0:0:
|
||||
256,192,93000,12,0,94000,0:0:0:0:
|
||||
|
||||
// Slider-spinner combos, spaced 1/2 beat apart
|
||||
49,89,95000,6,0,L|214:87,1,160
|
||||
256,192,95625,12,0,96500,0:0:0:0:
|
||||
12,299,96625,6,0,L|177:297,1,160
|
||||
256,192,97250,12,0,98125,0:0:0:0:
|
||||
295,107,98250,6,0,L|460:105,1,160
|
||||
256,192,98875,12,0,99750,0:0:0:0:
|
||||
279,325,99875,6,0,L|444:323,1,160
|
||||
256,192,100500,12,0,101375,0:0:0:0:
|
||||
197,197,101500,6,0,L|362:195,1,160
|
||||
256,192,102125,12,0,103000,0:0:0:0:
|
@ -0,0 +1,25 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Taiko.Difficulty;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
public class TaikoDifficultyCalculatorTest : DifficultyCalculatorTest
|
||||
{
|
||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko";
|
||||
|
||||
[TestCase(2.9811338051242915d, "diffcalc-test")]
|
||||
[TestCase(2.9811338051242915d, "diffcalc-test-strong")]
|
||||
public void Test(double expected, string name)
|
||||
=> base.Test(expected, name);
|
||||
|
||||
protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(new TaikoRuleset(), beatmap);
|
||||
|
||||
protected override Ruleset CreateRuleset() => new TaikoRuleset();
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
// 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 osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
|
||||
{
|
||||
public class TaikoDifficultyHitObject : DifficultyHitObject
|
||||
{
|
||||
public readonly bool HasTypeChange;
|
||||
|
||||
public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate)
|
||||
: base(hitObject, lastObject, clockRate)
|
||||
{
|
||||
HasTypeChange = lastObject is RimHit != hitObject is RimHit;
|
||||
}
|
||||
}
|
||||
}
|
95
osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs
Normal file
95
osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs
Normal file
@ -0,0 +1,95 @@
|
||||
// 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.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Difficulty.Skills;
|
||||
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
|
||||
{
|
||||
public class Strain : Skill
|
||||
{
|
||||
private const double rhythm_change_base_threshold = 0.2;
|
||||
private const double rhythm_change_base = 2.0;
|
||||
|
||||
protected override double SkillMultiplier => 1;
|
||||
protected override double StrainDecayBase => 0.3;
|
||||
|
||||
private ColourSwitch lastColourSwitch = ColourSwitch.None;
|
||||
|
||||
private int sameColourCount = 1;
|
||||
|
||||
protected override double StrainValueOf(DifficultyHitObject current)
|
||||
{
|
||||
double addition = 1;
|
||||
|
||||
// We get an extra addition if we are not a slider or spinner
|
||||
if (current.LastObject is Hit && current.BaseObject is Hit && current.DeltaTime < 1000)
|
||||
{
|
||||
if (hasColourChange(current))
|
||||
addition += 0.75;
|
||||
|
||||
if (hasRhythmChange(current))
|
||||
addition += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastColourSwitch = ColourSwitch.None;
|
||||
sameColourCount = 1;
|
||||
}
|
||||
|
||||
double additionFactor = 1;
|
||||
|
||||
// Scale the addition factor linearly from 0.4 to 1 for DeltaTime from 0 to 50
|
||||
if (current.DeltaTime < 50)
|
||||
additionFactor = 0.4 + 0.6 * current.DeltaTime / 50;
|
||||
|
||||
return additionFactor * addition;
|
||||
}
|
||||
|
||||
private bool hasRhythmChange(DifficultyHitObject current)
|
||||
{
|
||||
// We don't want a division by zero if some random mapper decides to put two HitObjects at the same time.
|
||||
if (current.DeltaTime == 0 || Previous.Count == 0 || Previous[0].DeltaTime == 0)
|
||||
return false;
|
||||
|
||||
double timeElapsedRatio = Math.Max(Previous[0].DeltaTime / current.DeltaTime, current.DeltaTime / Previous[0].DeltaTime);
|
||||
|
||||
if (timeElapsedRatio >= 8)
|
||||
return false;
|
||||
|
||||
double difference = Math.Log(timeElapsedRatio, rhythm_change_base) % 1.0;
|
||||
|
||||
return difference > rhythm_change_base_threshold && difference < 1 - rhythm_change_base_threshold;
|
||||
}
|
||||
|
||||
private bool hasColourChange(DifficultyHitObject current)
|
||||
{
|
||||
var taikoCurrent = (TaikoDifficultyHitObject)current;
|
||||
|
||||
if (!taikoCurrent.HasTypeChange)
|
||||
{
|
||||
sameColourCount++;
|
||||
return false;
|
||||
}
|
||||
|
||||
var oldColourSwitch = lastColourSwitch;
|
||||
var newColourSwitch = sameColourCount % 2 == 0 ? ColourSwitch.Even : ColourSwitch.Odd;
|
||||
|
||||
lastColourSwitch = newColourSwitch;
|
||||
sameColourCount = 1;
|
||||
|
||||
// We only want a bonus if the parity of the color switch changes
|
||||
return oldColourSwitch != ColourSwitch.None && oldColourSwitch != newColourSwitch;
|
||||
}
|
||||
|
||||
private enum ColourSwitch
|
||||
{
|
||||
None,
|
||||
Even,
|
||||
Odd
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Difficulty
|
||||
{
|
||||
@ -10,10 +9,5 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
||||
{
|
||||
public double GreatHitWindow;
|
||||
public int MaxCombo;
|
||||
|
||||
public TaikoDifficultyAttributes(Mod[] mods, double starRating)
|
||||
: base(mods, starRating)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,137 +1,51 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Difficulty.Skills;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Taiko.Difficulty.Skills;
|
||||
using osu.Game.Rulesets.Taiko.Mods;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Difficulty
|
||||
{
|
||||
internal class TaikoDifficultyCalculator : DifficultyCalculator
|
||||
public class TaikoDifficultyCalculator : DifficultyCalculator
|
||||
{
|
||||
private const double star_scaling_factor = 0.04125;
|
||||
|
||||
/// <summary>
|
||||
/// In milliseconds. For difficulty calculation we will only look at the highest strain value in each time interval of size STRAIN_STEP.
|
||||
/// This is to eliminate higher influence of stream over aim by simply having more HitObjects with high strain.
|
||||
/// The higher this value, the less strains there will be, indirectly giving long beatmaps an advantage.
|
||||
/// </summary>
|
||||
private const double strain_step = 400;
|
||||
|
||||
/// <summary>
|
||||
/// The weighting of each strain value decays to this number * it's previous value
|
||||
/// </summary>
|
||||
private const double decay_weight = 0.9;
|
||||
|
||||
public TaikoDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||
: base(ruleset, beatmap)
|
||||
{
|
||||
}
|
||||
|
||||
protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate)
|
||||
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
|
||||
{
|
||||
if (!beatmap.HitObjects.Any())
|
||||
return new TaikoDifficultyAttributes(mods, 0);
|
||||
if (beatmap.HitObjects.Count == 0)
|
||||
return new TaikoDifficultyAttributes { Mods = mods };
|
||||
|
||||
var difficultyHitObjects = new List<TaikoHitObjectDifficulty>();
|
||||
|
||||
foreach (var hitObject in beatmap.HitObjects)
|
||||
difficultyHitObjects.Add(new TaikoHitObjectDifficulty((TaikoHitObject)hitObject));
|
||||
|
||||
// Sort DifficultyHitObjects by StartTime of the HitObjects - just to make sure.
|
||||
difficultyHitObjects.Sort((a, b) => a.BaseHitObject.StartTime.CompareTo(b.BaseHitObject.StartTime));
|
||||
|
||||
if (!calculateStrainValues(difficultyHitObjects, timeRate))
|
||||
return new TaikoDifficultyAttributes(mods, 0);
|
||||
|
||||
double starRating = calculateDifficulty(difficultyHitObjects, timeRate) * star_scaling_factor;
|
||||
|
||||
return new TaikoDifficultyAttributes(mods, starRating)
|
||||
return new TaikoDifficultyAttributes
|
||||
{
|
||||
// Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be remoevd in the future
|
||||
GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate,
|
||||
MaxCombo = beatmap.HitObjects.Count(h => h is Hit)
|
||||
StarRating = skills.Single().DifficultyValue() * star_scaling_factor,
|
||||
Mods = mods,
|
||||
// Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future
|
||||
GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / clockRate,
|
||||
MaxCombo = beatmap.HitObjects.Count(h => h is Hit),
|
||||
};
|
||||
}
|
||||
|
||||
private bool calculateStrainValues(List<TaikoHitObjectDifficulty> objects, double timeRate)
|
||||
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate)
|
||||
{
|
||||
// Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment.
|
||||
using (var hitObjectsEnumerator = objects.GetEnumerator())
|
||||
{
|
||||
if (!hitObjectsEnumerator.MoveNext()) return false;
|
||||
|
||||
TaikoHitObjectDifficulty current = hitObjectsEnumerator.Current;
|
||||
|
||||
// First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See DifficultyHitObject.
|
||||
while (hitObjectsEnumerator.MoveNext())
|
||||
{
|
||||
var next = hitObjectsEnumerator.Current;
|
||||
next?.CalculateStrains(current, timeRate);
|
||||
current = next;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
for (int i = 1; i < beatmap.HitObjects.Count; i++)
|
||||
yield return new TaikoDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate);
|
||||
}
|
||||
|
||||
private double calculateDifficulty(List<TaikoHitObjectDifficulty> objects, double timeRate)
|
||||
{
|
||||
double actualStrainStep = strain_step * timeRate;
|
||||
|
||||
// Find the highest strain value within each strain step
|
||||
List<double> highestStrains = new List<double>();
|
||||
double intervalEndTime = actualStrainStep;
|
||||
double maximumStrain = 0; // We need to keep track of the maximum strain in the current interval
|
||||
|
||||
TaikoHitObjectDifficulty previousHitObject = null;
|
||||
foreach (var hitObject in objects)
|
||||
{
|
||||
// While we are beyond the current interval push the currently available maximum to our strain list
|
||||
while (hitObject.BaseHitObject.StartTime > intervalEndTime)
|
||||
{
|
||||
highestStrains.Add(maximumStrain);
|
||||
|
||||
// The maximum strain of the next interval is not zero by default! We need to take the last hitObject we encountered, take its strain and apply the decay
|
||||
// until the beginning of the next interval.
|
||||
if (previousHitObject == null)
|
||||
{
|
||||
maximumStrain = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
double decay = Math.Pow(TaikoHitObjectDifficulty.DECAY_BASE, (intervalEndTime - previousHitObject.BaseHitObject.StartTime) / 1000);
|
||||
maximumStrain = previousHitObject.Strain * decay;
|
||||
}
|
||||
|
||||
// Go to the next time interval
|
||||
intervalEndTime += actualStrainStep;
|
||||
}
|
||||
|
||||
// Obtain maximum strain
|
||||
maximumStrain = Math.Max(hitObject.Strain, maximumStrain);
|
||||
|
||||
previousHitObject = hitObject;
|
||||
}
|
||||
|
||||
// Build the weighted sum over the highest strains for each interval
|
||||
double difficulty = 0;
|
||||
double weight = 1;
|
||||
highestStrains.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain.
|
||||
|
||||
foreach (double strain in highestStrains)
|
||||
{
|
||||
difficulty += weight * strain;
|
||||
weight *= decay_weight;
|
||||
}
|
||||
|
||||
return difficulty;
|
||||
}
|
||||
protected override Skill[] CreateSkills(IBeatmap beatmap) => new Skill[] { new Strain() };
|
||||
|
||||
protected override Mod[] DifficultyAdjustmentMods => new Mod[]
|
||||
{
|
||||
|
@ -1,127 +0,0 @@
|
||||
// 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;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects
|
||||
{
|
||||
internal class TaikoHitObjectDifficulty
|
||||
{
|
||||
/// <summary>
|
||||
/// Factor by how much individual / overall strain decays per second.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// These values are results of tweaking a lot and taking into account general feedback.
|
||||
/// </remarks>
|
||||
internal const double DECAY_BASE = 0.30;
|
||||
|
||||
private const double type_change_bonus = 0.75;
|
||||
private const double rhythm_change_bonus = 1.0;
|
||||
private const double rhythm_change_base_threshold = 0.2;
|
||||
private const double rhythm_change_base = 2.0;
|
||||
|
||||
internal TaikoHitObject BaseHitObject;
|
||||
|
||||
/// <summary>
|
||||
/// Measures note density in a way
|
||||
/// </summary>
|
||||
internal double Strain = 1;
|
||||
|
||||
private double timeElapsed;
|
||||
private int sameTypeSince = 1;
|
||||
|
||||
private bool isRim => BaseHitObject is RimHit;
|
||||
|
||||
public TaikoHitObjectDifficulty(TaikoHitObject baseHitObject)
|
||||
{
|
||||
BaseHitObject = baseHitObject;
|
||||
}
|
||||
|
||||
internal void CalculateStrains(TaikoHitObjectDifficulty previousHitObject, double timeRate)
|
||||
{
|
||||
// Rather simple, but more specialized things are inherently inaccurate due to the big difference playstyles and opinions make.
|
||||
// See Taiko feedback thread.
|
||||
timeElapsed = (BaseHitObject.StartTime - previousHitObject.BaseHitObject.StartTime) / timeRate;
|
||||
double decay = Math.Pow(DECAY_BASE, timeElapsed / 1000);
|
||||
|
||||
double addition = 1;
|
||||
|
||||
// Only if we are no slider or spinner we get an extra addition
|
||||
if (previousHitObject.BaseHitObject is Hit && BaseHitObject is Hit
|
||||
&& BaseHitObject.StartTime - previousHitObject.BaseHitObject.StartTime < 1000) // And we only want to check out hitobjects which aren't so far in the past
|
||||
{
|
||||
addition += typeChangeAddition(previousHitObject);
|
||||
addition += rhythmChangeAddition(previousHitObject);
|
||||
}
|
||||
|
||||
double additionFactor = 1.0;
|
||||
// Scale AdditionFactor linearly from 0.4 to 1 for TimeElapsed from 0 to 50
|
||||
if (timeElapsed < 50.0)
|
||||
additionFactor = 0.4 + 0.6 * timeElapsed / 50.0;
|
||||
|
||||
Strain = previousHitObject.Strain * decay + addition * additionFactor;
|
||||
}
|
||||
|
||||
private TypeSwitch lastTypeSwitchEven = TypeSwitch.None;
|
||||
private double typeChangeAddition(TaikoHitObjectDifficulty previousHitObject)
|
||||
{
|
||||
// If we don't have the same hit type, trigger a type change!
|
||||
if (previousHitObject.isRim != isRim)
|
||||
{
|
||||
lastTypeSwitchEven = previousHitObject.sameTypeSince % 2 == 0 ? TypeSwitch.Even : TypeSwitch.Odd;
|
||||
|
||||
// We only want a bonus if the parity of the type switch changes!
|
||||
switch (previousHitObject.lastTypeSwitchEven)
|
||||
{
|
||||
case TypeSwitch.Even:
|
||||
if (lastTypeSwitchEven == TypeSwitch.Odd)
|
||||
return type_change_bonus;
|
||||
break;
|
||||
case TypeSwitch.Odd:
|
||||
if (lastTypeSwitchEven == TypeSwitch.Even)
|
||||
return type_change_bonus;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// No type change? Increment counter and keep track of last type switch
|
||||
else
|
||||
{
|
||||
lastTypeSwitchEven = previousHitObject.lastTypeSwitchEven;
|
||||
sameTypeSince = previousHitObject.sameTypeSince + 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private double rhythmChangeAddition(TaikoHitObjectDifficulty previousHitObject)
|
||||
{
|
||||
// We don't want a division by zero if some random mapper decides to put 2 HitObjects at the same time.
|
||||
if (timeElapsed == 0 || previousHitObject.timeElapsed == 0)
|
||||
return 0;
|
||||
|
||||
double timeElapsedRatio = Math.Max(previousHitObject.timeElapsed / timeElapsed, timeElapsed / previousHitObject.timeElapsed);
|
||||
|
||||
if (timeElapsedRatio >= 8)
|
||||
return 0;
|
||||
|
||||
double difference = Math.Log(timeElapsedRatio, rhythm_change_base) % 1.0;
|
||||
|
||||
if (isWithinChangeThreshold(difference))
|
||||
return rhythm_change_bonus;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private bool isWithinChangeThreshold(double value)
|
||||
{
|
||||
return value > rhythm_change_base_threshold && value < 1 - rhythm_change_base_threshold;
|
||||
}
|
||||
|
||||
private enum TypeSwitch
|
||||
{
|
||||
None,
|
||||
Even,
|
||||
Odd
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,257 @@
|
||||
osu file format v14
|
||||
|
||||
[General]
|
||||
Mode: 1
|
||||
|
||||
[Difficulty]
|
||||
CircleSize:4
|
||||
OverallDifficulty:7
|
||||
ApproachRate:8.3
|
||||
SliderMultiplier:1.6
|
||||
SliderTickRate:1
|
||||
|
||||
[TimingPoints]
|
||||
500,500,4,2,1,50,1,0
|
||||
62500,-500,4,2,1,50,0,0
|
||||
71000,-100,4,2,1,50,0,0
|
||||
|
||||
[HitObjects]
|
||||
// Same as diffcalc-test with finishers on every note
|
||||
142,122,0,5,4,0:0:0:0:
|
||||
142,122,125,1,4,0:0:0:0:
|
||||
142,122,250,1,4,0:0:0:0:
|
||||
142,122,375,1,4,0:0:0:0:
|
||||
142,122,500,1,4,0:0:0:0:
|
||||
142,122,625,1,4,0:0:0:0:
|
||||
142,122,750,1,4,0:0:0:0:
|
||||
142,122,875,1,4,0:0:0:0:
|
||||
142,122,1000,1,4,0:0:0:0:
|
||||
142,122,1125,1,4,0:0:0:0:
|
||||
142,122,1250,1,4,0:0:0:0:
|
||||
142,122,1375,1,4,0:0:0:0:
|
||||
142,122,1500,1,4,0:0:0:0:
|
||||
119,106,2500,1,6,0:0:0:0:
|
||||
119,106,2625,1,6,0:0:0:0:
|
||||
119,106,2750,1,6,0:0:0:0:
|
||||
119,106,2875,1,6,0:0:0:0:
|
||||
119,106,3000,1,6,0:0:0:0:
|
||||
119,106,3125,1,6,0:0:0:0:
|
||||
119,106,3250,1,6,0:0:0:0:
|
||||
119,106,3375,1,6,0:0:0:0:
|
||||
119,106,3500,1,6,0:0:0:0:
|
||||
119,106,3625,1,6,0:0:0:0:
|
||||
119,106,3750,1,6,0:0:0:0:
|
||||
119,106,3875,1,6,0:0:0:0:
|
||||
119,106,4000,1,6,0:0:0:0:
|
||||
136,90,5000,1,4,0:0:0:0:
|
||||
136,90,5125,1,6,0:0:0:0:
|
||||
136,90,5250,1,4,0:0:0:0:
|
||||
136,90,5375,1,6,0:0:0:0:
|
||||
136,90,5500,1,4,0:0:0:0:
|
||||
136,90,5625,1,6,0:0:0:0:
|
||||
136,90,5750,1,4,0:0:0:0:
|
||||
136,90,5875,1,6,0:0:0:0:
|
||||
136,90,6000,1,4,0:0:0:0:
|
||||
136,90,6125,1,6,0:0:0:0:
|
||||
136,90,6250,1,4,0:0:0:0:
|
||||
136,90,6375,1,6,0:0:0:0:
|
||||
136,90,6500,1,4,0:0:0:0:
|
||||
86,113,7500,1,4,0:0:0:0:
|
||||
86,113,7625,1,4,0:0:0:0:
|
||||
86,113,7750,1,6,0:0:0:0:
|
||||
86,113,7875,1,6,0:0:0:0:
|
||||
86,113,8000,1,4,0:0:0:0:
|
||||
86,113,8125,1,4,0:0:0:0:
|
||||
86,113,8250,1,6,0:0:0:0:
|
||||
86,113,8375,1,6,0:0:0:0:
|
||||
86,113,8500,1,4,0:0:0:0:
|
||||
86,113,8625,1,4,0:0:0:0:
|
||||
86,113,8750,1,6,0:0:0:0:
|
||||
86,113,8875,1,6,0:0:0:0:
|
||||
86,113,9000,1,4,0:0:0:0:
|
||||
146,90,10000,1,4,0:0:0:0:
|
||||
146,90,10125,1,4,0:0:0:0:
|
||||
146,90,10250,1,4,0:0:0:0:
|
||||
146,90,10375,1,6,0:0:0:0:
|
||||
146,90,10500,1,6,0:0:0:0:
|
||||
146,90,10625,1,6,0:0:0:0:
|
||||
146,90,10750,1,4,0:0:0:0:
|
||||
146,90,10875,1,4,0:0:0:0:
|
||||
146,90,11000,1,4,0:0:0:0:
|
||||
146,90,11125,1,6,0:0:0:0:
|
||||
146,90,11250,1,6,0:0:0:0:
|
||||
146,90,11375,1,6,0:0:0:0:
|
||||
146,90,11500,1,4,0:0:0:0:
|
||||
146,90,11625,1,4,0:0:0:0:
|
||||
146,90,11750,1,4,0:0:0:0:
|
||||
146,90,11875,1,6,0:0:0:0:
|
||||
146,90,12000,1,6,0:0:0:0:
|
||||
146,90,12125,1,6,0:0:0:0:
|
||||
146,90,12250,1,4,0:0:0:0:
|
||||
146,90,12375,1,4,0:0:0:0:
|
||||
146,90,12500,1,4,0:0:0:0:
|
||||
69,99,13500,1,4,0:0:0:0:
|
||||
69,99,13625,1,4,0:0:0:0:
|
||||
69,99,13750,1,4,0:0:0:0:
|
||||
69,99,13875,1,6,0:0:0:0:
|
||||
69,99,14000,1,4,0:0:0:0:
|
||||
69,99,14125,1,4,0:0:0:0:
|
||||
69,99,14250,1,4,0:0:0:0:
|
||||
69,99,14375,1,6,0:0:0:0:
|
||||
69,99,14500,1,4,0:0:0:0:
|
||||
69,99,14625,1,4,0:0:0:0:
|
||||
69,99,14750,1,4,0:0:0:0:
|
||||
69,99,14875,1,6,0:0:0:0:
|
||||
69,99,15000,1,4,0:0:0:0:
|
||||
69,99,15125,1,4,0:0:0:0:
|
||||
69,99,15250,1,4,0:0:0:0:
|
||||
69,99,15375,1,6,0:0:0:0:
|
||||
69,99,15500,1,4,0:0:0:0:
|
||||
83,89,16500,1,4,0:0:0:0:
|
||||
83,89,16625,1,6,0:0:0:0:
|
||||
83,89,16750,1,6,0:0:0:0:
|
||||
83,89,16875,1,4,0:0:0:0:
|
||||
83,89,17000,1,4,0:0:0:0:
|
||||
83,89,17125,1,4,0:0:0:0:
|
||||
83,89,17250,1,6,0:0:0:0:
|
||||
83,89,17375,1,6,0:0:0:0:
|
||||
83,89,17500,1,6,0:0:0:0:
|
||||
83,89,17625,1,6,0:0:0:0:
|
||||
83,89,17750,1,4,0:0:0:0:
|
||||
83,89,17875,1,4,0:0:0:0:
|
||||
83,89,18000,1,4,0:0:0:0:
|
||||
83,89,18125,1,4,0:0:0:0:
|
||||
83,89,18250,1,4,0:0:0:0:
|
||||
83,89,18375,1,6,0:0:0:0:
|
||||
83,89,18500,1,6,0:0:0:0:
|
||||
83,89,18625,1,6,0:0:0:0:
|
||||
83,89,18750,1,6,0:0:0:0:
|
||||
83,89,18875,1,4,0:0:0:0:
|
||||
83,89,19000,1,4,0:0:0:0:
|
||||
83,89,19125,1,4,0:0:0:0:
|
||||
83,89,19250,1,4,0:0:0:0:
|
||||
83,89,19375,1,6,0:0:0:0:
|
||||
83,89,19500,1,6,0:0:0:0:
|
||||
83,89,19625,1,4,0:0:0:0:
|
||||
84,122,20500,1,4,0:0:0:0:
|
||||
84,122,20625,2,4,L|217:123,1,120
|
||||
84,122,21125,1,4,0:0:0:0:
|
||||
84,122,21250,2,4,L|217:123,1,120
|
||||
84,122,21750,1,4,0:0:0:0:
|
||||
84,122,21875,2,4,L|217:123,1,120
|
||||
84,122,22375,1,4,0:0:0:0:
|
||||
84,122,22500,2,4,L|217:123,1,120
|
||||
84,122,23000,1,4,0:0:0:0:
|
||||
84,122,23125,2,4,L|217:123,1,120
|
||||
99,106,24500,1,4,0:0:0:0:
|
||||
99,106,24625,1,4,0:0:0:0:
|
||||
99,106,24750,2,4,L|194:107,1,80
|
||||
99,106,25125,1,4,0:0:0:0:
|
||||
99,106,25250,1,4,0:0:0:0:
|
||||
99,106,25375,2,4,L|194:107,1,80
|
||||
99,106,25750,1,4,0:0:0:0:
|
||||
99,106,25875,1,4,0:0:0:0:
|
||||
99,106,26000,2,4,L|194:107,1,80
|
||||
99,106,26375,1,4,0:0:0:0:
|
||||
99,106,26500,1,4,0:0:0:0:
|
||||
99,106,26625,2,4,L|194:107,1,80
|
||||
99,106,27000,1,4,0:0:0:0:
|
||||
99,106,27125,1,4,0:0:0:0:
|
||||
99,106,27250,2,4,L|194:107,1,80
|
||||
121,103,28500,1,4,0:0:0:0:
|
||||
121,103,28625,1,4,0:0:0:0:
|
||||
121,103,28750,1,4,0:0:0:0:
|
||||
121,103,28875,2,4,L|190:103,1,40
|
||||
121,103,29125,1,4,0:0:0:0:
|
||||
121,103,29250,1,4,0:0:0:0:
|
||||
121,103,29375,1,4,0:0:0:0:
|
||||
121,103,29500,2,4,L|190:103,1,40
|
||||
121,103,29750,1,4,0:0:0:0:
|
||||
121,103,29875,1,4,0:0:0:0:
|
||||
121,103,30000,1,4,0:0:0:0:
|
||||
121,103,30125,2,4,L|190:103,1,40
|
||||
121,103,30375,1,4,0:0:0:0:
|
||||
121,103,30500,1,4,0:0:0:0:
|
||||
121,103,30625,1,4,0:0:0:0:
|
||||
121,103,30750,2,4,L|190:103,1,40
|
||||
121,103,31000,1,4,0:0:0:0:
|
||||
121,103,31125,1,4,0:0:0:0:
|
||||
121,103,31250,1,4,0:0:0:0:
|
||||
121,103,31375,2,4,L|190:103,1,40
|
||||
121,103,32500,1,4,0:0:0:0:
|
||||
121,103,32625,1,6,0:0:0:0:
|
||||
121,103,32750,1,4,0:0:0:0:
|
||||
121,103,32875,2,4,L|190:103,1,40
|
||||
121,103,33125,1,4,0:0:0:0:
|
||||
121,103,33250,1,6,0:0:0:0:
|
||||
121,103,33375,1,4,0:0:0:0:
|
||||
121,103,33500,2,4,L|190:103,1,40
|
||||
121,103,33750,1,4,0:0:0:0:
|
||||
121,103,33875,1,6,0:0:0:0:
|
||||
121,103,34000,1,4,0:0:0:0:
|
||||
121,103,34125,2,4,L|190:103,1,40
|
||||
121,103,34375,1,4,0:0:0:0:
|
||||
121,103,34500,1,6,0:0:0:0:
|
||||
121,103,34625,1,4,0:0:0:0:
|
||||
121,103,34750,2,4,L|190:103,1,40
|
||||
121,103,35000,1,4,0:0:0:0:
|
||||
121,103,35125,1,6,0:0:0:0:
|
||||
121,103,35250,1,4,0:0:0:0:
|
||||
121,103,35375,2,4,L|190:103,1,40
|
||||
121,103,36500,1,4,0:0:0:0:
|
||||
121,103,36625,1,4,0:0:0:0:
|
||||
121,103,36750,1,6,0:0:0:0:
|
||||
121,103,36875,2,4,L|190:103,1,40
|
||||
121,103,37125,1,4,0:0:0:0:
|
||||
121,103,37250,1,4,0:0:0:0:
|
||||
121,103,37375,1,6,0:0:0:0:
|
||||
121,103,37500,2,4,L|190:103,1,40
|
||||
121,103,37750,1,4,0:0:0:0:
|
||||
121,103,37875,1,4,0:0:0:0:
|
||||
121,103,38000,1,6,0:0:0:0:
|
||||
121,103,38125,2,4,L|190:103,1,40
|
||||
121,103,38375,1,4,0:0:0:0:
|
||||
121,103,38500,1,4,0:0:0:0:
|
||||
121,103,38625,1,6,0:0:0:0:
|
||||
121,103,38750,2,4,L|190:103,1,40
|
||||
121,103,39000,1,4,0:0:0:0:
|
||||
121,103,39125,1,4,0:0:0:0:
|
||||
121,103,39250,1,6,0:0:0:0:
|
||||
121,103,39375,2,4,L|190:103,1,40
|
||||
107,106,40500,1,4,0:0:0:0:
|
||||
107,106,40625,1,4,0:0:0:0:
|
||||
107,106,40750,1,6,0:0:0:0:
|
||||
107,106,40875,1,6,0:0:0:0:
|
||||
46,112,41000,2,4,L|214:112,1,160
|
||||
107,106,41625,1,4,0:0:0:0:
|
||||
107,106,41750,1,4,0:0:0:0:
|
||||
107,106,41875,1,6,0:0:0:0:
|
||||
107,106,42000,1,6,0:0:0:0:
|
||||
46,112,42125,2,4,L|214:112,1,160
|
||||
107,106,42750,1,4,0:0:0:0:
|
||||
107,106,42875,1,4,0:0:0:0:
|
||||
107,106,43000,1,6,0:0:0:0:
|
||||
107,106,43125,1,6,0:0:0:0:
|
||||
46,112,43250,2,4,L|214:112,1,160
|
||||
107,106,43875,1,4,0:0:0:0:
|
||||
107,106,44000,1,4,0:0:0:0:
|
||||
107,106,44125,1,6,0:0:0:0:
|
||||
107,106,44250,1,6,0:0:0:0:
|
||||
46,112,44375,2,4,L|214:112,1,160
|
||||
107,106,45000,1,4,0:0:0:0:
|
||||
107,106,45125,1,4,0:0:0:0:
|
||||
107,106,45250,1,6,0:0:0:0:
|
||||
107,106,45375,1,6,0:0:0:0:
|
||||
46,112,45500,2,4,L|214:112,1,160
|
||||
256,192,47000,12,4,47500,0:0:0:0:
|
||||
256,192,47625,12,4,48000,0:0:0:0:
|
||||
256,192,48125,12,4,48500,0:0:0:0:
|
||||
256,192,48625,12,4,49000,0:0:0:0:
|
||||
256,192,50000,12,4,50500,0:0:0:0:
|
||||
183,143,50625,5,4,0:0:0:0:
|
||||
256,192,50750,12,4,51250,0:0:0:0:
|
||||
114,106,51375,5,4,0:0:0:0:
|
||||
256,192,51625,12,4,52125,0:0:0:0:
|
||||
154,143,52250,5,4,0:0:0:0:
|
||||
256,192,52375,12,4,52875,0:0:0:0:
|
||||
116,111,53000,5,4,0:0:0:0:
|
@ -0,0 +1,285 @@
|
||||
osu file format v14
|
||||
|
||||
[General]
|
||||
Mode: 1
|
||||
|
||||
[Difficulty]
|
||||
CircleSize:4
|
||||
OverallDifficulty:7
|
||||
ApproachRate:8.3
|
||||
SliderMultiplier:1.6
|
||||
SliderTickRate:1
|
||||
|
||||
[TimingPoints]
|
||||
500,500,4,2,1,50,1,0
|
||||
62500,-500,4,2,1,50,0,0
|
||||
71000,-100,4,2,1,50,0,0
|
||||
|
||||
[HitObjects]
|
||||
// dd, spaced 1/4 beat apart
|
||||
142,122,0,5,0,0:0:0:0:
|
||||
142,122,125,1,0,0:0:0:0:
|
||||
142,122,250,1,0,0:0:0:0:
|
||||
142,122,375,1,0,0:0:0:0:
|
||||
142,122,500,1,0,0:0:0:0:
|
||||
142,122,625,1,0,0:0:0:0:
|
||||
142,122,750,1,0,0:0:0:0:
|
||||
142,122,875,1,0,0:0:0:0:
|
||||
142,122,1000,1,0,0:0:0:0:
|
||||
142,122,1125,1,0,0:0:0:0:
|
||||
142,122,1250,1,0,0:0:0:0:
|
||||
142,122,1375,1,0,0:0:0:0:
|
||||
142,122,1500,1,0,0:0:0:0:
|
||||
|
||||
// kk, spaced 1/4 beat apart
|
||||
119,106,2500,1,2,0:0:0:0:
|
||||
119,106,2625,1,2,0:0:0:0:
|
||||
119,106,2750,1,2,0:0:0:0:
|
||||
119,106,2875,1,2,0:0:0:0:
|
||||
119,106,3000,1,2,0:0:0:0:
|
||||
119,106,3125,1,2,0:0:0:0:
|
||||
119,106,3250,1,2,0:0:0:0:
|
||||
119,106,3375,1,2,0:0:0:0:
|
||||
119,106,3500,1,2,0:0:0:0:
|
||||
119,106,3625,1,2,0:0:0:0:
|
||||
119,106,3750,1,2,0:0:0:0:
|
||||
119,106,3875,1,2,0:0:0:0:
|
||||
119,106,4000,1,2,0:0:0:0:
|
||||
|
||||
// dk, spaced 1/4 beat apart
|
||||
136,90,5000,1,0,0:0:0:0:
|
||||
136,90,5125,1,2,0:0:0:0:
|
||||
136,90,5250,1,0,0:0:0:0:
|
||||
136,90,5375,1,2,0:0:0:0:
|
||||
136,90,5500,1,0,0:0:0:0:
|
||||
136,90,5625,1,2,0:0:0:0:
|
||||
136,90,5750,1,0,0:0:0:0:
|
||||
136,90,5875,1,2,0:0:0:0:
|
||||
136,90,6000,1,0,0:0:0:0:
|
||||
136,90,6125,1,2,0:0:0:0:
|
||||
136,90,6250,1,0,0:0:0:0:
|
||||
136,90,6375,1,2,0:0:0:0:
|
||||
136,90,6500,1,0,0:0:0:0:
|
||||
|
||||
// ddkk, spaced 1/4 beat apart
|
||||
86,113,7500,1,0,0:0:0:0:
|
||||
86,113,7625,1,0,0:0:0:0:
|
||||
86,113,7750,1,2,0:0:0:0:
|
||||
86,113,7875,1,2,0:0:0:0:
|
||||
86,113,8000,1,0,0:0:0:0:
|
||||
86,113,8125,1,0,0:0:0:0:
|
||||
86,113,8250,1,2,0:0:0:0:
|
||||
86,113,8375,1,2,0:0:0:0:
|
||||
86,113,8500,1,0,0:0:0:0:
|
||||
86,113,8625,1,0,0:0:0:0:
|
||||
86,113,8750,1,2,0:0:0:0:
|
||||
86,113,8875,1,2,0:0:0:0:
|
||||
86,113,9000,1,0,0:0:0:0:
|
||||
|
||||
// dddkkk, spaced 1/4 beat apart
|
||||
146,90,10000,1,0,0:0:0:0:
|
||||
146,90,10125,1,0,0:0:0:0:
|
||||
146,90,10250,1,0,0:0:0:0:
|
||||
146,90,10375,1,2,0:0:0:0:
|
||||
146,90,10500,1,2,0:0:0:0:
|
||||
146,90,10625,1,2,0:0:0:0:
|
||||
146,90,10750,1,0,0:0:0:0:
|
||||
146,90,10875,1,0,0:0:0:0:
|
||||
146,90,11000,1,0,0:0:0:0:
|
||||
146,90,11125,1,2,0:0:0:0:
|
||||
146,90,11250,1,2,0:0:0:0:
|
||||
146,90,11375,1,2,0:0:0:0:
|
||||
146,90,11500,1,0,0:0:0:0:
|
||||
146,90,11625,1,0,0:0:0:0:
|
||||
146,90,11750,1,0,0:0:0:0:
|
||||
146,90,11875,1,2,0:0:0:0:
|
||||
146,90,12000,1,2,0:0:0:0:
|
||||
146,90,12125,1,2,0:0:0:0:
|
||||
146,90,12250,1,0,0:0:0:0:
|
||||
146,90,12375,1,0,0:0:0:0:
|
||||
146,90,12500,1,0,0:0:0:0:
|
||||
|
||||
// dddk, spaced 1/4 beat apart
|
||||
69,99,13500,1,0,0:0:0:0:
|
||||
69,99,13625,1,0,0:0:0:0:
|
||||
69,99,13750,1,0,0:0:0:0:
|
||||
69,99,13875,1,2,0:0:0:0:
|
||||
69,99,14000,1,0,0:0:0:0:
|
||||
69,99,14125,1,0,0:0:0:0:
|
||||
69,99,14250,1,0,0:0:0:0:
|
||||
69,99,14375,1,2,0:0:0:0:
|
||||
69,99,14500,1,0,0:0:0:0:
|
||||
69,99,14625,1,0,0:0:0:0:
|
||||
69,99,14750,1,0,0:0:0:0:
|
||||
69,99,14875,1,2,0:0:0:0:
|
||||
69,99,15000,1,0,0:0:0:0:
|
||||
69,99,15125,1,0,0:0:0:0:
|
||||
69,99,15250,1,0,0:0:0:0:
|
||||
69,99,15375,1,2,0:0:0:0:
|
||||
69,99,15500,1,0,0:0:0:0:
|
||||
|
||||
// arbitrary pattern, spaced 1/4 beat apart
|
||||
83,89,16500,1,0,0:0:0:0:
|
||||
83,89,16625,1,2,0:0:0:0:
|
||||
83,89,16750,1,2,0:0:0:0:
|
||||
83,89,16875,1,0,0:0:0:0:
|
||||
83,89,17000,1,0,0:0:0:0:
|
||||
83,89,17125,1,0,0:0:0:0:
|
||||
83,89,17250,1,2,0:0:0:0:
|
||||
83,89,17375,1,2,0:0:0:0:
|
||||
83,89,17500,1,2,0:0:0:0:
|
||||
83,89,17625,1,2,0:0:0:0:
|
||||
83,89,17750,1,0,0:0:0:0:
|
||||
83,89,17875,1,0,0:0:0:0:
|
||||
83,89,18000,1,0,0:0:0:0:
|
||||
83,89,18125,1,0,0:0:0:0:
|
||||
83,89,18250,1,0,0:0:0:0:
|
||||
83,89,18375,1,2,0:0:0:0:
|
||||
83,89,18500,1,2,0:0:0:0:
|
||||
83,89,18625,1,2,0:0:0:0:
|
||||
83,89,18750,1,2,0:0:0:0:
|
||||
83,89,18875,1,0,0:0:0:0:
|
||||
83,89,19000,1,0,0:0:0:0:
|
||||
83,89,19125,1,0,0:0:0:0:
|
||||
83,89,19250,1,0,0:0:0:0:
|
||||
83,89,19375,1,2,0:0:0:0:
|
||||
83,89,19500,1,2,0:0:0:0:
|
||||
83,89,19625,1,0,0:0:0:0:
|
||||
|
||||
// d-slider pattern, spaced 1/4 beat apart
|
||||
84,122,20500,1,0,0:0:0:0:
|
||||
84,122,20625,2,0,L|217:123,1,120
|
||||
84,122,21125,1,0,0:0:0:0:
|
||||
84,122,21250,2,0,L|217:123,1,120
|
||||
84,122,21750,1,0,0:0:0:0:
|
||||
84,122,21875,2,0,L|217:123,1,120
|
||||
84,122,22375,1,0,0:0:0:0:
|
||||
84,122,22500,2,0,L|217:123,1,120
|
||||
84,122,23000,1,0,0:0:0:0:
|
||||
84,122,23125,2,0,L|217:123,1,120
|
||||
|
||||
// dd-slider pattern, spaced 1/4 beat apart
|
||||
99,106,24500,1,0,0:0:0:0:
|
||||
99,106,24625,1,0,0:0:0:0:
|
||||
99,106,24750,2,0,L|194:107,1,80
|
||||
99,106,25125,1,0,0:0:0:0:
|
||||
99,106,25250,1,0,0:0:0:0:
|
||||
99,106,25375,2,0,L|194:107,1,80
|
||||
99,106,25750,1,0,0:0:0:0:
|
||||
99,106,25875,1,0,0:0:0:0:
|
||||
99,106,26000,2,0,L|194:107,1,80
|
||||
99,106,26375,1,0,0:0:0:0:
|
||||
99,106,26500,1,0,0:0:0:0:
|
||||
99,106,26625,2,0,L|194:107,1,80
|
||||
99,106,27000,1,0,0:0:0:0:
|
||||
99,106,27125,1,0,0:0:0:0:
|
||||
99,106,27250,2,0,L|194:107,1,80
|
||||
|
||||
// ddd-slider pattern, spaced 1/4 beat apart
|
||||
121,103,28500,1,0,0:0:0:0:
|
||||
121,103,28625,1,0,0:0:0:0:
|
||||
121,103,28750,1,0,0:0:0:0:
|
||||
121,103,28875,2,0,L|190:103,1,40
|
||||
121,103,29125,1,0,0:0:0:0:
|
||||
121,103,29250,1,0,0:0:0:0:
|
||||
121,103,29375,1,0,0:0:0:0:
|
||||
121,103,29500,2,0,L|190:103,1,40
|
||||
121,103,29750,1,0,0:0:0:0:
|
||||
121,103,29875,1,0,0:0:0:0:
|
||||
121,103,30000,1,0,0:0:0:0:
|
||||
121,103,30125,2,0,L|190:103,1,40
|
||||
121,103,30375,1,0,0:0:0:0:
|
||||
121,103,30500,1,0,0:0:0:0:
|
||||
121,103,30625,1,0,0:0:0:0:
|
||||
121,103,30750,2,0,L|190:103,1,40
|
||||
121,103,31000,1,0,0:0:0:0:
|
||||
121,103,31125,1,0,0:0:0:0:
|
||||
121,103,31250,1,0,0:0:0:0:
|
||||
121,103,31375,2,0,L|190:103,1,40
|
||||
|
||||
// dkd-slider pattern, spaced 1/4 beat apart
|
||||
121,103,32500,1,0,0:0:0:0:
|
||||
121,103,32625,1,2,0:0:0:0:
|
||||
121,103,32750,1,0,0:0:0:0:
|
||||
121,103,32875,2,0,L|190:103,1,40
|
||||
121,103,33125,1,0,0:0:0:0:
|
||||
121,103,33250,1,2,0:0:0:0:
|
||||
121,103,33375,1,0,0:0:0:0:
|
||||
121,103,33500,2,0,L|190:103,1,40
|
||||
121,103,33750,1,0,0:0:0:0:
|
||||
121,103,33875,1,2,0:0:0:0:
|
||||
121,103,34000,1,0,0:0:0:0:
|
||||
121,103,34125,2,0,L|190:103,1,40
|
||||
121,103,34375,1,0,0:0:0:0:
|
||||
121,103,34500,1,2,0:0:0:0:
|
||||
121,103,34625,1,0,0:0:0:0:
|
||||
121,103,34750,2,0,L|190:103,1,40
|
||||
121,103,35000,1,0,0:0:0:0:
|
||||
121,103,35125,1,2,0:0:0:0:
|
||||
121,103,35250,1,0,0:0:0:0:
|
||||
121,103,35375,2,0,L|190:103,1,40
|
||||
|
||||
//ddk-slider pattern, spaced 1/4 beat apart
|
||||
121,103,36500,1,0,0:0:0:0:
|
||||
121,103,36625,1,0,0:0:0:0:
|
||||
121,103,36750,1,2,0:0:0:0:
|
||||
121,103,36875,2,0,L|190:103,1,40
|
||||
121,103,37125,1,0,0:0:0:0:
|
||||
121,103,37250,1,0,0:0:0:0:
|
||||
121,103,37375,1,2,0:0:0:0:
|
||||
121,103,37500,2,0,L|190:103,1,40
|
||||
121,103,37750,1,0,0:0:0:0:
|
||||
121,103,37875,1,0,0:0:0:0:
|
||||
121,103,38000,1,2,0:0:0:0:
|
||||
121,103,38125,2,0,L|190:103,1,40
|
||||
121,103,38375,1,0,0:0:0:0:
|
||||
121,103,38500,1,0,0:0:0:0:
|
||||
121,103,38625,1,2,0:0:0:0:
|
||||
121,103,38750,2,0,L|190:103,1,40
|
||||
121,103,39000,1,0,0:0:0:0:
|
||||
121,103,39125,1,0,0:0:0:0:
|
||||
121,103,39250,1,2,0:0:0:0:
|
||||
121,103,39375,2,0,L|190:103,1,40
|
||||
|
||||
//ddkk-slider pattern, spaced 1/4 beat apart
|
||||
107,106,40500,1,0,0:0:0:0:
|
||||
107,106,40625,1,0,0:0:0:0:
|
||||
107,106,40750,1,2,0:0:0:0:
|
||||
107,106,40875,1,2,0:0:0:0:
|
||||
46,112,41000,2,0,L|214:112,1,160
|
||||
107,106,41625,1,0,0:0:0:0:
|
||||
107,106,41750,1,0,0:0:0:0:
|
||||
107,106,41875,1,2,0:0:0:0:
|
||||
107,106,42000,1,2,0:0:0:0:
|
||||
46,112,42125,2,0,L|214:112,1,160
|
||||
107,106,42750,1,0,0:0:0:0:
|
||||
107,106,42875,1,0,0:0:0:0:
|
||||
107,106,43000,1,2,0:0:0:0:
|
||||
107,106,43125,1,2,0:0:0:0:
|
||||
46,112,43250,2,0,L|214:112,1,160
|
||||
107,106,43875,1,0,0:0:0:0:
|
||||
107,106,44000,1,0,0:0:0:0:
|
||||
107,106,44125,1,2,0:0:0:0:
|
||||
107,106,44250,1,2,0:0:0:0:
|
||||
46,112,44375,2,0,L|214:112,1,160
|
||||
107,106,45000,1,0,0:0:0:0:
|
||||
107,106,45125,1,0,0:0:0:0:
|
||||
107,106,45250,1,2,0:0:0:0:
|
||||
107,106,45375,1,2,0:0:0:0:
|
||||
46,112,45500,2,0,L|214:112,1,160
|
||||
|
||||
// spinner-spinner pattern, spaced 1/4 beat apart
|
||||
256,192,47000,12,0,47500,0:0:0:0:
|
||||
256,192,47625,12,0,48000,0:0:0:0:
|
||||
256,192,48125,12,0,48500,0:0:0:0:
|
||||
256,192,48625,12,0,49000,0:0:0:0:
|
||||
|
||||
// spinner-d pattern, spaced 1/4 beat apart
|
||||
256,192,50000,12,0,50500,0:0:0:0:
|
||||
183,143,50625,5,0,0:0:0:0:
|
||||
256,192,50750,12,0,51250,0:0:0:0:
|
||||
114,106,51375,5,0,0:0:0:0:
|
||||
256,192,51625,12,0,52125,0:0:0:0:
|
||||
154,143,52250,5,0,0:0:0:0:
|
||||
256,192,52375,12,0,52875,0:0:0:0:
|
||||
116,111,53000,5,0,0:0:0:0:
|
@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Taiko
|
||||
|
||||
public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_taiko_o };
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(this, beatmap);
|
||||
public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(this, beatmap);
|
||||
|
||||
public override PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => new TaikoPerformanceCalculator(this, beatmap, score);
|
||||
|
||||
|
@ -10,4 +10,4 @@
|
||||
<ItemGroup Label="Project References">
|
||||
<ProjectReference Include="..\osu.Game\osu.Game.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestNoMods()
|
||||
{
|
||||
var combinations = new TestDifficultyCalculator().CreateDifficultyAdjustmentModCombinations();
|
||||
var combinations = new TestLegacyDifficultyCalculator().CreateDifficultyAdjustmentModCombinations();
|
||||
|
||||
Assert.AreEqual(1, combinations.Length);
|
||||
Assert.IsTrue(combinations[0] is ModNoMod);
|
||||
@ -24,7 +24,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestSingleMod()
|
||||
{
|
||||
var combinations = new TestDifficultyCalculator(new ModA()).CreateDifficultyAdjustmentModCombinations();
|
||||
var combinations = new TestLegacyDifficultyCalculator(new ModA()).CreateDifficultyAdjustmentModCombinations();
|
||||
|
||||
Assert.AreEqual(2, combinations.Length);
|
||||
Assert.IsTrue(combinations[0] is ModNoMod);
|
||||
@ -34,7 +34,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestDoubleMod()
|
||||
{
|
||||
var combinations = new TestDifficultyCalculator(new ModA(), new ModB()).CreateDifficultyAdjustmentModCombinations();
|
||||
var combinations = new TestLegacyDifficultyCalculator(new ModA(), new ModB()).CreateDifficultyAdjustmentModCombinations();
|
||||
|
||||
Assert.AreEqual(4, combinations.Length);
|
||||
Assert.IsTrue(combinations[0] is ModNoMod);
|
||||
@ -49,7 +49,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestIncompatibleMods()
|
||||
{
|
||||
var combinations = new TestDifficultyCalculator(new ModA(), new ModIncompatibleWithA()).CreateDifficultyAdjustmentModCombinations();
|
||||
var combinations = new TestLegacyDifficultyCalculator(new ModA(), new ModIncompatibleWithA()).CreateDifficultyAdjustmentModCombinations();
|
||||
|
||||
Assert.AreEqual(3, combinations.Length);
|
||||
Assert.IsTrue(combinations[0] is ModNoMod);
|
||||
@ -60,7 +60,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestDoubleIncompatibleMods()
|
||||
{
|
||||
var combinations = new TestDifficultyCalculator(new ModA(), new ModB(), new ModIncompatibleWithA(), new ModIncompatibleWithAAndB()).CreateDifficultyAdjustmentModCombinations();
|
||||
var combinations = new TestLegacyDifficultyCalculator(new ModA(), new ModB(), new ModIncompatibleWithA(), new ModIncompatibleWithAAndB()).CreateDifficultyAdjustmentModCombinations();
|
||||
|
||||
Assert.AreEqual(8, combinations.Length);
|
||||
Assert.IsTrue(combinations[0] is ModNoMod);
|
||||
@ -83,7 +83,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestIncompatibleThroughBaseType()
|
||||
{
|
||||
var combinations = new TestDifficultyCalculator(new ModAofA(), new ModIncompatibleWithAofA()).CreateDifficultyAdjustmentModCombinations();
|
||||
var combinations = new TestLegacyDifficultyCalculator(new ModAofA(), new ModIncompatibleWithAofA()).CreateDifficultyAdjustmentModCombinations();
|
||||
|
||||
Assert.AreEqual(3, combinations.Length);
|
||||
Assert.IsTrue(combinations[0] is ModNoMod);
|
||||
@ -136,9 +136,9 @@ namespace osu.Game.Tests.NonVisual
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModA), typeof(ModB) };
|
||||
}
|
||||
|
||||
private class TestDifficultyCalculator : DifficultyCalculator
|
||||
private class TestLegacyDifficultyCalculator : LegacyDifficultyCalculator
|
||||
{
|
||||
public TestDifficultyCalculator(params Mod[] mods)
|
||||
public TestLegacyDifficultyCalculator(params Mod[] mods)
|
||||
: base(null, null)
|
||||
{
|
||||
DifficultyAdjustmentMods = mods;
|
||||
@ -146,7 +146,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
|
||||
protected override Mod[] DifficultyAdjustmentMods { get; }
|
||||
|
||||
protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate) => throw new NotImplementedException();
|
||||
protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
115
osu.Game.Tests/NonVisual/LimitedCapacityStackTest.cs
Normal file
115
osu.Game.Tests/NonVisual/LimitedCapacityStackTest.cs
Normal file
@ -0,0 +1,115 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Game.Rulesets.Difficulty.Utils;
|
||||
|
||||
namespace osu.Game.Tests.NonVisual
|
||||
{
|
||||
[TestFixture]
|
||||
public class LimitedCapacityStackTest
|
||||
{
|
||||
private const int capacity = 3;
|
||||
|
||||
private LimitedCapacityStack<int> stack;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
stack = new LimitedCapacityStack<int>(capacity);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEmptyStack()
|
||||
{
|
||||
Assert.AreEqual(0, stack.Count);
|
||||
|
||||
Assert.Throws<IndexOutOfRangeException>(() =>
|
||||
{
|
||||
int unused = stack[0];
|
||||
});
|
||||
|
||||
int count = 0;
|
||||
foreach (var unused in stack)
|
||||
count++;
|
||||
|
||||
Assert.AreEqual(0, count);
|
||||
}
|
||||
|
||||
[TestCase(1)]
|
||||
[TestCase(2)]
|
||||
[TestCase(3)]
|
||||
public void TestInRangeElements(int count)
|
||||
{
|
||||
// e.g. 0 -> 1 -> 2
|
||||
for (int i = 0; i < count; i++)
|
||||
stack.Push(i);
|
||||
|
||||
Assert.AreEqual(count, stack.Count);
|
||||
|
||||
// e.g. 2 -> 1 -> 0 (reverse order)
|
||||
for (int i = 0; i < stack.Count; i++)
|
||||
Assert.AreEqual(count - 1 - i, stack[i]);
|
||||
|
||||
// e.g. indices 3, 4, 5, 6 (out of range)
|
||||
for (int i = stack.Count; i < stack.Count + capacity; i++)
|
||||
{
|
||||
Assert.Throws<IndexOutOfRangeException>(() =>
|
||||
{
|
||||
int unused = stack[i];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(4)]
|
||||
[TestCase(5)]
|
||||
[TestCase(6)]
|
||||
public void TestOverflowElements(int count)
|
||||
{
|
||||
// e.g. 0 -> 1 -> 2 -> 3
|
||||
for (int i = 0; i < count; i++)
|
||||
stack.Push(i);
|
||||
|
||||
Assert.AreEqual(capacity, stack.Count);
|
||||
|
||||
// e.g. 3 -> 2 -> 1 (reverse order)
|
||||
for (int i = 0; i < stack.Count; i++)
|
||||
Assert.AreEqual(count - 1 - i, stack[i]);
|
||||
|
||||
// e.g. indices 3, 4, 5, 6 (out of range)
|
||||
for (int i = stack.Count; i < stack.Count + capacity; i++)
|
||||
{
|
||||
Assert.Throws<IndexOutOfRangeException>(() =>
|
||||
{
|
||||
int unused = stack[i];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(1)]
|
||||
[TestCase(2)]
|
||||
[TestCase(3)]
|
||||
[TestCase(4)]
|
||||
[TestCase(5)]
|
||||
[TestCase(6)]
|
||||
public void TestEnumerator(int count)
|
||||
{
|
||||
// e.g. 0 -> 1 -> 2 -> 3
|
||||
for (int i = 0; i < count; i++)
|
||||
stack.Push(i);
|
||||
|
||||
int enumeratorCount = 0;
|
||||
int expectedValue = count - 1;
|
||||
|
||||
foreach (var item in stack)
|
||||
{
|
||||
Assert.AreEqual(expectedValue, item);
|
||||
enumeratorCount++;
|
||||
expectedValue--;
|
||||
}
|
||||
|
||||
Assert.AreEqual(stack.Count, enumeratorCount);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,27 +2,16 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public class TestCaseDisclaimer : OsuTestCase
|
||||
public class TestCaseDisclaimer : ScreenTestCase
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
},
|
||||
new Disclaimer()
|
||||
};
|
||||
LoadScreen(new Disclaimer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,11 +9,11 @@ using osu.Game.Screens.Tournament.Teams;
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
[Description("for tournament use")]
|
||||
public class TestCaseDrawings : OsuTestCase
|
||||
public class TestCaseDrawings : ScreenTestCase
|
||||
{
|
||||
public TestCaseDrawings()
|
||||
{
|
||||
Add(new Drawings
|
||||
LoadScreen(new Drawings
|
||||
{
|
||||
TeamList = new TestTeamList(),
|
||||
});
|
||||
|
@ -40,10 +40,10 @@ namespace osu.Game.Tests.Visual
|
||||
Room.RoomID.Value = 1;
|
||||
Room.Name.Value = "an awesome room";
|
||||
|
||||
Child = new TestMatchResults(new ScoreInfo
|
||||
LoadScreen(new TestMatchResults(new ScoreInfo
|
||||
{
|
||||
User = new User { Id = 10 },
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
private class TestMatchResults : MatchResults
|
||||
|
@ -4,7 +4,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Screens.Multi;
|
||||
using osu.Game.Screens.Multi.Lounge;
|
||||
using osu.Game.Screens.Multi.Lounge.Components;
|
||||
@ -12,7 +11,7 @@ using osu.Game.Screens.Multi.Lounge.Components;
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestCaseMultiScreen : OsuTestCase
|
||||
public class TestCaseMultiScreen : ScreenTestCase
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
@ -25,9 +24,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
Multiplayer multi = new Multiplayer();
|
||||
|
||||
AddStep(@"show", () => Add(multi));
|
||||
AddWaitStep(5);
|
||||
AddStep(@"exit", multi.Exit);
|
||||
AddStep(@"show", () => LoadScreen(multi));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osuTK.Graphics;
|
||||
@ -29,7 +30,10 @@ namespace osu.Game.Tests.Visual
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
},
|
||||
new Loader()
|
||||
new ScreenStack(new Loader())
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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 osu.Framework.Graphics;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
|
||||
@ -14,7 +16,10 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
Add(parallax = new ParallaxContainer
|
||||
{
|
||||
Child = new BackgroundScreenDefault { Alpha = 0.8f }
|
||||
Child = new ScreenStack(new BackgroundScreenDefault { Alpha = 0.8f })
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
}
|
||||
});
|
||||
|
||||
AddStep("default parallax", () => parallax.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT);
|
||||
|
@ -12,6 +12,7 @@ using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Rulesets;
|
||||
@ -25,7 +26,7 @@ using osu.Game.Screens.Select.Filter;
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestCasePlaySongSelect : OsuTestCase
|
||||
public class TestCasePlaySongSelect : ScreenTestCase
|
||||
{
|
||||
private BeatmapManager manager;
|
||||
|
||||
@ -102,21 +103,16 @@ namespace osu.Game.Tests.Visual
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public virtual void SetUp()
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
manager?.Delete(manager.GetAllUsableBeatmapSets());
|
||||
Child = songSelect = new TestSongSelect();
|
||||
});
|
||||
}
|
||||
public virtual void SetUp() =>
|
||||
Schedule(() => { manager?.Delete(manager.GetAllUsableBeatmapSets()); });
|
||||
|
||||
[Test]
|
||||
public void TestDummy()
|
||||
{
|
||||
createSongSelect();
|
||||
AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap);
|
||||
|
||||
AddAssert("dummy shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap == defaultBeatmap);
|
||||
AddUntilStep(() => songSelect.CurrentBeatmapDetailsBeatmap == defaultBeatmap, "dummy shown on wedge");
|
||||
|
||||
addManyTestMaps();
|
||||
AddWaitStep(3);
|
||||
@ -127,6 +123,7 @@ namespace osu.Game.Tests.Visual
|
||||
[Test]
|
||||
public void TestSorting()
|
||||
{
|
||||
createSongSelect();
|
||||
addManyTestMaps();
|
||||
AddWaitStep(3);
|
||||
|
||||
@ -142,6 +139,7 @@ namespace osu.Game.Tests.Visual
|
||||
[Ignore("needs fixing")]
|
||||
public void TestImportUnderDifferentRuleset()
|
||||
{
|
||||
createSongSelect();
|
||||
changeRuleset(2);
|
||||
importForRuleset(0);
|
||||
AddUntilStep(() => songSelect.Carousel.SelectedBeatmap == null, "no selection");
|
||||
@ -150,6 +148,7 @@ namespace osu.Game.Tests.Visual
|
||||
[Test]
|
||||
public void TestImportUnderCurrentRuleset()
|
||||
{
|
||||
createSongSelect();
|
||||
changeRuleset(2);
|
||||
importForRuleset(2);
|
||||
importForRuleset(1);
|
||||
@ -165,6 +164,7 @@ namespace osu.Game.Tests.Visual
|
||||
[Test]
|
||||
public void TestRulesetChangeResetsMods()
|
||||
{
|
||||
createSongSelect();
|
||||
changeRuleset(0);
|
||||
|
||||
changeMods(new OsuModHardRock());
|
||||
@ -194,6 +194,7 @@ namespace osu.Game.Tests.Visual
|
||||
[Test]
|
||||
public void TestStartAfterUnMatchingFilterDoesNotStart()
|
||||
{
|
||||
createSongSelect();
|
||||
addManyTestMaps();
|
||||
AddUntilStep(() => songSelect.Carousel.SelectedBeatmap != null, "has selection");
|
||||
|
||||
@ -221,6 +222,12 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
private void changeRuleset(int id) => AddStep($"change ruleset to {id}", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == id));
|
||||
|
||||
private void createSongSelect()
|
||||
{
|
||||
AddStep("create song select", () => LoadScreen(songSelect = new TestSongSelect()));
|
||||
AddUntilStep(() => songSelect.IsCurrentScreen(), "wait for present");
|
||||
}
|
||||
|
||||
private void addManyTestMaps()
|
||||
{
|
||||
AddStep("import test maps", () =>
|
||||
|
@ -16,7 +16,7 @@ using osu.Game.Users;
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestCaseResults : OsuTestCase
|
||||
public class TestCaseResults : ScreenTestCase
|
||||
{
|
||||
private BeatmapManager beatmaps;
|
||||
|
||||
@ -43,7 +43,7 @@ namespace osu.Game.Tests.Visual
|
||||
if (beatmapInfo != null)
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo);
|
||||
|
||||
Add(new SoloResults(new ScoreInfo
|
||||
LoadScreen(new SoloResults(new ScoreInfo
|
||||
{
|
||||
TotalScore = 2845370,
|
||||
Accuracy = 0.98,
|
||||
|
@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new DummyBeatmapConverter { Beatmap = beatmap };
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => null;
|
||||
public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => null;
|
||||
|
||||
public override string Description => "dummy";
|
||||
|
||||
|
@ -337,6 +337,11 @@ namespace osu.Game
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
// The next time this is updated is in UpdateAfterChildren, which occurs too late and results
|
||||
// in the cursor being shown for a few frames during the intro.
|
||||
// This prevents the cursor from showing until we have a screen with CursorVisible = true
|
||||
MenuCursorContainer.CanShowCursor = menuScreen?.CursorVisible ?? false;
|
||||
|
||||
// todo: all archive managers should be able to be looped here.
|
||||
SkinManager.PostNotification = n => notifications?.Post(n);
|
||||
SkinManager.GetStableStorage = GetStorageForStableInstall;
|
||||
|
@ -70,7 +70,10 @@ namespace osu.Game.Overlays
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.9f,
|
||||
},
|
||||
welcomeScreen = new ScreenWelcome(),
|
||||
new ScreenStack(welcomeScreen = new ScreenWelcome())
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,13 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
{
|
||||
public class DifficultyAttributes
|
||||
{
|
||||
public readonly Mod[] Mods;
|
||||
public readonly double StarRating;
|
||||
public Mod[] Mods;
|
||||
|
||||
public double StarRating;
|
||||
|
||||
public DifficultyAttributes()
|
||||
{
|
||||
}
|
||||
|
||||
public DifficultyAttributes(Mod[] mods, double starRating)
|
||||
{
|
||||
|
@ -1,56 +1,64 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Difficulty.Skills;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Difficulty
|
||||
{
|
||||
public abstract class DifficultyCalculator
|
||||
public abstract class DifficultyCalculator : LegacyDifficultyCalculator
|
||||
{
|
||||
private readonly Ruleset ruleset;
|
||||
private readonly WorkingBeatmap beatmap;
|
||||
/// <summary>
|
||||
/// The length of each strain section.
|
||||
/// </summary>
|
||||
protected virtual int SectionLength => 400;
|
||||
|
||||
protected DifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||
: base(ruleset, beatmap)
|
||||
{
|
||||
this.ruleset = ruleset;
|
||||
this.beatmap = beatmap;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the difficulty of the beatmap using a specific mod combination.
|
||||
/// </summary>
|
||||
/// <param name="mods">The mods that should be applied to the beatmap.</param>
|
||||
/// <returns>A structure describing the difficulty of the beatmap.</returns>
|
||||
public DifficultyAttributes Calculate(params Mod[] mods)
|
||||
protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate)
|
||||
{
|
||||
beatmap.Mods.Value = mods;
|
||||
IBeatmap playableBeatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo);
|
||||
var skills = CreateSkills(beatmap);
|
||||
|
||||
var clock = new StopwatchClock();
|
||||
mods.OfType<IApplicableToClock>().ForEach(m => m.ApplyToClock(clock));
|
||||
if (!beatmap.HitObjects.Any())
|
||||
return CreateDifficultyAttributes(beatmap, mods, skills, clockRate);
|
||||
|
||||
return Calculate(playableBeatmap, mods, clock.Rate);
|
||||
}
|
||||
var difficultyHitObjects = CreateDifficultyHitObjects(beatmap, clockRate).OrderBy(h => h.BaseObject.StartTime).ToList();
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the difficulty of the beatmap using all mod combinations applicable to the beatmap.
|
||||
/// </summary>
|
||||
/// <returns>A collection of structures describing the difficulty of the beatmap for each mod combination.</returns>
|
||||
public IEnumerable<DifficultyAttributes> CalculateAll()
|
||||
{
|
||||
foreach (var combination in CreateDifficultyAdjustmentModCombinations())
|
||||
double sectionLength = SectionLength * clockRate;
|
||||
|
||||
// The first object doesn't generate a strain, so we begin with an incremented section end
|
||||
double currentSectionEnd = Math.Ceiling(beatmap.HitObjects.First().StartTime / sectionLength) * sectionLength;
|
||||
|
||||
foreach (DifficultyHitObject h in difficultyHitObjects)
|
||||
{
|
||||
if (combination is MultiMod multi)
|
||||
yield return Calculate(multi.Mods);
|
||||
else
|
||||
yield return Calculate(combination);
|
||||
while (h.BaseObject.StartTime > currentSectionEnd)
|
||||
{
|
||||
foreach (Skill s in skills)
|
||||
{
|
||||
s.SaveCurrentPeak();
|
||||
s.StartNewSectionFrom(currentSectionEnd);
|
||||
}
|
||||
|
||||
currentSectionEnd += sectionLength;
|
||||
}
|
||||
|
||||
foreach (Skill s in skills)
|
||||
s.Process(h);
|
||||
}
|
||||
|
||||
// The peak strain will not be saved for the last section in the above loop
|
||||
foreach (Skill s in skills)
|
||||
s.SaveCurrentPeak();
|
||||
|
||||
return CreateDifficultyAttributes(beatmap, mods, skills, clockRate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -96,12 +104,27 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
protected virtual Mod[] DifficultyAdjustmentMods => Array.Empty<Mod>();
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the difficulty of a <see cref="Beatmap"/> using a specific <see cref="Mod"/> combination.
|
||||
/// Creates <see cref="DifficultyAttributes"/> to describe beatmap's calculated difficulty.
|
||||
/// </summary>
|
||||
/// <param name="beatmap">The <see cref="IBeatmap"/> to compute the difficulty for.</param>
|
||||
/// <param name="mods">The <see cref="Mod"/>s that should be applied.</param>
|
||||
/// <param name="timeRate">The rate of time in <paramref name="beatmap"/>.</param>
|
||||
/// <returns>A structure containing the difficulty attributes.</returns>
|
||||
protected abstract DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate);
|
||||
/// <param name="beatmap">The <see cref="IBeatmap"/> whose difficulty was calculated.</param>
|
||||
/// <param name="mods">The <see cref="Mod"/>s that difficulty was calculated with.</param>
|
||||
/// <param name="skills">The skills which processed the beatmap.</param>
|
||||
/// <param name="clockRate">The rate at which the gameplay clock is run at.</param>
|
||||
protected abstract DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate);
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates <see cref="DifficultyHitObject"/>s to be processed from <see cref="HitObject"/>s in the <see cref="IBeatmap"/>.
|
||||
/// </summary>
|
||||
/// <param name="beatmap">The <see cref="IBeatmap"/> providing the <see cref="HitObject"/>s to enumerate.</param>
|
||||
/// <param name="clockRate">The rate at which the gameplay clock is run at.</param>
|
||||
/// <returns>The enumerated <see cref="DifficultyHitObject"/>s.</returns>
|
||||
protected abstract IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate);
|
||||
|
||||
/// <summary>
|
||||
/// Creates the <see cref="Skill"/>s to calculate the difficulty of an <see cref="IBeatmap"/>.
|
||||
/// </summary>
|
||||
/// <param name="beatmap">The <see cref="IBeatmap"/> whose difficulty will be calculated.</param
|
||||
/// <returns>The <see cref="Skill"/>s.</returns>
|
||||
protected abstract Skill[] CreateSkills(IBeatmap beatmap);
|
||||
}
|
||||
}
|
||||
|
107
osu.Game/Rulesets/Difficulty/LegacyDifficultyCalculator.cs
Normal file
107
osu.Game/Rulesets/Difficulty/LegacyDifficultyCalculator.cs
Normal file
@ -0,0 +1,107 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Difficulty
|
||||
{
|
||||
public abstract class LegacyDifficultyCalculator
|
||||
{
|
||||
private readonly Ruleset ruleset;
|
||||
private readonly WorkingBeatmap beatmap;
|
||||
|
||||
protected LegacyDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||
{
|
||||
this.ruleset = ruleset;
|
||||
this.beatmap = beatmap;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the difficulty of the beatmap using a specific mod combination.
|
||||
/// </summary>
|
||||
/// <param name="mods">The mods that should be applied to the beatmap.</param>
|
||||
/// <returns>A structure describing the difficulty of the beatmap.</returns>
|
||||
public DifficultyAttributes Calculate(params Mod[] mods)
|
||||
{
|
||||
beatmap.Mods.Value = mods;
|
||||
IBeatmap playableBeatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo);
|
||||
|
||||
var clock = new StopwatchClock();
|
||||
mods.OfType<IApplicableToClock>().ForEach(m => m.ApplyToClock(clock));
|
||||
|
||||
return Calculate(playableBeatmap, mods, clock.Rate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the difficulty of the beatmap using all mod combinations applicable to the beatmap.
|
||||
/// </summary>
|
||||
/// <returns>A collection of structures describing the difficulty of the beatmap for each mod combination.</returns>
|
||||
public IEnumerable<DifficultyAttributes> CalculateAll()
|
||||
{
|
||||
foreach (var combination in CreateDifficultyAdjustmentModCombinations())
|
||||
{
|
||||
if (combination is MultiMod multi)
|
||||
yield return Calculate(multi.Mods);
|
||||
else
|
||||
yield return Calculate(combination);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates all <see cref="Mod"/> combinations which adjust the <see cref="Beatmap"/> difficulty.
|
||||
/// </summary>
|
||||
public Mod[] CreateDifficultyAdjustmentModCombinations()
|
||||
{
|
||||
return createDifficultyAdjustmentModCombinations(Enumerable.Empty<Mod>(), DifficultyAdjustmentMods).ToArray();
|
||||
|
||||
IEnumerable<Mod> createDifficultyAdjustmentModCombinations(IEnumerable<Mod> currentSet, Mod[] adjustmentSet, int currentSetCount = 0, int adjustmentSetStart = 0)
|
||||
{
|
||||
switch (currentSetCount)
|
||||
{
|
||||
case 0:
|
||||
// Initial-case: Empty current set
|
||||
yield return new ModNoMod();
|
||||
break;
|
||||
case 1:
|
||||
yield return currentSet.Single();
|
||||
break;
|
||||
default:
|
||||
yield return new MultiMod(currentSet.ToArray());
|
||||
break;
|
||||
}
|
||||
|
||||
// Apply mods in the adjustment set recursively. Using the entire adjustment set would result in duplicate multi-mod mod
|
||||
// combinations in further recursions, so a moving subset is used to eliminate this effect
|
||||
for (int i = adjustmentSetStart; i < adjustmentSet.Length; i++)
|
||||
{
|
||||
var adjustmentMod = adjustmentSet[i];
|
||||
if (currentSet.Any(c => c.IncompatibleMods.Any(m => m.IsInstanceOfType(adjustmentMod))))
|
||||
continue;
|
||||
|
||||
foreach (var combo in createDifficultyAdjustmentModCombinations(currentSet.Append(adjustmentMod), adjustmentSet, currentSetCount + 1, i + 1))
|
||||
yield return combo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves all <see cref="Mod"/>s which adjust the <see cref="Beatmap"/> difficulty.
|
||||
/// </summary>
|
||||
protected virtual Mod[] DifficultyAdjustmentMods => Array.Empty<Mod>();
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the difficulty of a <see cref="Beatmap"/> using a specific <see cref="Mod"/> combination.
|
||||
/// </summary>
|
||||
/// <param name="beatmap">The <see cref="IBeatmap"/> to compute the difficulty for.</param>
|
||||
/// <param name="mods">The <see cref="Mod"/>s that should be applied.</param>
|
||||
/// <param name="clockRate">The rate at which the gameplay clock is run at.</param>
|
||||
/// <returns>A structure containing the difficulty attributes.</returns>
|
||||
protected abstract DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate);
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
// 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 osu.Game.Rulesets.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Difficulty.Preprocessing
|
||||
{
|
||||
/// <summary>
|
||||
/// Wraps a <see cref="HitObject"/> and provides additional information to be used for difficulty calculation.
|
||||
/// </summary>
|
||||
public class DifficultyHitObject
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="HitObject"/> this <see cref="DifficultyHitObject"/> wraps.
|
||||
/// </summary>
|
||||
public readonly HitObject BaseObject;
|
||||
|
||||
/// <summary>
|
||||
/// The last <see cref="HitObject"/> which occurs before <see cref="BaseObject"/>.
|
||||
/// </summary>
|
||||
public readonly HitObject LastObject;
|
||||
|
||||
/// <summary>
|
||||
/// Amount of time elapsed between <see cref="BaseObject"/> and <see cref="LastObject"/>.
|
||||
/// </summary>
|
||||
public readonly double DeltaTime;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="DifficultyHitObject"/>.
|
||||
/// </summary>
|
||||
/// <param name="hitObject">The <see cref="HitObject"/> which this <see cref="DifficultyHitObject"/> wraps.</param>
|
||||
/// <param name="lastObject">The last <see cref="HitObject"/> which occurs before <paramref name="hitObject"/> in the beatmap.</param>
|
||||
/// <param name="clockRate">The rate at which the gameplay clock is run at.</param>
|
||||
public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate)
|
||||
{
|
||||
BaseObject = hitObject;
|
||||
LastObject = lastObject;
|
||||
DeltaTime = (hitObject.StartTime - lastObject.StartTime) / clockRate;
|
||||
}
|
||||
}
|
||||
}
|
@ -3,20 +3,21 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Osu.Difficulty.Utils;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
||||
using osu.Game.Rulesets.Difficulty.Utils;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
namespace osu.Game.Rulesets.Difficulty.Skills
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to processes strain values of <see cref="OsuDifficultyHitObject"/>s, keep track of strain levels caused by the processed objects
|
||||
/// Used to processes strain values of <see cref="DifficultyHitObject"/>s, keep track of strain levels caused by the processed objects
|
||||
/// and to calculate a final difficulty value representing the difficulty of hitting all the processed objects.
|
||||
/// </summary>
|
||||
public abstract class Skill
|
||||
{
|
||||
protected const double SINGLE_SPACING_THRESHOLD = 125;
|
||||
protected const double STREAM_SPACING_THRESHOLD = 110;
|
||||
/// <summary>
|
||||
/// The peak strain for each <see cref="DifficultyCalculator.SectionLength"/> section of the beatmap.
|
||||
/// </summary>
|
||||
public IList<double> StrainPeaks => strainPeaks;
|
||||
|
||||
/// <summary>
|
||||
/// Strain values are multiplied by this number for the given skill. Used to balance the value of different skills between each other.
|
||||
@ -30,22 +31,27 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
protected abstract double StrainDecayBase { get; }
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="OsuDifficultyHitObject"/>s that were processed previously. They can affect the strain values of the following objects.
|
||||
/// The weight by which each strain value decays.
|
||||
/// </summary>
|
||||
protected readonly History<OsuDifficultyHitObject> Previous = new History<OsuDifficultyHitObject>(2); // Contained objects not used yet
|
||||
protected virtual double DecayWeight => 0.9;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="DifficultyHitObject"/>s that were processed previously. They can affect the strain values of the following objects.
|
||||
/// </summary>
|
||||
protected readonly LimitedCapacityStack<DifficultyHitObject> Previous = new LimitedCapacityStack<DifficultyHitObject>(2); // Contained objects not used yet
|
||||
|
||||
private double currentStrain = 1; // We keep track of the strain level at all times throughout the beatmap.
|
||||
private double currentSectionPeak = 1; // We also keep track of the peak strain level in the current section.
|
||||
|
||||
private readonly List<double> strainPeaks = new List<double>();
|
||||
|
||||
/// <summary>
|
||||
/// Process an <see cref="OsuDifficultyHitObject"/> and update current strain values accordingly.
|
||||
/// Process a <see cref="DifficultyHitObject"/> and update current strain values accordingly.
|
||||
/// </summary>
|
||||
public void Process(OsuDifficultyHitObject current)
|
||||
public void Process(DifficultyHitObject current)
|
||||
{
|
||||
currentStrain *= strainDecay(current.DeltaTime);
|
||||
if (!(current.BaseObject is Spinner))
|
||||
currentStrain += StrainValueOf(current) * SkillMultiplier;
|
||||
currentStrain += StrainValueOf(current) * SkillMultiplier;
|
||||
|
||||
currentSectionPeak = Math.Max(currentStrain, currentSectionPeak);
|
||||
|
||||
@ -64,7 +70,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
/// <summary>
|
||||
/// Sets the initial strain level for a new section.
|
||||
/// </summary>
|
||||
/// <param name="offset">The beginning of the new section in milliseconds</param>
|
||||
/// <param name="offset">The beginning of the new section in milliseconds.</param>
|
||||
public void StartNewSectionFrom(double offset)
|
||||
{
|
||||
// The maximum strain of the new section is not zero by default, strain decays as usual regardless of section boundaries.
|
||||
@ -74,7 +80,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the calculated difficulty value representing all processed <see cref="OsuDifficultyHitObject"/>s.
|
||||
/// Returns the calculated difficulty value representing all processed <see cref="DifficultyHitObject"/>s.
|
||||
/// </summary>
|
||||
public double DifficultyValue()
|
||||
{
|
||||
@ -87,16 +93,16 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
foreach (double strain in strainPeaks)
|
||||
{
|
||||
difficulty += strain * weight;
|
||||
weight *= 0.9;
|
||||
weight *= DecayWeight;
|
||||
}
|
||||
|
||||
return difficulty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the strain value of an <see cref="OsuDifficultyHitObject"/>. This value is affected by previously processed objects.
|
||||
/// Calculates the strain value of a <see cref="DifficultyHitObject"/>. This value is affected by previously processed objects.
|
||||
/// </summary>
|
||||
protected abstract double StrainValueOf(OsuDifficultyHitObject current);
|
||||
protected abstract double StrainValueOf(DifficultyHitObject current);
|
||||
|
||||
private double strainDecay(double ms) => Math.Pow(StrainDecayBase, ms / 1000);
|
||||
}
|
@ -5,14 +5,16 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Difficulty.Utils
|
||||
namespace osu.Game.Rulesets.Difficulty.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// An indexed stack with Push() only, which disposes items at the bottom after the capacity is full.
|
||||
/// Indexing starts at the top of the stack.
|
||||
/// An indexed stack with limited depth. Indexing starts at the top of the stack.
|
||||
/// </summary>
|
||||
public class History<T> : IEnumerable<T>
|
||||
public class LimitedCapacityStack<T> : IEnumerable<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// The number of elements in the stack.
|
||||
/// </summary>
|
||||
public int Count { get; private set; }
|
||||
|
||||
private readonly T[] array;
|
||||
@ -20,10 +22,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Utils
|
||||
private int marker; // Marks the position of the most recently added item.
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the History class that is empty and has the specified capacity.
|
||||
/// Constructs a new <see cref="LimitedCapacityStack{T}"/>.
|
||||
/// </summary>
|
||||
/// <param name="capacity">The number of items the History can hold.</param>
|
||||
public History(int capacity)
|
||||
/// <param name="capacity">The number of items the stack can hold.</param>
|
||||
public LimitedCapacityStack(int capacity)
|
||||
{
|
||||
if (capacity < 0)
|
||||
throw new ArgumentOutOfRangeException();
|
||||
@ -34,8 +36,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Utils
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The most recently added item is returned at index 0.
|
||||
/// Retrieves the item at an index in the stack.
|
||||
/// </summary>
|
||||
/// <param name="i">The index of the item to retrieve. The top of the stack is returned at index 0.</param>
|
||||
public T this[int i]
|
||||
{
|
||||
get
|
||||
@ -52,11 +55,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Utils
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the item as the most recent one in the history.
|
||||
/// The oldest item is disposed if the history is full.
|
||||
/// Pushes an item to this <see cref="LimitedCapacityStack{T}"/>.
|
||||
/// </summary>
|
||||
public void Push(T item) // Overwrite the oldest item instead of shifting every item by one with every addition.
|
||||
/// <param name="item">The item to push.</param>
|
||||
public void Push(T item)
|
||||
{
|
||||
// Overwrite the oldest item instead of shifting every item by one with every addition.
|
||||
if (marker == 0)
|
||||
marker = capacity - 1;
|
||||
else
|
@ -71,7 +71,7 @@ namespace osu.Game.Rulesets
|
||||
/// <returns>The <see cref="IBeatmapProcessor"/>.</returns>
|
||||
public virtual IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => null;
|
||||
|
||||
public abstract DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap);
|
||||
public abstract LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap);
|
||||
|
||||
public virtual PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => null;
|
||||
|
||||
|
@ -22,7 +22,8 @@ namespace osu.Game.Rulesets
|
||||
{
|
||||
AppDomain.CurrentDomain.AssemblyResolve += currentDomain_AssemblyResolve;
|
||||
|
||||
foreach (string file in Directory.GetFiles(Environment.CurrentDirectory, $"{ruleset_library_prefix}.*.dll"))
|
||||
foreach (string file in Directory.GetFiles(Environment.CurrentDirectory, $"{ruleset_library_prefix}.*.dll")
|
||||
.Where(f => !Path.GetFileName(f).Contains("Tests")))
|
||||
loadRulesetFromFile(file);
|
||||
}
|
||||
|
||||
@ -124,7 +125,7 @@ namespace osu.Game.Rulesets
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e, "Failed to load ruleset");
|
||||
Logger.Error(e, $"Failed to load ruleset {filename}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ namespace osu.Game.Screens
|
||||
|
||||
public override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
||||
|
||||
public override bool CursorVisible => false;
|
||||
|
||||
protected override bool AllowBackButton => false;
|
||||
|
||||
public Loader()
|
||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Screens.Multi
|
||||
private readonly Bindable<Room> currentRoom = new Bindable<Room>();
|
||||
|
||||
[Cached]
|
||||
private readonly Bindable<FilterCriteria> currentFilter = new Bindable<FilterCriteria>();
|
||||
private readonly Bindable<FilterCriteria> currentFilter = new Bindable<FilterCriteria>(new FilterCriteria());
|
||||
|
||||
[Cached(Type = typeof(IRoomManager))]
|
||||
private RoomManager roomManager;
|
||||
|
@ -58,7 +58,14 @@ namespace osu.Game.Skinning
|
||||
componentName = "hit300";
|
||||
break;
|
||||
case "Play/osu/number-text":
|
||||
return !hasFont(Configuration.HitCircleFont) ? null : new LegacySpriteText(Textures, Configuration.HitCircleFont) { Scale = new Vector2(0.96f) };
|
||||
return !hasFont(Configuration.HitCircleFont)
|
||||
? null
|
||||
: new LegacySpriteText(Textures, Configuration.HitCircleFont)
|
||||
{
|
||||
Scale = new Vector2(0.96f),
|
||||
// Spacing value was reverse-engineered from the ratio of the rendered sprite size in the visual inspector vs the actual texture size
|
||||
Spacing = new Vector2(-Configuration.HitCircleOverlap * 0.89f, 0)
|
||||
};
|
||||
}
|
||||
|
||||
var texture = GetTexture(componentName);
|
||||
|
@ -46,6 +46,9 @@ namespace osu.Game.Skinning
|
||||
case "HitCirclePrefix":
|
||||
skin.HitCircleFont = pair.Value;
|
||||
break;
|
||||
case "HitCircleOverlap":
|
||||
skin.HitCircleOverlap = int.Parse(pair.Value);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -23,6 +23,8 @@ namespace osu.Game.Skinning
|
||||
|
||||
public string HitCircleFont { get; set; } = "default";
|
||||
|
||||
public int HitCircleOverlap { get; set; }
|
||||
|
||||
public bool? CursorExpand { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
51
osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs
Normal file
51
osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs
Normal file
@ -0,0 +1,51 @@
|
||||
// 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.IO;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Tests.Beatmaps
|
||||
{
|
||||
[TestFixture]
|
||||
public abstract class DifficultyCalculatorTest
|
||||
{
|
||||
private const string resource_namespace = "Testing.Beatmaps";
|
||||
|
||||
protected abstract string ResourceAssembly { get; }
|
||||
|
||||
protected void Test(double expected, string name, params Mod[] mods)
|
||||
=> Assert.AreEqual(expected, CreateDifficultyCalculator(getBeatmap(name)).Calculate(mods).StarRating);
|
||||
|
||||
private WorkingBeatmap getBeatmap(string name)
|
||||
{
|
||||
using (var resStream = openResource($"{resource_namespace}.{name}.osu"))
|
||||
using (var stream = new StreamReader(resStream))
|
||||
{
|
||||
var decoder = Decoder.GetDecoder<Beatmap>(stream);
|
||||
((LegacyBeatmapDecoder)decoder).ApplyOffsets = false;
|
||||
|
||||
var working = new TestWorkingBeatmap(decoder.Decode(stream));
|
||||
working.BeatmapInfo.Ruleset = CreateRuleset().RulesetInfo;
|
||||
|
||||
return working;
|
||||
}
|
||||
}
|
||||
|
||||
private Stream openResource(string name)
|
||||
{
|
||||
var localPath = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path));
|
||||
return Assembly.LoadFrom(Path.Combine(localPath, $"{ResourceAssembly}.dll")).GetManifestResourceStream($@"{ResourceAssembly}.Resources.{name}");
|
||||
}
|
||||
|
||||
protected abstract LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap);
|
||||
|
||||
protected abstract Ruleset CreateRuleset();
|
||||
}
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
// 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 osu.Framework.Graphics;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
@ -14,10 +16,10 @@ namespace osu.Game.Tests
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
LoadComponentAsync(new BackgroundScreenDefault
|
||||
LoadComponentAsync(new ScreenStack(new BackgroundScreenDefault { Colour = OsuColour.Gray(0.5f) })
|
||||
{
|
||||
Colour = OsuColour.Gray(0.5f),
|
||||
Depth = 10
|
||||
Depth = 10,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
}, AddInternal);
|
||||
|
||||
// Have to construct this here, rather than in the constructor, because
|
||||
|
@ -7,7 +7,7 @@ using osu.Game.Online.Multiplayer;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public class MultiplayerTestCase : OsuTestCase
|
||||
public abstract class MultiplayerTestCase : ScreenTestCase
|
||||
{
|
||||
[Cached]
|
||||
private readonly Bindable<Room> currentRoom = new Bindable<Room>(new Room());
|
||||
|
@ -16,7 +16,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.214.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.215.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
@ -105,8 +105,8 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.214.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.214.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.215.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.215.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user