1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 04:37:51 +08:00
osu-lazer/osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs

66 lines
2.6 KiB
C#
Raw Normal View History

// 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.
2018-04-13 17:19:50 +08:00
2021-06-11 15:07:38 +08:00
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
2018-04-13 17:19:50 +08:00
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
2021-05-15 11:51:39 +08:00
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
2021-06-11 15:07:38 +08:00
using osu.Game.Rulesets.Taiko.Objects.Drawables;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Rulesets.Taiko.Mods
{
2021-08-02 19:38:46 +08:00
public class TaikoModHidden : ModHidden
2018-04-13 17:19:50 +08:00
{
public override string Description => @"Beats fade out before you hit them!";
public override double ScoreMultiplier => 1.06;
2021-06-11 15:07:38 +08:00
private ControlPointInfo controlPointInfo;
2021-05-15 11:51:39 +08:00
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
{
2021-06-11 15:07:38 +08:00
ApplyNormalVisibilityState(hitObject, state);
}
protected double MultiplierAt(double position)
{
double beatLength = controlPointInfo.TimingPointAt(position).BeatLength;
double speedMultiplier = controlPointInfo.DifficultyPointAt(position).SpeedMultiplier;
2021-08-02 19:18:01 +08:00
return speedMultiplier * TimingControlPoint.DEFAULT_BEAT_LENGTH / beatLength;
2021-05-15 11:51:39 +08:00
}
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
{
2021-06-11 15:07:38 +08:00
switch (hitObject)
{
case DrawableDrumRollTick _:
case DrawableHit _:
2021-06-16 15:32:59 +08:00
double preempt = 10000 / MultiplierAt(hitObject.HitObject.StartTime);
double start = hitObject.HitObject.StartTime - preempt * 0.6;
double duration = preempt * 0.3;
2021-06-11 15:07:38 +08:00
2021-06-16 15:32:59 +08:00
using (hitObject.BeginAbsoluteSequence(start))
{
hitObject.FadeOut(duration);
2021-06-11 15:07:38 +08:00
2021-06-16 15:32:59 +08:00
// DrawableHitObject sets LifetimeEnd to LatestTransformEndTime if it isn't manually changed.
// in order for the object to not be killed before its actual end time (as the latest transform ends earlier), set lifetime end explicitly.
hitObject.LifetimeEnd = state == ArmedState.Idle || !hitObject.AllJudged
? hitObject.HitObject.GetEndTime() + hitObject.HitObject.HitWindows.WindowFor(HitResult.Miss)
: hitObject.HitStateUpdateTime;
}
2021-06-11 15:07:38 +08:00
2021-06-16 15:32:59 +08:00
break;
2021-06-11 15:07:38 +08:00
}
}
public override void ApplyToBeatmap(IBeatmap beatmap)
{
controlPointInfo = beatmap.ControlPointInfo;
2021-05-15 11:51:39 +08:00
}
2018-04-13 17:19:50 +08:00
}
}