diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index b2676bf28a..9b143e9fde 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -61,7 +61,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps if (endTimeData != null) { // We compute the end time manually to add in the Bash convert factor - return new Bash + return new Swell { StartTime = original.StartTime, Sample = original.Sample, diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs new file mode 100644 index 0000000000..15584ac73f --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs @@ -0,0 +1,75 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Input; +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Taiko.Judgements; +using System; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableSwell : DrawableTaikoHitObject + { + /// + /// The amount of times the user has hit this swell. + /// + private int userHits; + + private readonly Swell swell; + + public DrawableSwell(Swell swell) + : base(swell) + { + this.swell = swell; + } + + protected override void CheckJudgement(bool userTriggered) + { + if (userTriggered) + { + if (Time.Current < HitObject.StartTime) + return; + + userHits++; + + if (userHits == swell.RequiredHits) + { + Judgement.Result = HitResult.Hit; + Judgement.TaikoResult = TaikoHitResult.Great; + } + } + else + { + if (Judgement.TimeOffset < 0) + return; + + if (userHits > swell.RequiredHits / 2) + { + Judgement.Result = HitResult.Hit; + Judgement.TaikoResult = TaikoHitResult.Good; + } + else + Judgement.Result = HitResult.Miss; + } + } + + protected override void UpdateState(ArmedState state) + { + } + + protected override void UpdateScrollPosition(double time) + { + base.UpdateScrollPosition(Math.Min(time, HitObject.StartTime)); + } + + protected override bool HandleKeyPress(Key key) + { + if (Judgement.Result.HasValue) + return false; + + UpdateJudgement(true); + + return true; + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Bash.cs b/osu.Game.Modes.Taiko/Objects/Swell.cs similarity index 84% rename from osu.Game.Modes.Taiko/Objects/Bash.cs rename to osu.Game.Modes.Taiko/Objects/Swell.cs index b8b4eea6a9..20b9a6effb 100644 --- a/osu.Game.Modes.Taiko/Objects/Bash.cs +++ b/osu.Game.Modes.Taiko/Objects/Swell.cs @@ -8,14 +8,14 @@ using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Taiko.Objects { - public class Bash : TaikoHitObject, IHasEndTime + public class Swell : TaikoHitObject, IHasEndTime { public double EndTime { get; set; } public double Duration => EndTime - StartTime; /// - /// The number of hits required to complete the bash successfully. + /// The number of hits required to complete the swell successfully. /// public int RequiredHits { get; protected set; } diff --git a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs index 3007411230..a3759d9c81 100644 --- a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs @@ -165,7 +165,7 @@ namespace osu.Game.Modes.Taiko.Scoring SecondHit = obj.Accented }); } - else if (obj is Bash) + else if (obj is Swell) { AddJudgement(new TaikoJudgement { diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index f02103a05f..50ec2002fb 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -57,14 +57,16 @@ - + + + - - + +