2019-01-24 16:43:03 +08: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 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2018-08-02 19:36:38 +08:00
|
|
|
|
using osu.Game.Rulesets.Judgements;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Judgements;
|
2019-08-21 02:17:27 +08:00
|
|
|
|
using osu.Game.Rulesets.Osu.Replays;
|
2019-09-06 14:24:00 +08:00
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2019-08-21 02:17:27 +08:00
|
|
|
|
using osuTK;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Objects
|
|
|
|
|
{
|
2020-05-27 11:38:39 +08:00
|
|
|
|
public class Spinner : OsuHitObject, IHasDuration
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2020-02-07 18:08:37 +08:00
|
|
|
|
public double EndTime
|
|
|
|
|
{
|
|
|
|
|
get => StartTime + Duration;
|
|
|
|
|
set => Duration = value - StartTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public double Duration { get; set; }
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Number of spins required to finish the spinner without miss.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int SpinsRequired { get; protected set; } = 1;
|
|
|
|
|
|
|
|
|
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
|
|
|
|
{
|
|
|
|
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
|
|
|
|
|
|
|
|
|
SpinsRequired = (int)(Duration / 1000 * BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5));
|
|
|
|
|
|
|
|
|
|
// spinning doesn't match 1:1 with stable, so let's fudge them easier for the time being.
|
|
|
|
|
SpinsRequired = (int)Math.Max(1, SpinsRequired * 0.6);
|
|
|
|
|
}
|
2018-08-02 19:36:38 +08:00
|
|
|
|
|
2019-08-21 02:17:27 +08:00
|
|
|
|
protected override void CreateNestedHitObjects()
|
|
|
|
|
{
|
|
|
|
|
base.CreateNestedHitObjects();
|
|
|
|
|
|
|
|
|
|
var maximumSpins = OsuAutoGeneratorBase.SPIN_RADIUS * (Duration / 1000) / MathHelper.TwoPi;
|
|
|
|
|
for (int i = 0; i < maximumSpins; i++)
|
|
|
|
|
AddNested(new SpinnerTick());
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-06 10:50:18 +08:00
|
|
|
|
public override Judgement CreateJudgement() => new OsuJudgement();
|
2019-09-02 15:10:30 +08:00
|
|
|
|
|
2019-10-09 18:08:31 +08:00
|
|
|
|
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|