1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 04:02:59 +08:00

Split ticks up into bonus and non-bonus

This commit is contained in:
Dean Herbert 2020-07-21 18:22:37 +09:00
parent d70384a571
commit 05102bc1ba
8 changed files with 63 additions and 53 deletions

View File

@ -1,18 +0,0 @@
// 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 osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Judgements
{
public class OsuSpinnerTickJudgement : OsuJudgement
{
internal bool HasBonusPoints;
public override bool AffectsCombo => false;
protected override int NumericResultFor(HitResult result) => 100 + (HasBonusPoints ? 1000 : 0);
protected override double HealthIncreaseFor(HitResult result) => 0;
}
}

View File

@ -157,6 +157,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
switch (hitObject)
{
case SpinnerBonusTick bonusTick:
return new DrawableSpinnerBonusTick(bonusTick);
case SpinnerTick tick:
return new DrawableSpinnerTick(tick);
}

View File

@ -0,0 +1,13 @@
// 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.
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
public class DrawableSpinnerBonusTick : DrawableSpinnerTick
{
public DrawableSpinnerBonusTick(SpinnerBonusTick spinnerTick)
: base(spinnerTick)
{
}
}
}

View File

@ -1,31 +1,12 @@
// 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 osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
public class DrawableSpinnerTick : DrawableOsuHitObject
{
private bool hasBonusPoints;
/// <summary>
/// Whether this judgement has a bonus of 1,000 points additional to the numeric result.
/// Set when a spin occured after the spinner has completed.
/// </summary>
public bool HasBonusPoints
{
get => hasBonusPoints;
internal set
{
hasBonusPoints = value;
((OsuSpinnerTickJudgement)Result.Judgement).HasBonusPoints = value;
Samples.Volume.Value = value ? 1 : 0;
}
}
public override bool DisplayResult => false;
public DrawableSpinnerTick(SpinnerTick spinnerTick)

View File

@ -55,12 +55,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
var tick = ticks[currentSpins];
if (direction >= 0)
{
tick.HasBonusPoints = currentSpins > spinsRequired;
tick.TriggerResult(true);
}
if (tick.HasBonusPoints)
if (tick is DrawableSpinnerBonusTick)
{
bonusCounter.Text = $"{1000 * (currentSpins - spinsRequired)}";
bonusCounter.FadeOutFromOne(1500);

View File

@ -3,13 +3,11 @@
using System;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Osu.Replays;
using osu.Game.Rulesets.Scoring;
using osuTK;
namespace osu.Game.Rulesets.Osu.Objects
{
@ -28,6 +26,8 @@ namespace osu.Game.Rulesets.Osu.Objects
/// </summary>
public int SpinsRequired { get; protected set; } = 1;
public int MaximumBonusSpins => SpinsRequired;
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
@ -42,9 +42,16 @@ namespace osu.Game.Rulesets.Osu.Objects
{
base.CreateNestedHitObjects();
var maximumSpins = OsuAutoGeneratorBase.SPIN_RADIUS * (Duration / 1000) / MathHelper.TwoPi;
for (int i = 0; i < maximumSpins; i++)
AddNested(new SpinnerTick());
int totalSpins = MaximumBonusSpins + SpinsRequired;
for (int i = 0; i < totalSpins; i++)
{
double startTime = StartTime + (float)(i + 1) / totalSpins * Duration;
AddNested(i < SpinsRequired
? new SpinnerTick { StartTime = startTime }
: new SpinnerBonusTick { StartTime = startTime });
}
}
public override Judgement CreateJudgement() => new OsuJudgement();

View File

@ -0,0 +1,24 @@
// 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 osu.Game.Audio;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Objects
{
public class SpinnerBonusTick : SpinnerTick
{
public SpinnerBonusTick()
{
Samples.Add(new HitSampleInfo { Name = "spinnerbonus" });
}
public override Judgement CreateJudgement() => new OsuSpinnerBonusTickJudgement();
public class OsuSpinnerBonusTickJudgement : OsuSpinnerTickJudgement
{
protected override int NumericResultFor(HitResult result) => 1100;
}
}
}

View File

@ -1,7 +1,6 @@
// 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 osu.Game.Audio;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Scoring;
@ -10,13 +9,17 @@ namespace osu.Game.Rulesets.Osu.Objects
{
public class SpinnerTick : OsuHitObject
{
public SpinnerTick()
{
Samples.Add(new HitSampleInfo { Name = "spinnerbonus" });
}
public override Judgement CreateJudgement() => new OsuSpinnerTickJudgement();
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
public class OsuSpinnerTickJudgement : OsuJudgement
{
public override bool AffectsCombo => false;
protected override int NumericResultFor(HitResult result) => 100;
protected override double HealthIncreaseFor(HitResult result) => 0;
}
}
}