2017-03-17 04:56:14 +00:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-04-18 07:05:58 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
2017-03-17 04:56:14 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2017-04-06 02:41:16 +00:00
|
|
|
|
using osu.Game.Audio;
|
2017-07-26 04:22:46 +00:00
|
|
|
|
using osu.Game.Beatmaps;
|
2017-05-23 04:55:18 +00:00
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2017-03-17 04:56:14 +00:00
|
|
|
|
|
2017-04-18 07:05:58 +00:00
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Objects
|
2017-03-17 04:56:14 +00:00
|
|
|
|
{
|
2017-04-05 04:52:53 +00:00
|
|
|
|
public class DrumRoll : TaikoHitObject, IHasEndTime
|
2017-03-17 04:56:14 +00:00
|
|
|
|
{
|
2017-04-03 05:10:20 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Drum roll distance that results in a duration of 1 speed-adjusted beat length.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private const float base_distance = 100;
|
|
|
|
|
|
2017-04-05 04:52:53 +00:00
|
|
|
|
public double EndTime => StartTime + Duration;
|
2017-03-17 04:56:14 +00:00
|
|
|
|
|
2017-04-05 04:52:53 +00:00
|
|
|
|
public double Duration { get; set; }
|
2017-03-17 04:56:14 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2017-04-03 06:32:38 +00:00
|
|
|
|
/// Numer of ticks per beat length.
|
2017-03-17 04:56:14 +00:00
|
|
|
|
/// </summary>
|
2017-04-03 06:32:38 +00:00
|
|
|
|
public int TickRate = 1;
|
2017-03-17 04:56:14 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Number of drum roll ticks required for a "Good" hit.
|
|
|
|
|
/// </summary>
|
2017-03-21 16:33:22 +00:00
|
|
|
|
public double RequiredGoodHits { get; protected set; }
|
2017-03-17 04:56:14 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Number of drum roll ticks required for a "Great" hit.
|
|
|
|
|
/// </summary>
|
2017-03-21 16:33:22 +00:00
|
|
|
|
public double RequiredGreatHits { get; protected set; }
|
2017-03-17 04:56:14 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Total number of drum roll ticks.
|
|
|
|
|
/// </summary>
|
2017-03-21 16:33:22 +00:00
|
|
|
|
public int TotalTicks => Ticks.Count();
|
2017-03-17 04:56:14 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes the drum roll ticks if not initialized and returns them.
|
|
|
|
|
/// </summary>
|
2017-03-21 16:33:22 +00:00
|
|
|
|
public IEnumerable<DrumRollTick> Ticks => ticks ?? (ticks = createTicks());
|
2017-03-17 04:56:14 +00:00
|
|
|
|
|
|
|
|
|
private List<DrumRollTick> ticks;
|
|
|
|
|
|
2017-04-03 06:32:38 +00:00
|
|
|
|
/// <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;
|
|
|
|
|
|
2017-05-23 04:55:18 +00:00
|
|
|
|
public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
2017-03-17 04:56:14 +00:00
|
|
|
|
{
|
2017-05-23 04:55:18 +00:00
|
|
|
|
base.ApplyDefaults(controlPointInfo, difficulty);
|
2017-03-17 04:56:14 +00:00
|
|
|
|
|
2017-05-23 04:55:18 +00:00
|
|
|
|
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
|
|
|
|
|
|
|
|
|
|
tickSpacing = timingPoint.BeatLength / TickRate;
|
2017-03-17 04:56:14 +00:00
|
|
|
|
|
|
|
|
|
RequiredGoodHits = TotalTicks * Math.Min(0.15, 0.05 + 0.10 / 6 * difficulty.OverallDifficulty);
|
|
|
|
|
RequiredGreatHits = TotalTicks * Math.Min(0.30, 0.10 + 0.20 / 6 * difficulty.OverallDifficulty);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-21 16:33:22 +00:00
|
|
|
|
private List<DrumRollTick> createTicks()
|
2017-03-17 04:56:14 +00:00
|
|
|
|
{
|
2017-03-21 16:33:22 +00:00
|
|
|
|
var ret = new List<DrumRollTick>();
|
2017-03-17 04:56:14 +00:00
|
|
|
|
|
2017-04-03 06:32:38 +00:00
|
|
|
|
if (tickSpacing == 0)
|
2017-03-21 16:33:22 +00:00
|
|
|
|
return ret;
|
2017-03-17 04:56:14 +00:00
|
|
|
|
|
|
|
|
|
bool first = true;
|
2017-04-05 04:52:22 +00:00
|
|
|
|
for (double t = StartTime; t < EndTime + tickSpacing / 2; t += tickSpacing)
|
2017-03-17 04:56:14 +00:00
|
|
|
|
{
|
2017-03-21 16:33:22 +00:00
|
|
|
|
ret.Add(new DrumRollTick
|
2017-03-17 04:56:14 +00:00
|
|
|
|
{
|
|
|
|
|
FirstTick = first,
|
2017-04-03 06:32:38 +00:00
|
|
|
|
TickSpacing = tickSpacing,
|
2017-03-17 04:56:14 +00:00
|
|
|
|
StartTime = t,
|
2017-03-28 07:47:25 +00:00
|
|
|
|
IsStrong = IsStrong,
|
2017-04-26 05:12:21 +00:00
|
|
|
|
Samples = new SampleInfoList(Samples.Select(s => new SampleInfo
|
2017-04-06 02:41:16 +00:00
|
|
|
|
{
|
|
|
|
|
Bank = s.Bank,
|
|
|
|
|
Name = @"slidertick",
|
|
|
|
|
Volume = s.Volume
|
2017-04-26 05:12:21 +00:00
|
|
|
|
}))
|
2017-03-17 04:56:14 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
first = false;
|
|
|
|
|
}
|
2017-03-21 16:33:22 +00:00
|
|
|
|
|
|
|
|
|
return ret;
|
2017-03-17 04:56:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|