Tigran 4 years ago
parent
commit
f2fa6b5e76
1 changed files with 8 additions and 4 deletions
  1. 8 4
      MafiaTelegramBot/Game/GameRooms/GameRoom.GameProcess.cs

+ 8 - 4
MafiaTelegramBot/Game/GameRooms/GameRoom.GameProcess.cs

@@ -186,7 +186,8 @@ namespace MafiaTelegramBot.Game.GameRooms
                     .GroupBy(p => p.CurrentRole.MafiaTargetId)
                     .Select(item => new {id = item.Key, count = item.Count()})
                     .ToList();
-                if (votes.Count == 0) mafiaNotAgree = strings.mafia_not_kill_message;
+                var hookerBlock = Players.Values.Any(p => p.CurrentRole.MafiaTargetId == -2);
+                if (votes.Count == 0 && !hookerBlock) mafiaNotAgree = strings.mafia_not_kill_message;
                 else {
                     var max = votes.Max(item => item.count);
                     var maxObjects = votes.Where(item => item.count == max).ToList();
@@ -366,7 +367,10 @@ namespace MafiaTelegramBot.Game.GameRooms
         {
             await Task.Run(async () =>
             {
-                var aliveMafia = Players.Values.Where(p => p.GetRole() is Roles.Don or Roles.Mafia && p.IsAlive).ToList();
+                var aliveMafia = Players.Values.Count(p => p.GetRole() is Roles.Don or Roles.Dame or Roles.Mafia && p.IsAlive);
+                if (PlayersRole.ContainsKey(Roles.Werewolf)
+                    && PlayersRole[Roles.Werewolf].Count == 1 && PlayersRole[Roles.Werewolf][0].IsAlive
+                    && ((WerewolfRole) PlayersRole[Roles.Werewolf][0].CurrentRole).IsMafia) aliveMafia++;
                 var additionalResult = "";
                 foreach (var (_, value) in PlayersRole)
                 {
@@ -375,7 +379,7 @@ namespace MafiaTelegramBot.Game.GameRooms
                     if (yellowResult != "") additionalResult += "\n" + yellowResult;
                 }
 
-                if (aliveMafia.Count == 0)
+                if (aliveMafia == 0)
                 {
                     await PlayersCh.Send(strings.villagers_won + additionalResult, exceptDied: false);
                     await PlayersCh.SendSticker(Stickers.Sticker["VillagerWins"]);
@@ -412,7 +416,7 @@ namespace MafiaTelegramBot.Game.GameRooms
                         
                         //Yellow get Wins++
 
-                        if (aliveMafia.Count() == 0)
+                        if (aliveMafia == 0)
                         {
                             //then civil roles get Wins++;
                         }