Merge pull request #15867 from MBmasher/fl-cumulative-strain

Fix cumulative strain time calculation in Flashlight skill
This commit is contained in:
Dan Balasescu 2021-12-21 17:19:09 +09:00 committed by GitHub
commit 05b79f864e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 6 deletions

View File

@ -40,26 +40,31 @@ private double strainValueOf(DifficultyHitObject current)
double result = 0.0; double result = 0.0;
OsuDifficultyHitObject lastObj = osuCurrent;
// This is iterating backwards in time from the current object.
for (int i = 0; i < Previous.Count; i++) for (int i = 0; i < Previous.Count; i++)
{ {
var osuPrevious = (OsuDifficultyHitObject)Previous[i]; var currentObj = (OsuDifficultyHitObject)Previous[i];
var osuPreviousHitObject = (OsuHitObject)(osuPrevious.BaseObject); var currentHitObject = (OsuHitObject)(currentObj.BaseObject);
if (!(osuPrevious.BaseObject is Spinner)) if (!(currentObj.BaseObject is Spinner))
{ {
double jumpDistance = (osuHitObject.StackedPosition - osuPreviousHitObject.EndPosition).Length; double jumpDistance = (osuHitObject.StackedPosition - currentHitObject.EndPosition).Length;
cumulativeStrainTime += osuPrevious.StrainTime; cumulativeStrainTime += lastObj.StrainTime;
// We want to nerf objects that can be easily seen within the Flashlight circle radius. // We want to nerf objects that can be easily seen within the Flashlight circle radius.
if (i == 0) if (i == 0)
smallDistNerf = Math.Min(1.0, jumpDistance / 75.0); smallDistNerf = Math.Min(1.0, jumpDistance / 75.0);
// We also want to nerf stacks so that only the first object of the stack is accounted for. // We also want to nerf stacks so that only the first object of the stack is accounted for.
double stackNerf = Math.Min(1.0, (osuPrevious.LazyJumpDistance / scalingFactor) / 25.0); double stackNerf = Math.Min(1.0, (currentObj.LazyJumpDistance / scalingFactor) / 25.0);
result += stackNerf * scalingFactor * jumpDistance / cumulativeStrainTime; result += stackNerf * scalingFactor * jumpDistance / cumulativeStrainTime;
} }
lastObj = currentObj;
} }
return Math.Pow(smallDistNerf * result, 2.0); return Math.Pow(smallDistNerf * result, 2.0);