diff --git a/osu.Game/Online/Multiplayer/MatchTypes/RankedPlay/RankedPlayDamageInfo.cs b/osu.Game/Online/Multiplayer/MatchTypes/RankedPlay/RankedPlayDamageInfo.cs new file mode 100644 index 0000000000..66ae9fc9a6 --- /dev/null +++ b/osu.Game/Online/Multiplayer/MatchTypes/RankedPlay/RankedPlayDamageInfo.cs @@ -0,0 +1,56 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using MessagePack; + +namespace osu.Game.Online.Multiplayer.MatchTypes.RankedPlay +{ + [Serializable] + [MessagePackObject] + public class RankedPlayDamageInfo : IEquatable + { + /// + /// Total amount of damage dealt. + /// + [Key(0)] + public required int Damage { get; init; } + + /// + /// Damage dealt before multipliers are applied. + /// + [Key(1)] + public required int RawDamage { get; init; } + + /// + /// Life before damage was applied. + /// + [Key(2)] + public required int OldLife { get; init; } + + /// + /// Life after damage was applied. + /// + [Key(3)] + public required int NewLife { get; init; } + + public bool Equals(RankedPlayDamageInfo? other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return Damage == other.Damage && RawDamage == other.RawDamage && OldLife == other.OldLife && NewLife == other.NewLife; + } + + public override bool Equals(object? obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + if (obj.GetType() != GetType()) return false; + + return Equals((RankedPlayDamageInfo)obj); + } + + public override int GetHashCode() => HashCode.Combine(Damage, RawDamage, OldLife, NewLife); + } +} diff --git a/osu.Game/Online/Multiplayer/MatchTypes/RankedPlay/RankedPlayUserInfo.cs b/osu.Game/Online/Multiplayer/MatchTypes/RankedPlay/RankedPlayUserInfo.cs index a5064676c6..a370ef194c 100644 --- a/osu.Game/Online/Multiplayer/MatchTypes/RankedPlay/RankedPlayUserInfo.cs +++ b/osu.Game/Online/Multiplayer/MatchTypes/RankedPlay/RankedPlayUserInfo.cs @@ -34,5 +34,14 @@ namespace osu.Game.Online.Multiplayer.MatchTypes.RankedPlay /// [Key(3)] public int RatingAfter { get; set; } + + /// + /// Information about damage being applied in the current stage. + /// + /// + /// This value is only expected to be populated during the stage. + /// + [Key(4)] + public RankedPlayDamageInfo? DamageInfo; } }