From 12de3f6657a277550ff07a36d4b5f9bfb907c881 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 13:56:14 +0900 Subject: [PATCH 1/5] Implement DrumRoll + DrumRollTick. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 121 ++++++++++++++++++ osu.Game.Modes.Taiko/Objects/DrumRollTick.cs | 21 +++ .../osu.Game.Modes.Taiko.csproj | 2 + 3 files changed, 144 insertions(+) create mode 100644 osu.Game.Modes.Taiko/Objects/DrumRoll.cs create mode 100644 osu.Game.Modes.Taiko/Objects/DrumRollTick.cs diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs new file mode 100644 index 0000000000..9ce2758d84 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -0,0 +1,121 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Samples; +using osu.Game.Modes.Objects.Types; +using System; +using System.Collections.Generic; +using System.Linq; +using osu.Game.Beatmaps.Timing; +using osu.Game.Database; + +namespace osu.Game.Modes.Taiko.Objects +{ + public class DrumRoll : TaikoHitObject, IHasDistance + { + public double EndTime => StartTime + Distance / Velocity; + + public double Duration => EndTime - StartTime; + + /// + /// Raw length of the drum roll in positional length units. + /// + public double Distance { get; set; } + + /// + /// Velocity of the drum roll in positional length units per millisecond. + /// + public double Velocity; + + /// + /// The distance between ticks of this drumroll. + /// Half of this value is the hit window of the ticks. + /// + public double TickTimeDistance; + + /// + /// Number of drum roll ticks required for a "Good" hit. + /// + public double RequiredGoodHits; + + /// + /// Number of drum roll ticks required for a "Great" hit. + /// + public double RequiredGreatHits; + + /// + /// Total number of drum roll ticks. + /// + public int TotalTicks; + + /// + /// Initializes the drum roll ticks if not initialized and returns them. + /// + public IEnumerable Ticks + { + get + { + if (ticks == null) + createTicks(); + return ticks; + } + } + + private List ticks; + + public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) + { + base.ApplyDefaults(timing, difficulty); + + Velocity = (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) / 1000; + TickTimeDistance = timing.BeatLengthAt(StartTime); + + if (difficulty.SliderTickRate == 3) + TickTimeDistance /= 3; + else + TickTimeDistance /= 4; + + TotalTicks = Ticks.Count(); + 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); + } + + private void createTicks() + { + ticks = new List(); + + if (TickTimeDistance == 0) + return; + + bool first = true; + for (double t = StartTime; t < EndTime + (int)TickTimeDistance; t += TickTimeDistance) + { + ticks.Add(new DrumRollTick + { + FirstTick = first, + PreEmpt = PreEmpt, + TickTimeDistance = TickTimeDistance, + StartTime = t, + Sample = new HitSampleInfo + { + Type = SampleType.None, + Set = SampleSet.Soft + } + }); + + first = false; + } + } + + public override TaikoHitType Type + { + get + { + SampleType st = Sample?.Type ?? SampleType.None; + + return TaikoHitType.DrumRoll | ((st & SampleType.Finish) > 0 ? TaikoHitType.Finisher : TaikoHitType.None); + } + } + } +} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs new file mode 100644 index 0000000000..c2487f7422 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Modes.Taiko.Objects +{ + public class DrumRollTick : TaikoHitObject + { + /// + /// Whether this is the first (initial) tick of the slider. + /// + public bool FirstTick; + + /// + /// The distance between this tick and the next in milliseconds. + /// Half of this value is the hit window of the tick. + /// + public double TickTimeDistance; + + public override TaikoHitType Type => TaikoHitType.DrumRollTick; + } +} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 0e9e6a56b4..5fbdc7d525 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -50,6 +50,8 @@ + + From f48af91686bc48d8f57c30932aa34b87dabb8632 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 15:45:54 +0900 Subject: [PATCH 2/5] Appease the resharper gods. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 9ce2758d84..eebbb4717e 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Beatmaps; using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Objects.Types; using System; @@ -68,7 +67,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - Velocity = (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) / 1000; + Velocity = timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier / 1000; TickTimeDistance = timing.BeatLengthAt(StartTime); if (difficulty.SliderTickRate == 3) From b3b8fadf031a11f867d28a2cd5ecd29b9636dad4 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 20 Mar 2017 13:02:52 +0900 Subject: [PATCH 3/5] Remove Type. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 10 ---------- osu.Game.Modes.Taiko/Objects/DrumRollTick.cs | 2 -- 2 files changed, 12 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index eebbb4717e..ba51878635 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -106,15 +106,5 @@ namespace osu.Game.Modes.Taiko.Objects first = false; } } - - public override TaikoHitType Type - { - get - { - SampleType st = Sample?.Type ?? SampleType.None; - - return TaikoHitType.DrumRoll | ((st & SampleType.Finish) > 0 ? TaikoHitType.Finisher : TaikoHitType.None); - } - } } } \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs index c2487f7422..66a2d16fe1 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs @@ -15,7 +15,5 @@ namespace osu.Game.Modes.Taiko.Objects /// Half of this value is the hit window of the tick. /// public double TickTimeDistance; - - public override TaikoHitType Type => TaikoHitType.DrumRollTick; } } \ No newline at end of file From 712d2e194c7e6699350f3748780dfdf5f9cd7547 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 01:33:22 +0900 Subject: [PATCH 4/5] A bit more protection. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 31 +++++++++--------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index ba51878635..78e9202f20 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -25,41 +25,33 @@ namespace osu.Game.Modes.Taiko.Objects /// /// Velocity of the drum roll in positional length units per millisecond. /// - public double Velocity; + public double Velocity { get; protected set; } /// /// The distance between ticks of this drumroll. /// Half of this value is the hit window of the ticks. /// - public double TickTimeDistance; + public double TickTimeDistance { get; protected set; } /// /// Number of drum roll ticks required for a "Good" hit. /// - public double RequiredGoodHits; + public double RequiredGoodHits { get; protected set; } /// /// Number of drum roll ticks required for a "Great" hit. /// - public double RequiredGreatHits; + public double RequiredGreatHits { get; protected set; } /// /// Total number of drum roll ticks. /// - public int TotalTicks; + public int TotalTicks => Ticks.Count(); /// /// Initializes the drum roll ticks if not initialized and returns them. /// - public IEnumerable Ticks - { - get - { - if (ticks == null) - createTicks(); - return ticks; - } - } + public IEnumerable Ticks => ticks ?? (ticks = createTicks()); private List ticks; @@ -75,22 +67,21 @@ namespace osu.Game.Modes.Taiko.Objects else TickTimeDistance /= 4; - TotalTicks = Ticks.Count(); 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); } - private void createTicks() + private List createTicks() { - ticks = new List(); + var ret = new List(); if (TickTimeDistance == 0) - return; + return ret; bool first = true; for (double t = StartTime; t < EndTime + (int)TickTimeDistance; t += TickTimeDistance) { - ticks.Add(new DrumRollTick + ret.Add(new DrumRollTick { FirstTick = first, PreEmpt = PreEmpt, @@ -105,6 +96,8 @@ namespace osu.Game.Modes.Taiko.Objects first = false; } + + return ret; } } } \ No newline at end of file From bf94587ca7d925e0da4f535fff476d7616631114 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 10:56:30 +0900 Subject: [PATCH 5/5] Add TODO. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 78e9202f20..cdb8ef2405 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -62,6 +62,7 @@ namespace osu.Game.Modes.Taiko.Objects Velocity = timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier / 1000; TickTimeDistance = timing.BeatLengthAt(StartTime); + //TODO: move this to legacy conversion code to allow for direct division without special case. if (difficulty.SliderTickRate == 3) TickTimeDistance /= 3; else @@ -100,4 +101,4 @@ namespace osu.Game.Modes.Taiko.Objects return ret; } } -} \ No newline at end of file +}