瀏覽代碼

detective open role

zelpold 4 年之前
父節點
當前提交
eb52e6c061

+ 5 - 0
MafiaTelegramBot/DataBase/Entity/OpenedRolesEntity.cs

@@ -73,5 +73,10 @@ namespace MafiaTelegramBot.DataBase.Entity
         {
             Lawyer = true;
         }
+
+        public void OpenDetective()
+        {
+            Detective = true;
+        }
     }
 }

+ 2 - 0
MafiaTelegramBot/Game/GameRooms/GameRoom.GameProcess.cs

@@ -524,6 +524,8 @@ namespace MafiaTelegramBot.Game.GameRooms
                         {
                             if (((CopRole) PlayersRole[Roles.Cop][0].CurrentRole).CountRed ==
                                 ((CopRole) PlayersRole[Roles.Cop][0].CurrentRole).CountBlack) player.JournalistAchievementEvent();
+                            if (((CopRole) PlayersRole[Roles.Cop][0].CurrentRole).CountRed == 0 &&
+                                ((CopRole) PlayersRole[Roles.Cop][0].CurrentRole).CountBlack != 0) player.DetectiveAchievementEvent();
 
                         }
                     }

+ 19 - 0
MafiaTelegramBot/Game/Player.cs

@@ -207,6 +207,25 @@ namespace MafiaTelegramBot.Game
             });
         }
 
+        public void DetectiveAchievementEvent() 
+        {
+            Task.Run(async() =>
+            {
+                if (!OpenedRoles.Detective)
+                {
+                    Achievements.GamesWhereCopCheckOnlyMafia++;
+                    if (Achievements.GamesWhereCopCheckOnlyMafia == 3)
+                    {
+                        await Bot.SendWithMarkdown2(ChatId,
+                            $"{strings.congrats} {roles.Detective}! {strings.you_can_use}");
+                        await Bot.SendStickerAsync(ChatId, Stickers.Sticker[Roles.Detective.ToString()]);
+                        OpenedRoles.OpenDetective();
+                    }
+                }
+            });
+        }
+        
+
         public void LawyerRoleAchievementEvent()
         {
             Task.Run(async() =>