Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Collections.Generic;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Difficulty;

namespace osu.Game.Rulesets.Sentakki.Difficulty
{
public class SentakkiDifficultyAttributes : DifficultyAttributes
{
public override IEnumerable<(int attributeId, object value)> ToDatabaseAttributes()
{
foreach (var attribute in base.ToDatabaseAttributes())
yield return attribute;

yield return (ATTRIB_ID_DIFFICULTY, StarRating);
}

public override void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values, IBeatmapOnlineInfo onlineInfo)
{
base.FromDatabaseAttributes(values, onlineInfo);

StarRating = values[ATTRIB_ID_DIFFICULTY];
}
}
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
using System;
using System.Collections.Generic;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Difficulty.Skills;
using osu.Game.Rulesets.Mods;

namespace osu.Game.Rulesets.Sentakki.Difficulty;

public class SentakkiDifficultyCalculator : DifficultyCalculator
namespace osu.Game.Rulesets.Sentakki.Difficulty
{
public SentakkiDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)
public class SentakkiDifficultyCalculator : DifficultyCalculator
{
}

protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
{
int maxCombo = beatmap.GetMaxCombo();
public SentakkiDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
}

return new DifficultyAttributes
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
{
StarRating = beatmap.BeatmapInfo.StarRating * 1.25f, // Inflate SR of converts, to encourage players to try lower diffs, without hurting their fragile ego.
Mods = mods,
MaxCombo = maxCombo
};
}
int maxCombo = beatmap.GetMaxCombo();

double baseSR = beatmap.BeatmapInfo.StarRating * clockRate;

protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) => [];
return new SentakkiDifficultyAttributes
{
StarRating = baseSR * 1.25f, // Inflate SR of converts, to encourage players to try lower diffs, without hurting their fragile ego.
Mods = mods,
MaxCombo = maxCombo
};
}

protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => [];
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) => Array.Empty<DifficultyHitObject>();

protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => Array.Empty<Skill>();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using osu.Game.Rulesets.Difficulty;

namespace osu.Game.Rulesets.Sentakki.Difficulty
{
public class SentakkiPerformanceAttributes : PerformanceAttributes
{
[JsonProperty("base_pp")]
public double Base_PP { get; set; }

[JsonProperty("length_bonus")]
public double Length_Bonus { get; set; }

public override IEnumerable<PerformanceDisplayAttribute> GetAttributesForDisplay()
{
foreach (var attribute in base.GetAttributesForDisplay())
{
yield return attribute;
}

yield return new PerformanceDisplayAttribute(nameof(Base_PP), "Base PP", Base_PP);
yield return new PerformanceDisplayAttribute(nameof(Length_Bonus), "Length Bonus", Length_Bonus);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;


namespace osu.Game.Rulesets.Sentakki.Difficulty
{
public class SentakkiPerformanceCalculator : PerformanceCalculator
{
public SentakkiPerformanceCalculator()
: base(new SentakkiRuleset()) { }

protected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo score, DifficultyAttributes attributes)
{
var sentakkiAttributes = (SentakkiDifficultyAttributes)attributes;
double accuracy = score.Accuracy;
int countMiss = score.Statistics.GetValueOrDefault(HitResult.Miss);

double baseValue = Math.Pow((5.0f * Math.Max(1.0f, sentakkiAttributes.StarRating / 0.0049f)) - 4.0f, 2.0f) / 100000.0f;
double value = baseValue;
double lengthBonus = 0.95 + ((0.3 * Math.Min(1.0, sentakkiAttributes.MaxCombo / 2500.0)) + (sentakkiAttributes.MaxCombo > 2500 ? Math.Log10(sentakkiAttributes.MaxCombo / 2500.0f) * 0.475f : 0.0f));
value *= lengthBonus;
value *= Math.Pow(0.97, countMiss);
if (sentakkiAttributes.MaxCombo > 0)
value *= Math.Min(Math.Pow(score.MaxCombo, 0.35f) / Math.Pow(sentakkiAttributes.MaxCombo, 0.35f), 1.0f);
value *= Math.Pow(accuracy, 5.5);
//Until difficulty calculation is implemented,
//multiply combo progress instead of strain.
//(I think it is strange that the first combo gets 600pp.)
double comboProgress = (double)sentakkiAttributes.MaxCombo / score.GetMaximumAchievableCombo();
double totalValue = value * comboProgress;

return new SentakkiPerformanceAttributes
{
Base_PP = baseValue,
Length_Bonus = lengthBonus,
Total = totalValue
};
}
}
}
15 changes: 0 additions & 15 deletions osu.Game.Rulesets.Sentakki/SentakkiPerformanceCalculator.cs

This file was deleted.

Loading