From 6dfe0e64e659ae62a8c2a81f764b0949066d991c Mon Sep 17 00:00:00 2001 From: openmubr Date: Tue, 24 Nov 2026 23:56:52 +0000 Subject: [PATCH] fix(chaos-castle): rank the survivors before the dead players Players who died stay registered in the mini game until they leave the map. GameEndedAsync ordered the finishers by score only, so a dead player with more points (monster kills give 2, player kills give 1) ranked first. He became the winner and the last survivor got the "failed" result and the rewards of a lower rank. Order the finishers by being alive first, then by score. --- src/GameLogic/MiniGames/ChaosCastleContext.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/GameLogic/MiniGames/ChaosCastleContext.cs b/src/GameLogic/MiniGames/ChaosCastleContext.cs index 2076833e21..811f14a045 100644 --- a/src/GameLogic/MiniGames/ChaosCastleContext.cs +++ b/src/GameLogic/MiniGames/ChaosCastleContext.cs @@ -207,7 +207,11 @@ protected override async ValueTask GameEndedAsync(ICollection finishers) var sortedFinishers = finishers .Select(this.GetGameStateOfFinisher) .WhereNotNull() - .OrderByDescending(state => state.Score) + // Players which died stay registered until they leave the map, so the survivors must rank first. + // Otherwise a dead player with more points (e.g. from monster kills) outranks the last survivor, + // and the survivor gets the "failed" result and the rewards of a lower rank. + .OrderByDescending(state => state.Player.IsAlive) + .ThenByDescending(state => state.Score) .ToList(); var scoreList = new List<(string Name, int Score, int BonusExp, int BonusMoney)>();