mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 02:03:22 +08:00
Merge branch 'master' into new-menus
This commit is contained in:
commit
968c61902a
@ -1,8 +1,11 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.Judgements;
|
using osu.Game.Rulesets.Osu.Judgements;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
@ -14,6 +17,8 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
{
|
{
|
||||||
internal class OsuScoreProcessor : ScoreProcessor<OsuHitObject, OsuJudgement>
|
internal class OsuScoreProcessor : ScoreProcessor<OsuHitObject, OsuJudgement>
|
||||||
{
|
{
|
||||||
|
public readonly Bindable<ScoringMode> Mode = new Bindable<ScoringMode>(ScoringMode.Exponential);
|
||||||
|
|
||||||
public OsuScoreProcessor()
|
public OsuScoreProcessor()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -25,9 +30,31 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
|
|
||||||
private float hpDrainRate;
|
private float hpDrainRate;
|
||||||
|
|
||||||
protected override void ComputeTargets(Game.Beatmaps.Beatmap<OsuHitObject> beatmap)
|
private int totalAccurateJudgements;
|
||||||
|
|
||||||
|
private readonly Dictionary<OsuScoreResult, int> scoreResultCounts = new Dictionary<OsuScoreResult, int>();
|
||||||
|
private readonly Dictionary<ComboResult, int> comboResultCounts = new Dictionary<ComboResult, int>();
|
||||||
|
|
||||||
|
private double comboMaxScore;
|
||||||
|
|
||||||
|
protected override void ComputeTargets(Beatmap<OsuHitObject> beatmap)
|
||||||
{
|
{
|
||||||
hpDrainRate = beatmap.BeatmapInfo.Difficulty.DrainRate;
|
hpDrainRate = beatmap.BeatmapInfo.Difficulty.DrainRate;
|
||||||
|
totalAccurateJudgements = beatmap.HitObjects.Count;
|
||||||
|
|
||||||
|
foreach (var h in beatmap.HitObjects)
|
||||||
|
{
|
||||||
|
if (h != null)
|
||||||
|
{
|
||||||
|
// TODO: add support for other object types.
|
||||||
|
AddJudgement(new OsuJudgement
|
||||||
|
{
|
||||||
|
MaxScore = OsuScoreResult.Hit300,
|
||||||
|
Score = OsuScoreResult.Hit300,
|
||||||
|
Result = HitResult.Hit
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Reset()
|
protected override void Reset()
|
||||||
@ -41,9 +68,6 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
comboResultCounts.Clear();
|
comboResultCounts.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Dictionary<OsuScoreResult, int> scoreResultCounts = new Dictionary<OsuScoreResult, int>();
|
|
||||||
private readonly Dictionary<ComboResult, int> comboResultCounts = new Dictionary<ComboResult, int>();
|
|
||||||
|
|
||||||
public override void PopulateScore(Score score)
|
public override void PopulateScore(Score score)
|
||||||
{
|
{
|
||||||
base.PopulateScore(score);
|
base.PopulateScore(score);
|
||||||
@ -63,6 +87,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
scoreResultCounts[judgement.Score] = scoreResultCounts.GetOrDefault(judgement.Score) + 1;
|
scoreResultCounts[judgement.Score] = scoreResultCounts.GetOrDefault(judgement.Score) + 1;
|
||||||
comboResultCounts[judgement.Combo] = comboResultCounts.GetOrDefault(judgement.Combo) + 1;
|
comboResultCounts[judgement.Combo] = comboResultCounts.GetOrDefault(judgement.Combo) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (judgement.Score)
|
switch (judgement.Score)
|
||||||
{
|
{
|
||||||
case OsuScoreResult.Hit300:
|
case OsuScoreResult.Hit300:
|
||||||
@ -78,7 +103,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OsuScoreResult.SliderTick:
|
case OsuScoreResult.SliderTick:
|
||||||
Health.Value += System.Math.Max(7 - hpDrainRate, 0) * 0.01;
|
Health.Value += Math.Max(7 - hpDrainRate, 0) * 0.01;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OsuScoreResult.Miss:
|
case OsuScoreResult.Miss:
|
||||||
@ -87,17 +112,51 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int score = 0;
|
calculateScore();
|
||||||
int maxScore = 0;
|
}
|
||||||
|
|
||||||
|
private void calculateScore()
|
||||||
|
{
|
||||||
|
int baseScore = 0;
|
||||||
|
double comboScore = 0;
|
||||||
|
|
||||||
|
int baseMaxScore = 0;
|
||||||
|
|
||||||
foreach (var j in Judgements)
|
foreach (var j in Judgements)
|
||||||
{
|
{
|
||||||
score += j.ScoreValue;
|
baseScore += j.ScoreValue;
|
||||||
maxScore += j.MaxScoreValue;
|
baseMaxScore += j.MaxScoreValue;
|
||||||
|
|
||||||
|
comboScore += j.ScoreValue * (1 + Combo.Value / 10d);
|
||||||
}
|
}
|
||||||
|
|
||||||
TotalScore.Value = score;
|
Accuracy.Value = (double)baseScore / baseMaxScore;
|
||||||
Accuracy.Value = (double)score / maxScore;
|
|
||||||
|
if (comboScore > comboMaxScore)
|
||||||
|
comboMaxScore = comboScore;
|
||||||
|
|
||||||
|
if (baseScore == 0)
|
||||||
|
TotalScore.Value = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// temporary to make scoring feel more like score v1 without being score v1.
|
||||||
|
float exponentialFactor = Mode.Value == ScoringMode.Exponential ? (float)Judgements.Count / 100 : 1;
|
||||||
|
|
||||||
|
TotalScore.Value =
|
||||||
|
(int)
|
||||||
|
(
|
||||||
|
exponentialFactor *
|
||||||
|
700000 * comboScore / comboMaxScore +
|
||||||
|
300000 * Math.Pow(Accuracy.Value, 10) * ((double)Judgements.Count / totalAccurateJudgements) +
|
||||||
|
0 /* bonusScore */
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ScoringMode
|
||||||
|
{
|
||||||
|
Standardised,
|
||||||
|
Exponential
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -268,6 +268,7 @@ namespace osu.Game.Rulesets.Taiko.Scoring
|
|||||||
base.Reset();
|
base.Reset();
|
||||||
|
|
||||||
Health.Value = 0;
|
Health.Value = 0;
|
||||||
|
Accuracy.Value = 1;
|
||||||
|
|
||||||
bonusScore = 0;
|
bonusScore = 0;
|
||||||
comboPortion = 0;
|
comboPortion = 0;
|
||||||
|
@ -33,7 +33,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
Normal,
|
Normal,
|
||||||
Hard,
|
Hard,
|
||||||
Insane,
|
Insane,
|
||||||
Expert
|
Expert,
|
||||||
|
ExpertPlus
|
||||||
}
|
}
|
||||||
|
|
||||||
private DifficultyRating getDifficultyRating(BeatmapInfo beatmap)
|
private DifficultyRating getDifficultyRating(BeatmapInfo beatmap)
|
||||||
@ -44,7 +45,8 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
if (rating < 2.25) return DifficultyRating.Normal;
|
if (rating < 2.25) return DifficultyRating.Normal;
|
||||||
if (rating < 3.75) return DifficultyRating.Hard;
|
if (rating < 3.75) return DifficultyRating.Hard;
|
||||||
if (rating < 5.25) return DifficultyRating.Insane;
|
if (rating < 5.25) return DifficultyRating.Insane;
|
||||||
return DifficultyRating.Expert;
|
if (rating < 6.75) return DifficultyRating.Expert;
|
||||||
|
return DifficultyRating.ExpertPlus;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4 getColour(BeatmapInfo beatmap)
|
private Color4 getColour(BeatmapInfo beatmap)
|
||||||
@ -55,12 +57,14 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
return palette.Green;
|
return palette.Green;
|
||||||
default:
|
default:
|
||||||
case DifficultyRating.Normal:
|
case DifficultyRating.Normal:
|
||||||
return palette.Yellow;
|
return palette.Blue;
|
||||||
case DifficultyRating.Hard:
|
case DifficultyRating.Hard:
|
||||||
return palette.Pink;
|
return palette.Yellow;
|
||||||
case DifficultyRating.Insane:
|
case DifficultyRating.Insane:
|
||||||
return palette.Purple;
|
return palette.Pink;
|
||||||
case DifficultyRating.Expert:
|
case DifficultyRating.Expert:
|
||||||
|
return palette.Purple;
|
||||||
|
case DifficultyRating.ExpertPlus:
|
||||||
return palette.Gray0;
|
return palette.Gray0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user