mirror of https://github.com/ppy/osu
Implement Sudden Death and Perfect
- Two additional fail conditions
This commit is contained in:
parent
9c86390814
commit
de4d8eb196
|
@ -66,6 +66,8 @@ public abstract class ScoreProcessor
|
|||
/// </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 @@ public abstract class ScoreProcessor
|
|||
/// </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 @@ protected virtual void Reset(bool storeResults)
|
|||
/// </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 @@ private void load(AudioManager audio, OsuConfigManager config, APIAccess api)
|
|||
// 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