Skip to content

Commit

Permalink
Switch to IRulesetInfo and IBeatmap
Browse files Browse the repository at this point in the history
  • Loading branch information
goodtrailer committed Nov 24, 2021
1 parent 17a1dfe commit b88a653
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Logging;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Difficulty.Preprocessing;
Expand All @@ -19,18 +20,24 @@ public class SoyokazeDifficultyCalculator : DifficultyCalculator
{
private const double difficulty_multiplier = 0.445;

public SoyokazeDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
public SoyokazeDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
}

protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
{
if (beatmap.HitObjects.Count == 0)
return new DifficultyAttributes(mods, skills, 0);
return new DifficultyAttributes
{
Mods = mods,
};

Logger.Log("skills.Length: " + skills.Length);

double speedRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier;
double readRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier;

double starRating = speedRating + readRating + (speedRating - readRating) / 3;

int maxCombo = beatmap.HitObjects.Count;
Expand All @@ -40,7 +47,6 @@ protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beat
StarRating = starRating,
Mods = mods,
MaxCombo = maxCombo,
Skills = skills,
};
}

Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Soyokaze/SoyokazeRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) =>

public override RulesetSettingsSubsection CreateSettings() => new SoyokazeSettingsSubsection(this);

public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) =>
new SoyokazeDifficultyCalculator(this, beatmap);
public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) =>
new SoyokazeDifficultyCalculator(RulesetInfo, beatmap);

public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) =>
new DrawableSoyokazeRuleset(this, beatmap, mods);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<EmbeddedResource Include="Resources\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game" Version="2021.1113.0" />
<PackageReference Include="ppy.osu.Game" Version="2021.1120.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\Samples\Gameplay" />
Expand Down

0 comments on commit b88a653

Please sign in to comment.