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);