|
@@ -4,7 +4,6 @@ using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
using MafiaTelegramBot.Controllers;
|
|
using MafiaTelegramBot.Controllers;
|
|
using MafiaTelegramBot.CustomCollections.Extensions;
|
|
using MafiaTelegramBot.CustomCollections.Extensions;
|
|
-using MafiaTelegramBot.DataBase.EntityDao;
|
|
|
|
using MafiaTelegramBot.Models;
|
|
using MafiaTelegramBot.Models;
|
|
using MafiaTelegramBot.Resources;
|
|
using MafiaTelegramBot.Resources;
|
|
using Telegram.Bot.Types;
|
|
using Telegram.Bot.Types;
|
|
@@ -160,16 +159,20 @@ namespace MafiaTelegramBot.Game.GameRooms
|
|
.GroupBy(p => p.CurrentRole.GetNightTarget())
|
|
.GroupBy(p => p.CurrentRole.GetNightTarget())
|
|
.Select(item => new {id = item.Key, count = item.Count()})
|
|
.Select(item => new {id = item.Key, count = item.Count()})
|
|
.ToList();
|
|
.ToList();
|
|
- var max = votes.Max(item => item.count);
|
|
|
|
- var maxCount = votes.Count(item => item.count == max);
|
|
|
|
- if (maxCount != 1)
|
|
|
|
|
|
+ if (votes.Count > 0)
|
|
{
|
|
{
|
|
- mafiaNotAgree = $"\n{strings.mafia_not_agree}";
|
|
|
|
- continue;
|
|
|
|
|
|
+ var max = votes.Max(item => item.count);
|
|
|
|
+ var maxCount = votes.Count(item => item.count == max);
|
|
|
|
+ if (maxCount != 1)
|
|
|
|
+ {
|
|
|
|
+ mafiaNotAgree = $"\n{strings.mafia_not_agree}";
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var selected = votes.First(item => item.count == max);
|
|
|
|
+ if (selected.id == -1) continue;
|
|
|
|
+ await Players[selected.id].CurrentRole.Kill();
|
|
}
|
|
}
|
|
- var selected = votes.First(item => item.count == max);
|
|
|
|
- if (selected.id == -1) continue;
|
|
|
|
- await Players[selected.id].CurrentRole.Kill();
|
|
|
|
foreach (var mafia in players) await mafia.CurrentRole.ApplyNightActionResult();
|
|
foreach (var mafia in players) await mafia.CurrentRole.ApplyNightActionResult();
|
|
}
|
|
}
|
|
else if (players.Count == 1)
|
|
else if (players.Count == 1)
|