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
|
|
|
|
|
2017-04-18 15:05:58 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
2017-03-15 11:57:17 +08:00
|
|
|
|
using System.Collections.Generic;
|
2020-09-14 16:08:22 +08:00
|
|
|
|
using Newtonsoft.Json;
|
2017-04-21 15:18:34 +08:00
|
|
|
|
using osu.Game.Audio;
|
2017-07-26 12:22:46 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2017-05-29 11:10:29 +08:00
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-04-21 19:29:27 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Objects.Legacy
|
2017-03-15 11:52:25 +08:00
|
|
|
|
{
|
2021-01-07 00:46:44 +08:00
|
|
|
|
internal abstract class ConvertSlider : ConvertHitObject, IHasPathWithRepeats, IHasLegacyLastTickOffset
|
2017-03-15 11:52:25 +08:00
|
|
|
|
{
|
2017-05-29 11:10:29 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Scoring distance with a speed-adjusted beat length of 1 second.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private const float base_scoring_distance = 100;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-01-23 12:37:25 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// <see cref="ConvertSlider"/>s don't need a curve since they're converted to ruleset-specific hitobjects.
|
|
|
|
|
/// </summary>
|
2018-11-01 14:38:19 +08:00
|
|
|
|
public SliderPath Path { get; set; }
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-11-12 13:07:48 +08:00
|
|
|
|
public double Distance => Path.Distance;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-10-23 16:59:07 +08:00
|
|
|
|
public IList<IList<HitSampleInfo>> NodeSamples { get; set; }
|
2018-01-23 12:37:25 +08:00
|
|
|
|
public int RepeatCount { get; set; }
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-09-14 16:08:22 +08:00
|
|
|
|
[JsonIgnore]
|
2020-05-27 11:37:44 +08:00
|
|
|
|
public double Duration
|
2020-02-05 16:12:26 +08:00
|
|
|
|
{
|
2020-05-27 11:37:44 +08:00
|
|
|
|
get => this.SpanCount() * Distance / Velocity;
|
2020-02-06 12:16:32 +08:00
|
|
|
|
set => throw new System.NotSupportedException($"Adjust via {nameof(RepeatCount)} instead"); // can be implemented if/when needed.
|
2020-02-05 16:12:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-27 11:37:44 +08:00
|
|
|
|
public double EndTime => StartTime + Duration;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-05-29 11:19:51 +08:00
|
|
|
|
public double Velocity = 1;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-10-01 13:56:42 +08:00
|
|
|
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
2017-05-29 11:10:29 +08:00
|
|
|
|
{
|
2017-12-22 20:42:54 +08:00
|
|
|
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-05-29 11:10:29 +08:00
|
|
|
|
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-08-31 22:59:36 +08:00
|
|
|
|
double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier * DifficultyControlPoint.SliderVelocity;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-05-29 11:10:29 +08:00
|
|
|
|
Velocity = scoringDistance / timingPoint.BeatLength;
|
|
|
|
|
}
|
2018-06-13 21:20:34 +08:00
|
|
|
|
|
|
|
|
|
public double LegacyLastTickOffset => 36;
|
2017-03-15 11:52:25 +08:00
|
|
|
|
}
|
|
|
|
|
}
|