From 2ca9864301f1676ce36041d4b27ca6c90bcfe9a6 Mon Sep 17 00:00:00 2001 From: Ivan Pavluk Date: Thu, 29 Nov 2018 22:05:13 +0700 Subject: [PATCH] Fixed taiko swell hp and scoring --- .../Judgements/TaikoDrumRollJudgement.cs | 2 ++ .../TaikoIntermediateSwellJudgement.cs | 21 ------------- .../Judgements/TaikoJudgement.cs | 5 ++++ .../Judgements/TaikoStrongJudgement.cs | 3 ++ .../Judgements/TaikoSwellJudgement.cs | 14 +++++++++ .../Judgements/TaikoSwellTickJudgement.cs | 25 ++++++++++++++++ .../Objects/Drawables/DrawableSwellTick.cs | 4 +-- osu.Game.Rulesets.Taiko/Objects/Swell.cs | 4 +++ osu.Game.Rulesets.Taiko/Objects/SwellTick.cs | 4 +++ .../Scoring/TaikoScoreProcessor.cs | 30 +++++++------------ 10 files changed, 69 insertions(+), 43 deletions(-) delete mode 100644 osu.Game.Rulesets.Taiko/Judgements/TaikoIntermediateSwellJudgement.cs create mode 100644 osu.Game.Rulesets.Taiko/Judgements/TaikoSwellJudgement.cs create mode 100644 osu.Game.Rulesets.Taiko/Judgements/TaikoSwellTickJudgement.cs diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollJudgement.cs index 8ef98c6dac..4663d00bdc 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollJudgement.cs @@ -9,6 +9,8 @@ namespace osu.Game.Rulesets.Taiko.Judgements { public override bool AffectsCombo => false; + public override bool AffectsHP => false; + protected override int NumericResultFor(HitResult result) => 0; } } diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoIntermediateSwellJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoIntermediateSwellJudgement.cs deleted file mode 100644 index 81a1bd1344..0000000000 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoIntermediateSwellJudgement.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Rulesets.Scoring; - -namespace osu.Game.Rulesets.Taiko.Judgements -{ - public class TaikoIntermediateSwellJudgement : TaikoJudgement - { - public override HitResult MaxResult => HitResult.Great; - - public override bool AffectsCombo => false; - - /// - /// Computes the numeric result value for the combo portion of the score. - /// - /// The result to compute the value for. - /// The numeric result value. - protected override int NumericResultFor(HitResult result) => 0; - } -} diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs index 9b1f7a08b5..386495bf1b 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs @@ -10,6 +10,11 @@ namespace osu.Game.Rulesets.Taiko.Judgements { public override HitResult MaxResult => HitResult.Great; + /// + /// Whether this should affect user's hitpoints. + /// + public virtual bool AffectsHP => true; + /// /// Computes the numeric result value for the combo portion of the score. /// diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongJudgement.cs index ccfdeb5b0e..2665540d07 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongJudgement.cs @@ -5,6 +5,9 @@ namespace osu.Game.Rulesets.Taiko.Judgements { public class TaikoStrongJudgement : TaikoJudgement { + // MainObject already changes the HP + public override bool AffectsHP => false; + public override bool AffectsCombo => false; } } diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoSwellJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoSwellJudgement.cs new file mode 100644 index 0000000000..b913f5d730 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoSwellJudgement.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Taiko.Judgements +{ + public class TaikoSwellJudgement : TaikoJudgement + { + public override bool AffectsCombo => false; + + protected override int NumericResultFor(HitResult result) => 0; + } +} diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoSwellTickJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoSwellTickJudgement.cs new file mode 100644 index 0000000000..8dd03796ea --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoSwellTickJudgement.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Taiko.Judgements +{ + public class TaikoSwellTickJudgement : TaikoJudgement + { + public override bool AffectsCombo => false; + + public override bool AffectsHP => false; + + protected override int NumericResultFor(HitResult result) + { + switch (result) + { + default: + return 0; + case HitResult.Great: + return 300; + } + } + } +} diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs index 36c468c6d6..0a73474cf3 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwellTick.cs @@ -6,11 +6,11 @@ using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { - public class DrawableSwellTick : DrawableTaikoHitObject + public class DrawableSwellTick : DrawableTaikoHitObject { public override bool DisplayResult => false; - public DrawableSwellTick(TaikoHitObject hitObject) + public DrawableSwellTick(SwellTick hitObject) : base(hitObject) { } diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index 702bf63bf5..67e2cae5eb 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -3,11 +3,15 @@ using System; using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects { public class Swell : TaikoHitObject, IHasEndTime { + public override Judgement CreateJudgement() => new TaikoSwellJudgement(); + public double EndTime => StartTime + Duration; public double Duration { get; set; } diff --git a/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs b/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs index 49eb6d2a15..38f77fa1e7 100644 --- a/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/SwellTick.cs @@ -1,9 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Taiko.Judgements; + namespace osu.Game.Rulesets.Taiko.Objects { public class SwellTick : TaikoHitObject { + public override Judgement CreateJudgement() => new TaikoSwellTickJudgement(); } } diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index a2a0251860..06d207695f 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -79,27 +79,15 @@ namespace osu.Game.Rulesets.Taiko.Scoring protected override void ApplyResult(JudgementResult result) { base.ApplyResult(result); + + if (!((TaikoJudgement)result.Judgement).AffectsHP) + return; - bool isRoll = false; - bool isStrong = false; + bool isSwell = false; bool isTick = result.Judgement is TaikoDrumRollTickJudgement; - if (!isTick) - { - isRoll = result.Judgement is TaikoDrumRollJudgement; - if (!isRoll) - { - isStrong = result.Judgement is TaikoStrongJudgement; - } - } - - //Don't change HP based on drum roll fullness for compatibility - if (isRoll) - return; - - //If the object is strong, HP change is already handled in MainObject - if (isStrong) - return; + if(!isTick) + isSwell = result.Judgement is TaikoSwellJudgement; // Apply HP changes switch (result.Type) @@ -110,12 +98,14 @@ namespace osu.Game.Rulesets.Taiko.Scoring Health.Value += hpIncreaseMiss; break; case HitResult.Good: - Health.Value += hpIncreaseGood; + // Swells shouldn't increase HP + if (!isSwell) + Health.Value += hpIncreaseGood; break; case HitResult.Great: if (isTick) Health.Value += hpIncreaseTick; - else + else if(!isSwell) Health.Value += hpIncreaseGreat; break; }