2019-01-24 08:43:03 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2018-08-02 11:36:38 +00:00
|
|
|
|
using osu.Game.Rulesets.Judgements;
|
2020-07-21 09:22:37 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
2018-08-02 11:36:38 +00:00
|
|
|
|
using osu.Game.Rulesets.Osu.Judgements;
|
2019-09-06 06:24:00 +00:00
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Objects
|
|
|
|
|
{
|
2020-05-27 03:38:39 +00:00
|
|
|
|
public class Spinner : OsuHitObject, IHasDuration
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2020-02-07 10:08:37 +00:00
|
|
|
|
public double EndTime
|
|
|
|
|
{
|
|
|
|
|
get => StartTime + Duration;
|
|
|
|
|
set => Duration = value - StartTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public double Duration { get; set; }
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Number of spins required to finish the spinner without miss.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int SpinsRequired { get; protected set; } = 1;
|
|
|
|
|
|
2020-07-24 10:34:13 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Number of spins available to give bonus, beyond <see cref="SpinsRequired"/>.
|
|
|
|
|
/// </summary>
|
2020-07-24 12:03:55 +00:00
|
|
|
|
public int MaximumBonusSpins { get; protected set; } = 1;
|
2020-07-21 09:22:37 +00:00
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
|
|
|
|
{
|
|
|
|
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
|
|
|
|
|
|
|
|
|
// spinning doesn't match 1:1 with stable, so let's fudge them easier for the time being.
|
2020-07-24 13:09:25 +00:00
|
|
|
|
const double stable_matching_fudge = 0.6;
|
|
|
|
|
|
|
|
|
|
// close to 477rpm
|
|
|
|
|
const double maximum_rotations_per_second = 8;
|
|
|
|
|
|
|
|
|
|
double secondsDuration = Duration / 1000;
|
2020-07-24 12:03:55 +00:00
|
|
|
|
|
2020-07-24 13:09:25 +00:00
|
|
|
|
double minimumRotationsPerSecond = stable_matching_fudge * BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5);
|
2020-07-24 12:03:55 +00:00
|
|
|
|
|
2020-08-05 09:44:34 +00:00
|
|
|
|
SpinsRequired = (int)(secondsDuration * minimumRotationsPerSecond);
|
2020-07-24 13:09:25 +00:00
|
|
|
|
MaximumBonusSpins = (int)((maximum_rotations_per_second - minimumRotationsPerSecond) * secondsDuration);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
2018-08-02 11:36:38 +00:00
|
|
|
|
|
2019-08-20 18:17:27 +00:00
|
|
|
|
protected override void CreateNestedHitObjects()
|
|
|
|
|
{
|
|
|
|
|
base.CreateNestedHitObjects();
|
|
|
|
|
|
2020-07-21 09:22:37 +00:00
|
|
|
|
int totalSpins = MaximumBonusSpins + SpinsRequired;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < totalSpins; i++)
|
|
|
|
|
{
|
|
|
|
|
double startTime = StartTime + (float)(i + 1) / totalSpins * Duration;
|
|
|
|
|
|
|
|
|
|
AddNested(i < SpinsRequired
|
|
|
|
|
? new SpinnerTick { StartTime = startTime }
|
|
|
|
|
: new SpinnerBonusTick { StartTime = startTime });
|
|
|
|
|
}
|
2019-08-20 18:17:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-08-06 02:50:18 +00:00
|
|
|
|
public override Judgement CreateJudgement() => new OsuJudgement();
|
2019-09-02 07:10:30 +00:00
|
|
|
|
|
2019-10-09 10:08:31 +00:00
|
|
|
|
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|