mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:12:56 +08:00
Give rulesets a way to disable/enable perfect/ok hit results
This commit is contained in:
parent
cfdeac6428
commit
802aaefe35
@ -1,6 +1,8 @@
|
||||
// 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.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Mania.Objects.Types;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
@ -9,5 +11,13 @@ namespace osu.Game.Rulesets.Mania.Objects
|
||||
public abstract class ManiaHitObject : HitObject, IHasColumn
|
||||
{
|
||||
public virtual int Column { get; set; }
|
||||
|
||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
||||
{
|
||||
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||
|
||||
HitWindows.AllowsPerfect = true;
|
||||
HitWindows.AllowsOk = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,35 +21,47 @@ namespace osu.Game.Rulesets.Objects
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Hit window for a <see cref="HitResult.Perfect"/> hit.
|
||||
/// Hit window for a <see cref="HitResult.Perfect"/> result.
|
||||
/// The user can only achieve receive this result if <see cref="AllowsPerfect"/> is true.
|
||||
/// </summary>
|
||||
public double Perfect { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Hit window for a <see cref="HitResult.Great"/> hit.
|
||||
/// Hit window for a <see cref="HitResult.Great"/> result.
|
||||
/// </summary>
|
||||
public double Great { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Hit window for a <see cref="HitResult.Good"/> hit.
|
||||
/// Hit window for a <see cref="HitResult.Good"/> result.
|
||||
/// </summary>
|
||||
public double Good { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Hit window for an <see cref="HitResult.OK"/> hit.
|
||||
/// Hit window for an <see cref="HitResult.OK"/> result.
|
||||
/// The user can only achieve this result if <see cref="AllowsOk"/> is true.
|
||||
/// </summary>
|
||||
public double Ok { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Hit window for a <see cref="HitResult.Meh"/> hit.
|
||||
/// Hit window for a <see cref="HitResult.Meh"/> result.
|
||||
/// </summary>
|
||||
public double Meh { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Hit window for a <see cref="HitResult.Miss"/> hit.
|
||||
/// Hit window for a <see cref="HitResult.Miss"/> result.
|
||||
/// </summary>
|
||||
public double Miss { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether it's possible to achieve a <see cref="HitResult.Perfect"/> result.
|
||||
/// </summary>
|
||||
public bool AllowsPerfect;
|
||||
|
||||
/// <summary>
|
||||
/// Whether it's possible to achieve a <see cref="HitResult.Ok"/> result.
|
||||
/// </summary>
|
||||
public bool AllowsOk;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs hit windows by fitting a parameter to a 2-part piecewise linear function for each hit window.
|
||||
/// </summary>
|
||||
@ -73,13 +85,13 @@ namespace osu.Game.Rulesets.Objects
|
||||
{
|
||||
timeOffset = Math.Abs(timeOffset);
|
||||
|
||||
if (timeOffset <= HalfWindowFor(HitResult.Perfect))
|
||||
if (AllowsPerfect && timeOffset <= HalfWindowFor(HitResult.Perfect))
|
||||
return HitResult.Perfect;
|
||||
if (timeOffset <= HalfWindowFor(HitResult.Great))
|
||||
return HitResult.Great;
|
||||
if (timeOffset <= HalfWindowFor(HitResult.Good))
|
||||
return HitResult.Good;
|
||||
if (timeOffset <= HalfWindowFor(HitResult.Ok))
|
||||
if (AllowsOk && timeOffset <= HalfWindowFor(HitResult.Ok))
|
||||
return HitResult.Ok;
|
||||
if (timeOffset <= HalfWindowFor(HitResult.Meh))
|
||||
return HitResult.Meh;
|
||||
|
Loading…
Reference in New Issue
Block a user