From b399c6adbb65dcf7a4a6442c2de5e49be8b9d18c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 13:38:17 +0900 Subject: [PATCH] Implement TaikoHitObject. --- .../Objects/TaikoHitObject.cs | 73 +++++++++++++++++-- osu.Game.Modes.Taiko/Objects/TaikoHitType.cs | 21 ++++++ .../osu.Game.Modes.Taiko.csproj | 1 + 3 files changed, 87 insertions(+), 8 deletions(-) create mode 100644 osu.Game.Modes.Taiko/Objects/TaikoHitType.cs diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index a5f488e076..b46a633647 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -1,20 +1,77 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps.Samples; +using osu.Game.Beatmaps.Timing; +using osu.Game.Database; using osu.Game.Modes.Objects; namespace osu.Game.Modes.Taiko.Objects { public class TaikoHitObject : HitObject { - public float Scale = 1; + /// + /// HitCircle radius. + /// + public const float CIRCLE_RADIUS = 64; - public TaikoColour Type; - } + /// + /// The hit window that results in a "GREAT" hit. + /// + public double HitWindowGreat = 35; - public enum TaikoColour - { - Red, - Blue + /// + /// The hit window that results in a "GOOD" hit. + /// + public double HitWindowGood = 80; + + /// + /// The hit window that results in a "MISS". + /// + public double HitWindowMiss = 95; + + /// + /// The time to scroll in the HitObject. + /// + public double PreEmpt; + + /// + /// Whether this HitObject is in Kiai time. + /// + public bool Kiai; + + /// + /// The type of HitObject. + /// + public virtual TaikoHitType Type + { + get + { + SampleType st = Sample?.Type ?? SampleType.None; + + return + // Centre/Rim + ((st & ~(SampleType.Finish | SampleType.Normal)) == 0 ? TaikoHitType.CentreHit : TaikoHitType.RimHit) + // Finisher + | ((st & SampleType.Finish) > 0 ? TaikoHitType.Finisher : TaikoHitType.None); + } + } + + public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) + { + base.ApplyDefaults(timing, difficulty); + + PreEmpt = 600 / (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) * 1000; + + ControlPoint overridePoint; + Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode; + + if (overridePoint != null) + Kiai |= overridePoint.KiaiMode; + + HitWindowGreat = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 50, 35, 20); + HitWindowGood = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 120, 80, 50); + HitWindowMiss = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 135, 95, 70); + } } -} +} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitType.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitType.cs new file mode 100644 index 0000000000..adf3a67246 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitType.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 + +using System; + +namespace osu.Game.Modes.Taiko.Objects +{ + [Flags] + public enum TaikoHitType + { + None = 0, + CentreHit = 1 << 0, + RimHit = 1 << 1, + DrumRoll = 1 << 2, + DrumRollTick = 1 << 3, + Bash = 1 << 4, + Finisher = 1 << 5, + + Hit = CentreHit | RimHit + } +} \ 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 7ea6dfeadb..0e9e6a56b4 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -50,6 +50,7 @@ +