2019-02-18 13:46:32 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using osu.Game.Rulesets.Catch.Difficulty.Preprocessing;
|
|
|
|
using osu.Game.Rulesets.Catch.UI;
|
|
|
|
using osu.Game.Rulesets.Difficulty.Preprocessing;
|
|
|
|
using osu.Game.Rulesets.Difficulty.Skills;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Difficulty.Skills
|
|
|
|
{
|
|
|
|
public class Movement : Skill
|
|
|
|
{
|
|
|
|
private const float absolute_player_positioning_error = 16f;
|
|
|
|
private const float normalized_hitobject_radius = 41.0f;
|
|
|
|
private const double direction_change_bonus = 12.5;
|
|
|
|
|
|
|
|
protected override double SkillMultiplier => 850;
|
|
|
|
protected override double StrainDecayBase => 0.2;
|
|
|
|
|
|
|
|
protected override double DecayWeight => 0.94;
|
|
|
|
|
2019-02-20 13:13:54 +08:00
|
|
|
private float? lastPlayerPosition;
|
2019-02-16 10:11:31 +08:00
|
|
|
private float lastDistanceMoved;
|
|
|
|
|
2019-02-18 13:46:32 +08:00
|
|
|
protected override double StrainValueOf(DifficultyHitObject current)
|
|
|
|
{
|
|
|
|
var catchCurrent = (CatchDifficultyHitObject)current;
|
|
|
|
|
2019-02-20 13:13:54 +08:00
|
|
|
if (lastPlayerPosition == null)
|
|
|
|
lastPlayerPosition = catchCurrent.LastNormalizedPosition;
|
|
|
|
|
2019-11-20 20:19:49 +08:00
|
|
|
float playerPosition = Math.Clamp(
|
2019-02-20 13:13:54 +08:00
|
|
|
lastPlayerPosition.Value,
|
2019-02-16 10:11:31 +08:00
|
|
|
catchCurrent.NormalizedPosition - (normalized_hitobject_radius - absolute_player_positioning_error),
|
|
|
|
catchCurrent.NormalizedPosition + (normalized_hitobject_radius - absolute_player_positioning_error)
|
|
|
|
);
|
|
|
|
|
2019-02-20 13:13:54 +08:00
|
|
|
float distanceMoved = playerPosition - lastPlayerPosition.Value;
|
2019-02-18 13:46:32 +08:00
|
|
|
|
2019-02-16 10:11:31 +08:00
|
|
|
double distanceAddition = Math.Pow(Math.Abs(distanceMoved), 1.3) / 500;
|
|
|
|
double sqrtStrain = Math.Sqrt(catchCurrent.StrainTime);
|
2019-02-18 13:46:32 +08:00
|
|
|
|
|
|
|
double bonus = 0;
|
|
|
|
|
2019-02-16 10:11:31 +08:00
|
|
|
// Direction changes give an extra point!
|
|
|
|
if (Math.Abs(distanceMoved) > 0.1)
|
2019-02-18 13:46:32 +08:00
|
|
|
{
|
2019-02-16 10:11:31 +08:00
|
|
|
if (Math.Abs(lastDistanceMoved) > 0.1 && Math.Sign(distanceMoved) != Math.Sign(lastDistanceMoved))
|
2019-02-18 13:46:32 +08:00
|
|
|
{
|
2019-02-16 10:11:31 +08:00
|
|
|
double bonusFactor = Math.Min(absolute_player_positioning_error, Math.Abs(distanceMoved)) / absolute_player_positioning_error;
|
2019-02-18 13:46:32 +08:00
|
|
|
|
|
|
|
distanceAddition += direction_change_bonus / sqrtStrain * bonusFactor;
|
|
|
|
|
|
|
|
// Bonus for tougher direction switches and "almost" hyperdashes at this point
|
2019-02-16 10:11:31 +08:00
|
|
|
if (catchCurrent.LastObject.DistanceToHyperDash <= 10 / CatchPlayfield.BASE_WIDTH)
|
2019-02-18 13:46:32 +08:00
|
|
|
bonus = 0.3 * bonusFactor;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Base bonus for every movement, giving some weight to streams.
|
2019-02-16 10:11:31 +08:00
|
|
|
distanceAddition += 7.5 * Math.Min(Math.Abs(distanceMoved), normalized_hitobject_radius * 2) / (normalized_hitobject_radius * 6) / sqrtStrain;
|
2019-02-18 13:46:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Bonus for "almost" hyperdashes at corner points
|
2019-02-16 10:11:31 +08:00
|
|
|
if (catchCurrent.LastObject.DistanceToHyperDash <= 10.0f / CatchPlayfield.BASE_WIDTH)
|
2019-02-18 13:46:32 +08:00
|
|
|
{
|
2019-02-16 10:11:31 +08:00
|
|
|
if (!catchCurrent.LastObject.HyperDash)
|
2019-02-18 13:46:32 +08:00
|
|
|
bonus += 1.0;
|
2019-02-16 10:11:31 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// After a hyperdash we ARE in the correct position. Always!
|
|
|
|
playerPosition = catchCurrent.NormalizedPosition;
|
|
|
|
}
|
2019-02-18 13:46:32 +08:00
|
|
|
|
2019-02-16 10:11:31 +08:00
|
|
|
distanceAddition *= 1.0 + bonus * ((10 - catchCurrent.LastObject.DistanceToHyperDash * CatchPlayfield.BASE_WIDTH) / 10);
|
2019-02-18 13:46:32 +08:00
|
|
|
}
|
|
|
|
|
2019-02-16 10:11:31 +08:00
|
|
|
lastPlayerPosition = playerPosition;
|
|
|
|
lastDistanceMoved = distanceMoved;
|
|
|
|
|
2019-02-18 13:46:32 +08:00
|
|
|
return distanceAddition / catchCurrent.StrainTime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|