mirror of
https://github.com/ppy/osu-tools.git
synced 2025-06-07 23:07:01 +09:00
59 lines
2.4 KiB
C#
59 lines
2.4 KiB
C#
// 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.
|
|
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Globalization;
|
|
using JetBrains.Annotations;
|
|
using McMaster.Extensions.CommandLineUtils;
|
|
using osu.Game.Beatmaps;
|
|
using osu.Game.Rulesets;
|
|
using osu.Game.Rulesets.Mania;
|
|
using osu.Game.Rulesets.Scoring;
|
|
using osu.Game.Scoring;
|
|
|
|
namespace PerformanceCalculator.Simulate
|
|
{
|
|
[Command(Name = "simulate mania", Description = "Computes the performance (pp) of a simulated osu!mania play.")]
|
|
public class ManiaSimulateCommand : SimulateCommand
|
|
{
|
|
[UsedImplicitly]
|
|
[Required, FileExists]
|
|
[Argument(0, Name = "beatmap", Description = "Required. The beatmap file (.osu).")]
|
|
public override string Beatmap { get; }
|
|
|
|
[UsedImplicitly]
|
|
[Option(Template = "-s|--score <score>", Description = "Score. An integer 0-1000000.")]
|
|
public override int Score { get; } = 1000000;
|
|
|
|
[UsedImplicitly]
|
|
[Option(CommandOptionType.MultipleValue, Template = "-m|--mod <mod>", Description = "One for each mod. The mods to compute the performance with."
|
|
+ " Values: hr, dt, fl, 4k, 5k, etc...")]
|
|
public override string[] Mods { get; }
|
|
|
|
public override Ruleset Ruleset => new ManiaRuleset();
|
|
|
|
protected override int GetMaxCombo(IBeatmap beatmap) => 0;
|
|
|
|
protected override Dictionary<HitResult, int> GenerateHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood)
|
|
{
|
|
var totalHits = beatmap.HitObjects.Count;
|
|
|
|
// Only total number of hits is considered currently, so specifics don't matter
|
|
return new Dictionary<HitResult, int>
|
|
{
|
|
{ HitResult.Perfect, totalHits },
|
|
{ HitResult.Great, 0 },
|
|
{ HitResult.Ok, 0 },
|
|
{ HitResult.Good, 0 },
|
|
{ HitResult.Meh, 0 },
|
|
{ HitResult.Miss, 0 }
|
|
};
|
|
}
|
|
|
|
protected override void WritePlayInfo(ScoreInfo scoreInfo, IBeatmap beatmap)
|
|
{
|
|
WriteAttribute("Score", scoreInfo.TotalScore.ToString(CultureInfo.InvariantCulture));
|
|
}
|
|
}
|
|
}
|