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

Implement Sudden Death and Perfect

- Two additional fail conditions
This commit is contained in:
Brayzure 2017-11-18 01:28:09 -05:00
parent 9c86390814
commit de4d8eb196
2 changed files with 26 additions and 3 deletions

View File

@ -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>

View File

@ -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()