mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2026-04-20 05:24:59 +00:00
修复召唤物击杀最后一个敌人时无法结算的问题
This commit is contained in:
parent
4622d34cac
commit
4b5fcfccb1
@ -2058,7 +2058,7 @@ namespace Milimoe.FunGame.Core.Model
|
||||
/// <param name="assists"></param>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断两个角色是否是同一阵营(仅用于混战模式,团队模式下请用 <see cref="IsTeammate"/>)
|
||||
/// </summary>
|
||||
/// <param name="character"></param>
|
||||
/// <param name="target"></param>
|
||||
/// <returns></returns>
|
||||
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 回合奖励
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user