1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 04:43:22 +08:00

Fixed taiko swell hp and scoring

This commit is contained in:
Ivan Pavluk 2018-11-29 22:05:13 +07:00
parent 35d57f74bf
commit 2ca9864301
10 changed files with 69 additions and 43 deletions

View File

@ -9,6 +9,8 @@ namespace osu.Game.Rulesets.Taiko.Judgements
{ {
public override bool AffectsCombo => false; public override bool AffectsCombo => false;
public override bool AffectsHP => false;
protected override int NumericResultFor(HitResult result) => 0; protected override int NumericResultFor(HitResult result) => 0;
} }
} }

View File

@ -1,21 +0,0 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// 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;
/// <summary>
/// Computes the numeric result value for the combo portion of the score.
/// </summary>
/// <param name="result">The result to compute the value for.</param>
/// <returns>The numeric result value.</returns>
protected override int NumericResultFor(HitResult result) => 0;
}
}

View File

@ -10,6 +10,11 @@ namespace osu.Game.Rulesets.Taiko.Judgements
{ {
public override HitResult MaxResult => HitResult.Great; public override HitResult MaxResult => HitResult.Great;
/// <summary>
/// Whether this <see cref="TaikoJudgement"/> should affect user's hitpoints.
/// </summary>
public virtual bool AffectsHP => true;
/// <summary> /// <summary>
/// Computes the numeric result value for the combo portion of the score. /// Computes the numeric result value for the combo portion of the score.
/// </summary> /// </summary>

View File

@ -5,6 +5,9 @@ namespace osu.Game.Rulesets.Taiko.Judgements
{ {
public class TaikoStrongJudgement : TaikoJudgement public class TaikoStrongJudgement : TaikoJudgement
{ {
// MainObject already changes the HP
public override bool AffectsHP => false;
public override bool AffectsCombo => false; public override bool AffectsCombo => false;
} }
} }

View File

@ -0,0 +1,14 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// 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;
}
}

View File

@ -0,0 +1,25 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// 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;
}
}
}
}

View File

@ -6,11 +6,11 @@ using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
public class DrawableSwellTick : DrawableTaikoHitObject public class DrawableSwellTick : DrawableTaikoHitObject<SwellTick>
{ {
public override bool DisplayResult => false; public override bool DisplayResult => false;
public DrawableSwellTick(TaikoHitObject hitObject) public DrawableSwellTick(SwellTick hitObject)
: base(hitObject) : base(hitObject)
{ {
} }

View File

@ -3,11 +3,15 @@
using System; using System;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Taiko.Judgements;
namespace osu.Game.Rulesets.Taiko.Objects namespace osu.Game.Rulesets.Taiko.Objects
{ {
public class Swell : TaikoHitObject, IHasEndTime public class Swell : TaikoHitObject, IHasEndTime
{ {
public override Judgement CreateJudgement() => new TaikoSwellJudgement();
public double EndTime => StartTime + Duration; public double EndTime => StartTime + Duration;
public double Duration { get; set; } public double Duration { get; set; }

View File

@ -1,9 +1,13 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // 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 namespace osu.Game.Rulesets.Taiko.Objects
{ {
public class SwellTick : TaikoHitObject public class SwellTick : TaikoHitObject
{ {
public override Judgement CreateJudgement() => new TaikoSwellTickJudgement();
} }
} }

View File

@ -79,27 +79,15 @@ namespace osu.Game.Rulesets.Taiko.Scoring
protected override void ApplyResult(JudgementResult result) protected override void ApplyResult(JudgementResult result)
{ {
base.ApplyResult(result); base.ApplyResult(result);
if (!((TaikoJudgement)result.Judgement).AffectsHP)
return;
bool isRoll = false; bool isSwell = false;
bool isStrong = false;
bool isTick = result.Judgement is TaikoDrumRollTickJudgement; bool isTick = result.Judgement is TaikoDrumRollTickJudgement;
if (!isTick) if(!isTick)
{ isSwell = result.Judgement is TaikoSwellJudgement;
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;
// Apply HP changes // Apply HP changes
switch (result.Type) switch (result.Type)
@ -110,12 +98,14 @@ namespace osu.Game.Rulesets.Taiko.Scoring
Health.Value += hpIncreaseMiss; Health.Value += hpIncreaseMiss;
break; break;
case HitResult.Good: case HitResult.Good:
Health.Value += hpIncreaseGood; // Swells shouldn't increase HP
if (!isSwell)
Health.Value += hpIncreaseGood;
break; break;
case HitResult.Great: case HitResult.Great:
if (isTick) if (isTick)
Health.Value += hpIncreaseTick; Health.Value += hpIncreaseTick;
else else if(!isSwell)
Health.Value += hpIncreaseGreat; Health.Value += hpIncreaseGreat;
break; break;
} }