Skip to content

Commit

Permalink
Update score processor functions
Browse files Browse the repository at this point in the history
  • Loading branch information
goodtrailer committed Jan 4, 2024
1 parent b417b48 commit 5e6addf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
15 changes: 8 additions & 7 deletions osu.Game.Rulesets.Soyokaze/Objects/Drawables/DrawableHold.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Soyokaze.Judgements;
using osu.Game.Rulesets.Soyokaze.Scoring;
using osu.Game.Rulesets.Soyokaze.Skinning;
using osu.Game.Rulesets.Soyokaze.UI;
using osu.Game.Skinning;
Expand Down Expand Up @@ -140,7 +141,7 @@ protected override void UpdateInitialTransforms()
{
base.UpdateInitialTransforms();

HoldProgress.FadeInFromZero(System.Math.Min(HitObject.FadeIn * 2, HitObject.Preempt / 2));
HoldProgress.FadeInFromZero(Math.Min(HitObject.FadeIn * 2, HitObject.Preempt / 2));
using (BeginDelayedSequence(HitObject.Preempt))
{
HoldProgress.FillTo(1.0, HitObject.Duration);
Expand Down Expand Up @@ -188,18 +189,18 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)
double holdFraction = holdDuration / HitObject.Duration;
double holdCircleFraction = 0.0;

JudgementResult trueRes = HoldCircle.TrueResult;
if (trueRes != null)
JudgementResult trueResult = HoldCircle.TrueResult;
if (trueResult != null)
{
Judgement judgement = trueRes.Judgement;
holdCircleFraction = (double)judgement.NumericResultFor(trueRes)
/ judgement.MaxNumericResult;
SoyokazeScoreProcessor scorer = new SoyokazeScoreProcessor();
double score = scorer.GetBaseScoreForResult(trueResult.Type);
double max = scorer.GetBaseScoreForResult(trueResult.Judgement.MaxResult);
holdCircleFraction = score / max;
}

double scoreFraction = (holdCircleFraction + holdFraction) / 2;

HitResult result;

if (scoreFraction > 0.9)
result = HitResult.Perfect;
else if (scoreFraction > 0.8)
Expand Down
6 changes: 3 additions & 3 deletions osu.Game.Rulesets.Soyokaze/Scoring/SoyokazeScoreProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace osu.Game.Rulesets.Soyokaze.Scoring
{
public partial class SoyokazeScoreProcessor : ScoreProcessor
{
public SoyokazeScoreProcessor(Ruleset ruleset)
: base(ruleset)
public SoyokazeScoreProcessor(SoyokazeRuleset ruleset = null)
: base(ruleset ?? new SoyokazeRuleset())
{
}

Expand All @@ -19,7 +19,7 @@ protected override HitEvent CreateHitEvent(JudgementResult result)
var hitEvent = base.CreateHitEvent(result);

if (result is SoyokazeHoldJudgementResult hr)
hitEvent = new HitEvent(hr.TrueTimeOffset, hitEvent.Result, hitEvent.HitObject, hitEvent.LastHitObject, hitEvent.Position);
hitEvent = new HitEvent(hr.TrueTimeOffset, hitEvent.GameplayRate, hitEvent.Result, hitEvent.HitObject, hitEvent.LastHitObject, hitEvent.Position);

return hitEvent;
}
Expand Down
13 changes: 5 additions & 8 deletions osu.Game.Rulesets.Soyokaze/Statistics/AccuracyGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Soyokaze.Scoring;
using osu.Game.Screens.Ranking.Statistics;
using osuTK;

Expand Down Expand Up @@ -68,15 +68,12 @@ private float calculateAccuracy(List<HitEvent> hitEvents)
{
int maxScore = 0;
int score = 0;


SoyokazeScoreProcessor scorer = new SoyokazeScoreProcessor();
foreach (HitEvent hitEvent in hitEvents)
{
JudgementResult result = new JudgementResult(hitEvent.HitObject, hitEvent.HitObject.CreateJudgement())
{
Type = hitEvent.Result
};
score += result.Judgement.NumericResultFor(result);
maxScore += result.Judgement.MaxNumericResult;
score += scorer.GetBaseScoreForResult(hitEvent.Result);
maxScore += scorer.GetBaseScoreForResult(hitEvent.HitObject.CreateJudgement().MaxResult);
}

return (float)score / maxScore;
Expand Down

0 comments on commit 5e6addf

Please sign in to comment.