2019-01-24 16:43:03 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-05-17 16:40:46 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Game.Rulesets.Difficulty;
|
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2018-11-12 01:38:12 +08:00
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
2018-11-28 15:12:57 +08:00
|
|
|
|
using osu.Game.Scoring;
|
2018-05-17 16:40:46 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Difficulty
|
|
|
|
|
{
|
|
|
|
|
public class TaikoPerformanceCalculator : PerformanceCalculator
|
|
|
|
|
{
|
2018-06-14 15:26:51 +08:00
|
|
|
|
protected new TaikoDifficultyAttributes Attributes => (TaikoDifficultyAttributes)base.Attributes;
|
2018-05-17 16:40:46 +08:00
|
|
|
|
|
|
|
|
|
private Mod[] mods;
|
|
|
|
|
private int countGreat;
|
2020-09-29 16:16:55 +08:00
|
|
|
|
private int countOk;
|
2018-05-17 16:40:46 +08:00
|
|
|
|
private int countMeh;
|
|
|
|
|
private int countMiss;
|
|
|
|
|
|
2020-10-03 01:24:30 +08:00
|
|
|
|
public TaikoPerformanceCalculator(Ruleset ruleset, DifficultyAttributes attributes, ScoreInfo score)
|
|
|
|
|
: base(ruleset, attributes, score)
|
2018-05-17 16:40:46 +08:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-21 18:08:31 +08:00
|
|
|
|
public override PerformanceAttributes Calculate()
|
2018-05-17 16:40:46 +08:00
|
|
|
|
{
|
2018-11-30 14:18:52 +08:00
|
|
|
|
mods = Score.Mods;
|
2021-07-19 03:52:16 +08:00
|
|
|
|
countGreat = Score.Statistics.GetValueOrDefault(HitResult.Great);
|
|
|
|
|
countOk = Score.Statistics.GetValueOrDefault(HitResult.Ok);
|
|
|
|
|
countMeh = Score.Statistics.GetValueOrDefault(HitResult.Meh);
|
|
|
|
|
countMiss = Score.Statistics.GetValueOrDefault(HitResult.Miss);
|
2018-05-17 16:40:46 +08:00
|
|
|
|
|
|
|
|
|
double multiplier = 1.1; // This is being adjusted to keep the final pp value scaled around what it used to be when changing things
|
|
|
|
|
|
|
|
|
|
if (mods.Any(m => m is ModNoFail))
|
|
|
|
|
multiplier *= 0.90;
|
|
|
|
|
|
|
|
|
|
if (mods.Any(m => m is ModHidden))
|
|
|
|
|
multiplier *= 1.10;
|
|
|
|
|
|
2021-12-18 04:39:03 +08:00
|
|
|
|
double difficultyValue = computeDifficultyValue();
|
2018-05-17 16:40:46 +08:00
|
|
|
|
double accuracyValue = computeAccuracyValue();
|
|
|
|
|
double totalValue =
|
|
|
|
|
Math.Pow(
|
2021-12-18 04:39:03 +08:00
|
|
|
|
Math.Pow(difficultyValue, 1.1) +
|
2018-05-17 16:40:46 +08:00
|
|
|
|
Math.Pow(accuracyValue, 1.1), 1.0 / 1.1
|
|
|
|
|
) * multiplier;
|
|
|
|
|
|
2021-12-21 18:08:31 +08:00
|
|
|
|
return new TaikoPerformanceAttributes
|
2018-05-17 16:40:46 +08:00
|
|
|
|
{
|
2021-12-21 18:08:31 +08:00
|
|
|
|
Difficulty = difficultyValue,
|
|
|
|
|
Accuracy = accuracyValue,
|
|
|
|
|
Total = totalValue
|
|
|
|
|
};
|
2018-05-17 16:40:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-18 04:39:03 +08:00
|
|
|
|
private double computeDifficultyValue()
|
2018-05-17 16:40:46 +08:00
|
|
|
|
{
|
2021-12-18 04:39:03 +08:00
|
|
|
|
double difficultyValue = Math.Pow(5.0 * Math.Max(1.0, Attributes.StarRating / 0.0075) - 4.0, 2.0) / 100000.0;
|
2018-05-17 16:40:46 +08:00
|
|
|
|
|
2020-07-29 19:53:14 +08:00
|
|
|
|
double lengthBonus = 1 + 0.1 * Math.Min(1.0, totalHits / 1500.0);
|
2021-12-18 04:39:03 +08:00
|
|
|
|
difficultyValue *= lengthBonus;
|
2018-05-17 16:40:46 +08:00
|
|
|
|
|
2021-12-18 04:39:03 +08:00
|
|
|
|
difficultyValue *= Math.Pow(0.985, countMiss);
|
2018-05-17 16:40:46 +08:00
|
|
|
|
|
|
|
|
|
if (mods.Any(m => m is ModHidden))
|
2021-12-18 04:39:03 +08:00
|
|
|
|
difficultyValue *= 1.025;
|
2018-05-17 16:40:46 +08:00
|
|
|
|
|
2018-11-12 01:38:12 +08:00
|
|
|
|
if (mods.Any(m => m is ModFlashlight<TaikoHitObject>))
|
2021-12-18 04:39:03 +08:00
|
|
|
|
difficultyValue *= 1.05 * lengthBonus;
|
2018-05-17 16:40:46 +08:00
|
|
|
|
|
2021-12-18 04:39:03 +08:00
|
|
|
|
return difficultyValue * Score.Accuracy;
|
2018-05-17 16:40:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private double computeAccuracyValue()
|
|
|
|
|
{
|
2018-06-14 15:26:51 +08:00
|
|
|
|
if (Attributes.GreatHitWindow <= 0)
|
2018-05-17 16:40:46 +08:00
|
|
|
|
return 0;
|
|
|
|
|
|
2018-11-30 14:18:52 +08:00
|
|
|
|
double accValue = Math.Pow(150.0 / Attributes.GreatHitWindow, 1.1) * Math.Pow(Score.Accuracy, 15) * 22.0;
|
2018-05-17 16:40:46 +08:00
|
|
|
|
|
2021-12-21 19:03:24 +08:00
|
|
|
|
// Bonus for many objects - it's harder to keep good accuracy up for longer
|
2018-05-17 16:40:46 +08:00
|
|
|
|
return accValue * Math.Min(1.15, Math.Pow(totalHits / 1500.0, 0.3));
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-29 16:16:55 +08:00
|
|
|
|
private int totalHits => countGreat + countOk + countMeh + countMiss;
|
2018-05-17 16:40:46 +08:00
|
|
|
|
}
|
|
|
|
|
}
|