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 osu.Game.Rulesets.Objects.Types;
|
|
|
|
|
using System;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2018-11-29 09:56:19 +08:00
|
|
|
|
using osu.Game.Rulesets.Judgements;
|
2019-09-02 15:10:30 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2018-11-29 09:56:19 +08:00
|
|
|
|
using osu.Game.Rulesets.Taiko.Judgements;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Objects
|
|
|
|
|
{
|
|
|
|
|
public class DrumRoll : TaikoHitObject, IHasEndTime
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Drum roll distance that results in a duration of 1 speed-adjusted beat length.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private const float base_distance = 100;
|
|
|
|
|
|
|
|
|
|
public double EndTime => StartTime + Duration;
|
|
|
|
|
|
|
|
|
|
public double Duration { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Numer of ticks per beat length.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int TickRate = 1;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Number of drum roll ticks required for a "Good" hit.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public double RequiredGoodHits { get; protected set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Number of drum roll ticks required for a "Great" hit.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public double RequiredGreatHits { get; protected set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The length (in milliseconds) between ticks of this drumroll.
|
|
|
|
|
/// <para>Half of this value is the hit window of the ticks.</para>
|
|
|
|
|
/// </summary>
|
|
|
|
|
private double tickSpacing = 100;
|
|
|
|
|
|
2018-05-14 13:13:07 +08:00
|
|
|
|
private float overallDifficulty = BeatmapDifficulty.DEFAULT_DIFFICULTY;
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
|
|
|
|
{
|
|
|
|
|
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
|
|
|
|
|
|
|
|
|
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
|
|
|
|
|
|
|
|
|
|
tickSpacing = timingPoint.BeatLength / TickRate;
|
2018-05-14 13:13:07 +08:00
|
|
|
|
overallDifficulty = difficulty.OverallDifficulty;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void CreateNestedHitObjects()
|
|
|
|
|
{
|
|
|
|
|
createTicks();
|
2018-05-14 13:13:07 +08:00
|
|
|
|
|
|
|
|
|
RequiredGoodHits = NestedHitObjects.Count * Math.Min(0.15, 0.05 + 0.10 / 6 * overallDifficulty);
|
|
|
|
|
RequiredGreatHits = NestedHitObjects.Count * Math.Min(0.30, 0.10 + 0.20 / 6 * overallDifficulty);
|
2018-08-03 15:11:57 +08:00
|
|
|
|
|
|
|
|
|
base.CreateNestedHitObjects();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void createTicks()
|
|
|
|
|
{
|
|
|
|
|
if (tickSpacing == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
bool first = true;
|
2019-04-01 11:16:05 +08:00
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
for (double t = StartTime; t < EndTime + tickSpacing / 2; t += tickSpacing)
|
|
|
|
|
{
|
|
|
|
|
AddNested(new DrumRollTick
|
|
|
|
|
{
|
|
|
|
|
FirstTick = first,
|
|
|
|
|
TickSpacing = tickSpacing,
|
|
|
|
|
StartTime = t,
|
|
|
|
|
IsStrong = IsStrong
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
first = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-12-06 16:09:42 +08:00
|
|
|
|
|
|
|
|
|
public override Judgement CreateJudgement() => new TaikoDrumRollJudgement();
|
2019-09-02 15:10:30 +08:00
|
|
|
|
|
|
|
|
|
protected override HitWindows CreateHitWindows() => null;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|