1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Remove Meh from TaikoHitWindows

This commit is contained in:
Ivan Pavluk 2018-12-06 19:04:54 +07:00
parent 8cae549541
commit cb2444e01c
4 changed files with 43 additions and 29 deletions

View File

@ -20,11 +20,10 @@ namespace osu.Game.Rulesets.Mania.Objects
{ HitResult.Miss, (376, 346, 316) }, { HitResult.Miss, (376, 346, 316) },
}; };
public override bool IsHitResultAllowed(HitResult result) => true;
public override void SetDifficulty(double difficulty) public override void SetDifficulty(double difficulty)
{ {
AllowsPerfect = true;
AllowsOk = true;
Perfect = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Perfect]); Perfect = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Perfect]);
Great = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Great]); Great = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Great]);
Good = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Good]); Good = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Good]);

View File

@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
} }
var result = HitObject.HitWindows.ResultFor(timeOffset); var result = HitObject.HitWindows.ResultFor(timeOffset);
if (result <= HitResult.Miss) if (result == HitResult.None)
return; return;
if (!validActionPressed) if (!validActionPressed)
@ -173,12 +173,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
if (!userTriggered) if (!userTriggered)
{ {
if (timeOffset > second_hit_window) if (timeOffset - MainObject.Result.TimeOffset > second_hit_window)
ApplyResult(r => r.Type = HitResult.Miss); ApplyResult(r => r.Type = HitResult.Miss);
return; return;
} }
if (Math.Abs(MainObject.Result.TimeOffset - timeOffset) < second_hit_window) if (Math.Abs(timeOffset - MainObject.Result.TimeOffset) <= second_hit_window)
ApplyResult(r => r.Type = MainObject.Result.Type); ApplyResult(r => r.Type = MainObject.Result.Type);
} }

View File

@ -14,15 +14,28 @@ namespace osu.Game.Rulesets.Taiko.Objects
{ {
{ HitResult.Great, (100, 70, 40) }, { HitResult.Great, (100, 70, 40) },
{ HitResult.Good, (240, 160, 100) }, { HitResult.Good, (240, 160, 100) },
{ HitResult.Meh, (270, 190, 140) }, { HitResult.Miss, (270, 190, 140) },
{ HitResult.Miss, (400, 400, 400) },
}; };
protected override double SuccessfulHitWindow => Good;
public override bool IsHitResultAllowed(HitResult result)
{
switch (result)
{
case HitResult.Great:
case HitResult.Good:
case HitResult.Miss:
return true;
default:
return false;
}
}
public override void SetDifficulty(double difficulty) public override void SetDifficulty(double difficulty)
{ {
Great = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Great]); Great = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Great]);
Good = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Good]); Good = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Good]);
Meh = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Meh]);
Miss = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Miss]); Miss = BeatmapDifficulty.DifficultyRange(difficulty, base_ranges[HitResult.Miss]);
} }
} }

View File

@ -22,7 +22,6 @@ namespace osu.Game.Rulesets.Objects
/// <summary> /// <summary>
/// Hit window for a <see cref="HitResult.Perfect"/> result. /// Hit window for a <see cref="HitResult.Perfect"/> result.
/// The user can only achieve receive this result if <see cref="AllowsPerfect"/> is true.
/// </summary> /// </summary>
public double Perfect { get; protected set; } public double Perfect { get; protected set; }
@ -38,7 +37,6 @@ namespace osu.Game.Rulesets.Objects
/// <summary> /// <summary>
/// Hit window for an <see cref="HitResult.Ok"/> result. /// Hit window for an <see cref="HitResult.Ok"/> result.
/// The user can only achieve this result if <see cref="AllowsOk"/> is true.
/// </summary> /// </summary>
public double Ok { get; protected set; } public double Ok { get; protected set; }
@ -53,14 +51,25 @@ namespace osu.Game.Rulesets.Objects
public double Miss { get; protected set; } public double Miss { get; protected set; }
/// <summary> /// <summary>
/// Whether it's possible to achieve a <see cref="HitResult.Perfect"/> result. /// Hit window for a non-<see cref="HitResult.Miss"/> result.
/// </summary> /// </summary>
public bool AllowsPerfect; protected virtual double SuccessfulHitWindow => Meh;
/// <summary> /// <summary>
/// Whether it's possible to achieve a <see cref="HitResult.Ok"/> result. /// Whether it's possible to achieve this <see cref="HitResult"/>.
/// </summary> /// </summary>
public bool AllowsOk; /// <param name="result">The result.</param>
public virtual bool IsHitResultAllowed(HitResult result)
{
switch(result)
{
case HitResult.Perfect:
case HitResult.Ok:
return false;
default:
return true;
}
}
/// <summary> /// <summary>
/// Sets hit windows with values that correspond to a difficulty parameter. /// Sets hit windows with values that correspond to a difficulty parameter.
@ -85,18 +94,11 @@ namespace osu.Game.Rulesets.Objects
{ {
timeOffset = Math.Abs(timeOffset); timeOffset = Math.Abs(timeOffset);
if (AllowsPerfect && timeOffset <= HalfWindowFor(HitResult.Perfect)) for(var result = HitResult.Perfect; result >= HitResult.Miss; --result)
return HitResult.Perfect; {
if (timeOffset <= HalfWindowFor(HitResult.Great)) if(IsHitResultAllowed(result) && timeOffset <= HalfWindowFor(result))
return HitResult.Great; return result;
if (timeOffset <= HalfWindowFor(HitResult.Good)) }
return HitResult.Good;
if (AllowsOk && timeOffset <= HalfWindowFor(HitResult.Ok))
return HitResult.Ok;
if (timeOffset <= HalfWindowFor(HitResult.Meh))
return HitResult.Meh;
if (timeOffset <= HalfWindowFor(HitResult.Miss))
return HitResult.Miss;
return HitResult.None; return HitResult.None;
} }
@ -130,10 +132,10 @@ namespace osu.Game.Rulesets.Objects
/// <summary> /// <summary>
/// Given a time offset, whether the <see cref="HitObject"/> can ever be hit in the future with a non-<see cref="HitResult.Miss"/> result. /// Given a time offset, whether the <see cref="HitObject"/> can ever be hit in the future with a non-<see cref="HitResult.Miss"/> result.
/// This happens if <paramref name="timeOffset"/> is less than what is required for a <see cref="Meh"/> result. /// This happens if <paramref name="timeOffset"/> is less than what is required for a <see cref="SuccessfulHitWindow"/> result.
/// </summary> /// </summary>
/// <param name="timeOffset">The time offset.</param> /// <param name="timeOffset">The time offset.</param>
/// <returns>Whether the <see cref="HitObject"/> can be hit at any point in the future from this time offset.</returns> /// <returns>Whether the <see cref="HitObject"/> can be hit at any point in the future from this time offset.</returns>
public bool CanBeHit(double timeOffset) => timeOffset <= HalfWindowFor(HitResult.Meh); public bool CanBeHit(double timeOffset) => timeOffset <= SuccessfulHitWindow / 2;
} }
} }