1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 16:42:57 +08:00

Merge pull request #595 from smoogipooo/taiko-fixes

Taiko fixes
This commit is contained in:
Dean Herbert 2017-04-06 16:32:03 +09:00 committed by GitHub
commit 96f814db6c
10 changed files with 68 additions and 46 deletions

View File

@ -8,9 +8,8 @@ using osu.Game.Modes.Taiko.Objects;
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps.Legacy;
using osu.Game.Beatmaps.Timing;
using osu.Game.Database;
using osu.Game.IO.Serialization;
using osu.Game.Audio;
namespace osu.Game.Modes.Taiko.Beatmaps
@ -41,9 +40,12 @@ namespace osu.Game.Modes.Taiko.Beatmaps
public Beatmap<TaikoHitObject> Convert(Beatmap original)
{
BeatmapInfo info = original.BeatmapInfo.DeepClone<BeatmapInfo>();
info.Difficulty.SliderMultiplier *= legacy_velocity_multiplier;
return new Beatmap<TaikoHitObject>(original)
{
TimingInfo = original is LegacyBeatmap ? new LegacyTimingInfo(original.TimingInfo) : original.TimingInfo,
BeatmapInfo = info,
HitObjects = original.HitObjects.SelectMany(h => convertHitObject(h, original)).ToList()
};
}
@ -75,7 +77,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps
double distance = distanceData.Distance * repeats * legacy_velocity_multiplier;
// The velocity of the taiko hit object - calculated as the velocity of a drum roll
double taikoVelocity = taiko_base_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength * legacy_velocity_multiplier;
double taikoVelocity = taiko_base_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength;
// The duration of the taiko hit object
double taikoDuration = distance / taikoVelocity;
@ -85,7 +87,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps
speedAdjustedBeatLength /= speedAdjustment;
// The velocity of the osu! hit object - calculated as the velocity of a slider
double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength * legacy_velocity_multiplier;
double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength;
// The duration of the osu! hit object
double osuDuration = distance / osuVelocity;
@ -155,21 +157,5 @@ namespace osu.Game.Modes.Taiko.Beatmaps
}
}
}
private class LegacyTimingInfo : TimingInfo
{
public LegacyTimingInfo(TimingInfo original)
{
if (original is LegacyTimingInfo)
ControlPoints.AddRange(original.ControlPoints);
else
{
ControlPoints.AddRange(original.ControlPoints.Select(c => c.Clone()));
foreach (var c in ControlPoints)
c.SpeedMultiplier *= legacy_velocity_multiplier;
}
}
}
}
}

View File

