mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 07:23:14 +08:00
Implement Sudden Death and Perfect
- Two additional fail conditions
This commit is contained in:
parent
9c86390814
commit
de4d8eb196
@ -66,6 +66,8 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// </summary>
|
||||
protected virtual bool HasCompleted => false;
|
||||
|
||||
public int strictFail = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this ScoreProcessor has already triggered the failed state.
|
||||
/// </summary>
|
||||
@ -76,6 +78,16 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// </summary>
|
||||
protected virtual bool FailCondition => Health.Value == Health.MinValue;
|
||||
|
||||
/// <summary>
|
||||
/// The conditions for failing if the Sudden Death mod is enabled.
|
||||
/// </summary>
|
||||
protected virtual bool SuddenDeathFailCondition => Combo.Value != HighestCombo.Value;
|
||||
|
||||
/// <summary>
|
||||
/// The conditions for failing if the Perfect mod is enabled.
|
||||
/// </summary>
|
||||
protected virtual bool PerfectFailCondition => Accuracy.Value != 1;
|
||||
|
||||
protected ScoreProcessor()
|
||||
{
|
||||
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
|
||||
@ -121,11 +133,16 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// </summary>
|
||||
protected void UpdateFailed()
|
||||
{
|
||||
if (HasFailed || !FailCondition)
|
||||
if (HasFailed)
|
||||
return;
|
||||
|
||||
if (Failed?.Invoke() != false)
|
||||
HasFailed = true;
|
||||
if(FailCondition ||
|
||||
(strictFail==1 && SuddenDeathFailCondition) ||
|
||||
(strictFail==2 && PerfectFailCondition))
|
||||
{
|
||||
if (Failed?.Invoke() != false)
|
||||
HasFailed = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -227,6 +227,12 @@ namespace osu.Game.Screens.Play
|
||||
// Bind ScoreProcessor to ourselves
|
||||
scoreProcessor.AllJudged += onCompletion;
|
||||
scoreProcessor.Failed += onFail;
|
||||
|
||||
if (Beatmap.Value.Mods.Value.Any(m => m.Name == "Sudden Death"))
|
||||
scoreProcessor.strictFail = 1;
|
||||
|
||||
if (Beatmap.Value.Mods.Value.Any(m => m.Name == "Perfect"))
|
||||
scoreProcessor.strictFail = 2;
|
||||
}
|
||||
|
||||
private void applyRateFromMods()
|
||||
|
Loading…
Reference in New Issue
Block a user