From 4b5fcfccb1ae78fc0884737ba5ee28768e264e38 Mon Sep 17 00:00:00 2001 From: milimoe Date: Thu, 9 Apr 2026 01:00:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=AC=E5=94=A4=E7=89=A9?= =?UTF-8?q?=E5=87=BB=E6=9D=80=E6=9C=80=E5=90=8E=E4=B8=80=E4=B8=AA=E6=95=8C?= =?UTF-8?q?=E4=BA=BA=E6=97=B6=E6=97=A0=E6=B3=95=E7=BB=93=E7=AE=97=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/GamingQueue.cs | 24 +++++++++++++++++++++++- Model/MixGamingQueue.cs | 2 +- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Model/GamingQueue.cs b/Model/GamingQueue.cs index ae57b98..8ab4a1a 100644 --- a/Model/GamingQueue.cs +++ b/Model/GamingQueue.cs @@ -2058,7 +2058,7 @@ namespace Milimoe.FunGame.Core.Model /// protected virtual void AfterDeathCalculation(Character death, Character? killer, Character[] assists) { - if (!_queue.Any(c => c != killer && (c.Master is null || c.Master != killer))) + if (_queue.All(c => IsSameFactionAs(c, killer))) { // 没有其他的角色了,游戏结束 if (killer != null) @@ -3828,6 +3828,28 @@ namespace Milimoe.FunGame.Core.Model return dp; } + /// + /// 判断两个角色是否是同一阵营(仅用于混战模式,团队模式下请用 ) + /// + /// + /// + /// + public static bool IsSameFactionAs(Character character, Character? target) + { + if (target == null) return false; + + // 双方互相为上级 + if (character.Master == target || target.Master == character) + return true; + + // 双方都没有上级 + if (character.Master == null && target.Master == null) + return character == target; + + // 是否是同一上级 + return character.Master == target.Master; + } + #endregion #region 回合奖励 diff --git a/Model/MixGamingQueue.cs b/Model/MixGamingQueue.cs index 37176e1..2e6b03b 100644 --- a/Model/MixGamingQueue.cs +++ b/Model/MixGamingQueue.cs @@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Core.Model .Select(kv => $"[ {kv.Key} ] {kv.Value.Kills} 分"))}\r\n剩余存活人数:{_queue.Count}"); } - if (!_queue.Any(c => c != killer && (c.Master is null || c.Master != killer))) + if (_queue.All(c => IsSameFactionAs(c, killer))) { // 没有其他的角色了,游戏结束 EndGameInfo(killer);