@ -15,6 +15,8 @@ namespace osu.Game.Modes.Taiko.Judgements
/// </summary>
public override string MaxResultString => string.Empty;
public override bool AffectsCombo => false;
protected override int NumericResultForScore(TaikoHitResult result)
{
switch (result)

View File

@ -3,6 +3,7 @@
using osu.Game.Modes.Judgements;
using osu.Framework.Extensions;
using osu.Game.Modes.Objects.Drawables;
namespace osu.Game.Modes.Taiko.Judgements
{
@ -21,12 +22,12 @@ namespace osu.Game.Modes.Taiko.Judgements
/// <summary>
/// The result value for the combo portion of the score.
/// </summary>
public int ResultValueForScore => NumericResultForScore(TaikoResult);
public int ResultValueForScore => Result == HitResult.Miss ? 0 : NumericResultForScore(TaikoResult);
/// <summary>
/// The result value for the accuracy portion of the score.
/// </summary>
public int ResultValueForAccuracy => NumericResultForAccuracy(TaikoResult);
public int ResultValueForAccuracy => Result == HitResult.Miss ? 0 : NumericResultForAccuracy(TaikoResult);
/// <summary>
/// The maximum result value for the combo portion of the score.

View File

@ -39,7 +39,7 @@ namespace osu.Game.Modes.Taiko.Objects
{
base.ApplyDefaults(timing, difficulty);
ScrollTime = scroll_time * (timing.BeatLengthAt(StartTime) / 1000) / (difficulty.SliderMultiplier * timing.SpeedMultiplierAt(StartTime));
ScrollTime = scroll_time * (timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000) / difficulty.SliderMultiplier;
ControlPoint overridePoint;
Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode;

View File

@ -187,10 +187,6 @@ namespace osu.Game.Modes.Taiko.Scoring
if (!isTick)
totalHits++;
// Apply combo changes, must be done before the hit score is added
if (!isTick && judgement.Result == HitResult.Hit)
Combo.Value++;
// Apply score changes
addHitScore(judgement);
@ -261,7 +257,7 @@ namespace osu.Game.Modes.Taiko.Scoring
foreach (var j in Judgements)
{
scoreForAccuracy += j.ResultValueForAccuracy;
maxScoreForAccuracy = j.MaxResultValueForAccuracy;
maxScoreForAccuracy += j.MaxResultValueForAccuracy;
}
Accuracy.Value = (double)scoreForAccuracy / maxScoreForAccuracy;

View File

@ -1,6 +1,8 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Newtonsoft.Json;
using osu.Game.IO.Serialization;
using osu.Game.Modes;
using SQLite.Net.Attributes;
using SQLiteNetExtensions.Attributes;
@ -9,7 +11,7 @@ using System.Linq;
namespace osu.Game.Database
{
public class BeatmapInfo : IEquatable<BeatmapInfo>
public class BeatmapInfo : IEquatable<BeatmapInfo>, IJsonSerializable
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
@ -55,17 +57,13 @@ namespace osu.Game.Database
// Editor
// This bookmarks stuff is necessary because DB doesn't know how to store int[]
public string StoredBookmarks { get; internal set; }
[Ignore]
[JsonIgnore]
public int[] Bookmarks
{
get
{
return StoredBookmarks.Split(',').Select(int.Parse).ToArray();
}
set
{
StoredBookmarks = string.Join(",", value);
}
get { return StoredBookmarks.Split(',').Select(int.Parse).ToArray(); }
set { StoredBookmarks = string.Join(",", value); }
}
public double DistanceSpacing { get; set; }
@ -84,7 +82,7 @@ namespace osu.Game.Database
}
public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null &&
BeatmapSet.Path == other.BeatmapSet.Path &&
(Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile;
BeatmapSet.Path == other.BeatmapSet.Path &&
(Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile;
}
}

View File

@ -0,0 +1,29 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Newtonsoft.Json;
namespace osu.Game.IO.Serialization
{
public interface IJsonSerializable
{
}
public static class JsonSerializableExtensions
{
public static string Serialize(this IJsonSerializable obj)
{
return JsonConvert.SerializeObject(obj);
}
public static T Deserialize<T>(string objString)
{
return JsonConvert.DeserializeObject<T>(objString);
}
public static T DeepClone<T>(this IJsonSerializable obj)
{
return Deserialize<T>(Serialize(obj));
}
}
}

View File

@ -17,10 +17,7 @@ namespace osu.Game.Modes.Judgements
/// </summary>
public double TimeOffset;
/// <summary>
/// The combo after this judgement was processed.
/// </summary>
public int ComboAtHit;
public virtual bool AffectsCombo => true;
/// <summary>
/// The string representation for the result achieved.

View File

@ -8,6 +8,7 @@ using osu.Game.Beatmaps;
using osu.Game.Modes.Judgements;
using osu.Game.Modes.Objects;
using osu.Game.Modes.UI;
using osu.Game.Modes.Objects.Drawables;
namespace osu.Game.Modes.Scoring
{
@ -145,10 +146,21 @@ namespace osu.Game.Modes.Scoring
if (!exists)
{
if (judgement.AffectsCombo)
{
switch (judgement.Result)
{
case HitResult.Miss:
Combo.Value = 0;
break;
case HitResult.Hit:
Combo.Value++;
break;
}
}
Judgements.Add(judgement);
OnNewJudgement(judgement);
judgement.ComboAtHit = Combo.Value;
}
else
OnJudgementChanged(judgement);

View File

@ -98,6 +98,7 @@
<Compile Include="IO\Legacy\ILegacySerializable.cs" />
<Compile Include="IO\Legacy\SerializationReader.cs" />
<Compile Include="IO\Legacy\SerializationWriter.cs" />
<Compile Include="IO\Serialization\IJsonSerializable.cs" />
<Compile Include="IPC\ScoreIPCChannel.cs" />
<Compile Include="Modes\Replays\Replay.cs" />
<Compile Include="Modes\Judgements\DrawableJudgement.cs" />