diff --git a/PerformanceCalculator/Simulate/CatchSimulateCommand.cs b/PerformanceCalculator/Simulate/CatchSimulateCommand.cs index b18958f..932ed3b 100644 --- a/PerformanceCalculator/Simulate/CatchSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/CatchSimulateCommand.cs @@ -17,29 +17,14 @@ namespace PerformanceCalculator.Simulate [Command(Name = "catch", Description = "Computes the performance (pp) of a simulated osu!catch play.")] public class CatchSimulateCommand : SimulateCommand { - [UsedImplicitly] - [Option(Template = "-a|--accuracy ", Description = "Accuracy. Enter as decimal 0-100. Defaults to 100." - + " Scales hit results as well and is rounded to the nearest possible value for the beatmap.")] - public override double Accuracy { get; } = 100; - [UsedImplicitly] [Option(Template = "-c|--combo ", Description = "Maximum combo during play. Defaults to beatmap maximum.")] public override int? Combo { get; } [UsedImplicitly] - [Option(Template = "-C|--percent-combo ", Description = "Percentage of beatmap maximum combo achieved. Alternative to combo option." - + " Enter as decimal 0-100.")] + [Option(Template = "-C|--percent-combo ", Description = "Percentage of beatmap maximum combo achieved. Alternative to combo option. Enter as decimal 0-100.")] public override double PercentCombo { get; } = 100; - [UsedImplicitly] - [Option(CommandOptionType.MultipleValue, Template = "-m|--mod ", Description = "One for each mod. The mods to compute the performance with." - + " Values: hr, dt, hd, fl, ez, etc...")] - public override string[] Mods { get; } - - [UsedImplicitly] - [Option(Template = "-X|--misses ", Description = "Number of misses. Defaults to 0.")] - public override int Misses { get; } - [UsedImplicitly] [Option(Template = "-T|--tiny-droplets ", Description = "Number of tiny droplets hit. Will override accuracy if used. Otherwise is automatically calculated.")] public override int? Mehs { get; } diff --git a/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs b/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs index d02feba..b6d66af 100644 --- a/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/ManiaSimulateCommand.cs @@ -17,35 +17,21 @@ namespace PerformanceCalculator.Simulate [Command(Name = "mania", Description = "Computes the performance (pp) of a simulated osu!mania play.")] public class ManiaSimulateCommand : SimulateCommand { - [UsedImplicitly] - [Option(Template = "-a|--accuracy ", Description = "Accuracy. Enter as decimal 0-100. Defaults to 100." - + " Scales hit results as well and is rounded to the nearest possible value for the beatmap.")] - public override double Accuracy { get; } = 100; - - [UsedImplicitly] - [Option(Template = "-X|--misses ", Description = "Number of misses. Defaults to 0.")] - public override int Misses { get; } - [UsedImplicitly] [Option(Template = "-M|--mehs ", Description = "Number of mehs. Will override accuracy if used. Otherwise is automatically calculated.")] public override int? Mehs { get; } - [UsedImplicitly] - [Option(Template = "-O|--oks ", Description = "Number of oks. Will override accuracy if used. Otherwise is automatically calculated.")] - private int? oks { get; set; } - [UsedImplicitly] [Option(Template = "-G|--goods ", Description = "Number of goods. Will override accuracy if used. Otherwise is automatically calculated.")] public override int? Goods { get; } [UsedImplicitly] - [Option(Template = "-T|--greats ", Description = "Number of greats. Will override accuracy if used. Otherwise is automatically calculated.")] - private int? greats { get; set; } + [Option(Template = "-O|--oks ", Description = "Number of oks. Will override accuracy if used. Otherwise is automatically calculated.")] + private int? oks { get; } [UsedImplicitly] - [Option(CommandOptionType.MultipleValue, Template = "-m|--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; } + [Option(Template = "-T|--greats ", Description = "Number of greats. Will override accuracy if used. Otherwise is automatically calculated.")] + private int? greats { get; } public override Ruleset Ruleset => new ManiaRuleset(); @@ -82,10 +68,10 @@ namespace PerformanceCalculator.Simulate // Each great and perfect increases total by 5 (great-meh=5) // There is no difference in accuracy between them, so just halve arbitrarily (favouring perfects for an odd number). int greatsAndPerfects = Math.Min(delta / 5, remainingHits); - greats = greatsAndPerfects / 2; - int perfects = greatsAndPerfects - greats.Value; - delta -= (greats.Value + perfects) * 5; - remainingHits -= greats.Value + perfects; + int countGreat = greatsAndPerfects / 2; + int perfects = greatsAndPerfects - countGreat; + delta -= (countGreat + perfects) * 5; + remainingHits -= countGreat + perfects; // Each good increases total by 3 (good-meh=3). countGood = Math.Min(delta / 3, remainingHits); @@ -93,8 +79,8 @@ namespace PerformanceCalculator.Simulate remainingHits -= countGood.Value; // Each ok increases total by 1 (ok-meh=1). - oks = delta; - remainingHits -= oks.Value; + int countOk = delta; + remainingHits -= countOk; // Everything else is a meh, as initially assumed. countMeh = remainingHits; @@ -102,8 +88,8 @@ namespace PerformanceCalculator.Simulate return new Dictionary { { HitResult.Perfect, perfects }, - { HitResult.Great, greats.Value }, - { HitResult.Ok, oks.Value }, + { HitResult.Great, countGreat }, + { HitResult.Ok, countOk }, { HitResult.Good, countGood.Value }, { HitResult.Meh, countMeh.Value }, { HitResult.Miss, countMiss } diff --git a/PerformanceCalculator/Simulate/OsuSimulateCommand.cs b/PerformanceCalculator/Simulate/OsuSimulateCommand.cs index 2f89545..e42511b 100644 --- a/PerformanceCalculator/Simulate/OsuSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/OsuSimulateCommand.cs @@ -15,29 +15,6 @@ namespace PerformanceCalculator.Simulate [Command(Name = "osu", Description = "Computes the performance (pp) of a simulated osu! play.")] public class OsuSimulateCommand : SimulateCommand { - [UsedImplicitly] - [Option(Template = "-a|--accuracy ", Description = "Accuracy. Enter as decimal 0-100. Defaults to 100." - + " Scales hit results as well and is rounded to the nearest possible value for the beatmap.")] - public override double Accuracy { get; } = 100; - - [UsedImplicitly] - [Option(Template = "-c|--combo ", Description = "Maximum combo during play. Defaults to beatmap maximum.")] - public override int? Combo { get; } - - [UsedImplicitly] - [Option(Template = "-C|--percent-combo ", Description = "Percentage of beatmap maximum combo achieved. Alternative to combo option." - + " Enter as decimal 0-100.")] - public override double PercentCombo { get; } = 100; - - [UsedImplicitly] - [Option(CommandOptionType.MultipleValue, Template = "-m|--mod ", Description = "One for each mod. The mods to compute the performance with." - + " Values: hr, dt, hd, fl, ez, etc...")] - public override string[] Mods { get; } - - [UsedImplicitly] - [Option(Template = "-X|--misses ", Description = "Number of misses. Defaults to 0.")] - public override int Misses { get; } - [UsedImplicitly] [Option(Template = "-M|--mehs ", Description = "Number of mehs. Will override accuracy if used. Otherwise is automatically calculated.")] public override int? Mehs { get; } @@ -46,6 +23,14 @@ namespace PerformanceCalculator.Simulate [Option(Template = "-G|--goods ", Description = "Number of goods. Will override accuracy if used. Otherwise is automatically calculated.")] public override int? Goods { get; } + [UsedImplicitly] + [Option(Template = "-c|--combo ", Description = "Maximum combo during play. Defaults to beatmap maximum.")] + public override int? Combo { get; } + + [UsedImplicitly] + [Option(Template = "-C|--percent-combo ", Description = "Percentage of beatmap maximum combo achieved. Alternative to combo option. Enter as decimal 0-100.")] + public override double PercentCombo { get; } = 100; + public override Ruleset Ruleset => new OsuRuleset(); protected override int GetMaxCombo(IBeatmap beatmap) => beatmap.GetMaxCombo(); diff --git a/PerformanceCalculator/Simulate/SimulateCommand.cs b/PerformanceCalculator/Simulate/SimulateCommand.cs index 1c79f93..ae55534 100644 --- a/PerformanceCalculator/Simulate/SimulateCommand.cs +++ b/PerformanceCalculator/Simulate/SimulateCommand.cs @@ -25,7 +25,28 @@ namespace PerformanceCalculator.Simulate public string Beatmap { get; } [UsedImplicitly] - public virtual double Accuracy { get; } + [Option(Template = "-a|--accuracy ", Description = "Accuracy. Enter as decimal 0-100. Defaults to 100. Scales hit results as well and is rounded to the nearest possible value for the beatmap.")] + public double Accuracy { get; } = 100; + + [UsedImplicitly] + [Option(CommandOptionType.MultipleValue, Template = "-m|--mod ", Description = "One for each mod. The mods to compute the performance with. Values: hr, dt, hd, fl, etc...")] + public string[] Mods { get; } + + [UsedImplicitly] + [Option(Template = "-X|--misses ", Description = "Number of misses. Defaults to 0.")] + public int Misses { get; } + + // + // Options implemented in the ruleset-specific commands + // -> Catch renames Mehs/Goods to (tiny-)droplets + // -> Mania does not have Combo + // -> Taiko does not have Mehs + // + [UsedImplicitly] + public virtual int? Mehs { get; } + + [UsedImplicitly] + public virtual int? Goods { get; } [UsedImplicitly] public virtual int? Combo { get; } @@ -33,21 +54,6 @@ namespace PerformanceCalculator.Simulate [UsedImplicitly] public virtual double PercentCombo { get; } - [UsedImplicitly] - public virtual int Score { get; } - - [UsedImplicitly] - public virtual string[] Mods { get; } - - [UsedImplicitly] - public virtual int Misses { get; } - - [UsedImplicitly] - public virtual int? Mehs { get; } - - [UsedImplicitly] - public virtual int? Goods { get; } - public override void Execute() { var ruleset = Ruleset; @@ -63,8 +69,7 @@ namespace PerformanceCalculator.Simulate Accuracy = GetAccuracy(statistics), MaxCombo = Combo ?? (int)Math.Round(PercentCombo / 100 * beatmapMaxCombo), Statistics = statistics, - Mods = mods, - TotalScore = Score, + Mods = mods }; var difficultyCalculator = ruleset.CreateDifficultyCalculator(workingBeatmap); diff --git a/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs b/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs index 9a0c3a0..9559e1c 100644 --- a/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs +++ b/PerformanceCalculator/Simulate/TaikoSimulateCommand.cs @@ -18,32 +18,17 @@ namespace PerformanceCalculator.Simulate public class TaikoSimulateCommand : SimulateCommand { [UsedImplicitly] - [Option(Template = "-a|--accuracy ", Description = "Accuracy. Enter as decimal 0-100. Defaults to 100." - + " Scales hit results as well and is rounded to the nearest possible value for the beatmap.")] - public override double Accuracy { get; } = 100; + [Option(Template = "-G|--goods ", Description = "Number of goods. Will override accuracy if used. Otherwise is automatically calculated.")] + public override int? Goods { get; } [UsedImplicitly] [Option(Template = "-c|--combo ", Description = "Maximum combo during play. Defaults to beatmap maximum.")] public override int? Combo { get; } [UsedImplicitly] - [Option(Template = "-C|--percent-combo ", Description = "Percentage of beatmap maximum combo achieved. Alternative to combo option." - + " Enter as decimal 0-100.")] + [Option(Template = "-C|--percent-combo ", Description = "Percentage of beatmap maximum combo achieved. Alternative to combo option. Enter as decimal 0-100.")] public override double PercentCombo { get; } = 100; - [UsedImplicitly] - [Option(CommandOptionType.MultipleValue, Template = "-m|--mod ", Description = "One for each mod. The mods to compute the performance with." - + " Values: hr, dt, hd, fl, ez, etc...")] - public override string[] Mods { get; } - - [UsedImplicitly] - [Option(Template = "-X|--misses ", Description = "Number of misses. Defaults to 0.")] - public override int Misses { get; } - - [UsedImplicitly] - [Option(Template = "-G|--goods ", Description = "Number of goods. Will override accuracy if used. Otherwise is automatically calculated.")] - public override int? Goods { get; } - public override Ruleset Ruleset => new TaikoRuleset(); protected override int GetMaxCombo(IBeatmap beatmap) => beatmap.HitObjects.OfType().Count();