Skip to content

Commit

Permalink
Fix hitobject count when creating from an IBeatmap
Browse files Browse the repository at this point in the history
  • Loading branch information
smoogipoo committed Dec 13, 2023
1 parent c31ff84 commit 8c760e5
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets.Objects.Types;

namespace osu.Game.Rulesets.Scoring.Legacy
{
Expand Down Expand Up @@ -44,7 +46,14 @@ public class LegacyBeatmapConversionDifficultyInfo : IBeatmapDifficultyInfo

public static LegacyBeatmapConversionDifficultyInfo FromAPIBeatmap(APIBeatmap apiBeatmap) => FromBeatmapInfo(apiBeatmap);

public static LegacyBeatmapConversionDifficultyInfo FromBeatmap(IBeatmap beatmap) => FromBeatmapInfo(beatmap.BeatmapInfo);
public static LegacyBeatmapConversionDifficultyInfo FromBeatmap(IBeatmap beatmap) => new LegacyBeatmapConversionDifficultyInfo
{
SourceRuleset = beatmap.BeatmapInfo.Ruleset,
CircleSize = beatmap.Difficulty.CircleSize,
OverallDifficulty = beatmap.Difficulty.OverallDifficulty,
CircleCount = beatmap.HitObjects.Count - beatmap.HitObjects.Count(h => h is IHasDuration),
TotalObjectCount = beatmap.HitObjects.Count
};

public static LegacyBeatmapConversionDifficultyInfo FromBeatmapInfo(IBeatmapInfo beatmapInfo) => new LegacyBeatmapConversionDifficultyInfo
{
Expand Down

0 comments on commit 8c760e5

Please sign in to comment.