Tigran 4 роки тому
батько
коміт
27cda1bee4

+ 5 - 2
MafiaTelegramBot/DataBase/User.cs

@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Threading.Tasks;
 using MafiaTelegramBot.Controllers;
+using MafiaTelegramBot.Resources;
 
 namespace MafiaTelegramBot.DataBase
 {
@@ -13,8 +14,10 @@ namespace MafiaTelegramBot.DataBase
         public int Games { get; set; } = 0;
         public string NickName { get; set; } = "";
         public int Wins { get; set; } = 0;
-        public Dictionary<string, int> RoleGames = new();
-        public Dictionary<string, int> RoleWins = new();
+        public Dictionary<Roles, int> RoleGames = new();
+        public Dictionary<Roles, int> RoleWins = new();
+
+        public Roles CurrentRole = Roles.None;
 
         private string _roomKey = "";
         

+ 21 - 0
MafiaTelegramBot/Game/GameRoles/CopRole.cs

@@ -0,0 +1,21 @@
+using System.Threading.Tasks;
+using MafiaTelegramBot.Controllers;
+using MafiaTelegramBot.Models;
+using MafiaTelegramBot.Resources;
+using Telegram.Bot.Types;
+using User = MafiaTelegramBot.DataBase.User;
+
+namespace MafiaTelegramBot.Game.GameRoles
+{
+    public class CopRole : Role
+    {
+        protected override Roles RoleKey => Roles.Cop;
+        
+        protected override async Task<Message> NightAction(User user)
+        {
+            var room = await RoomController.GetRoom(user.GetRoomKey());
+            //TODO this is what user can do in night phase
+            return await Bot.SendWithMarkdown2(user.ChatId, strings.unexpected_error);
+        }
+    }
+}

+ 21 - 0
MafiaTelegramBot/Game/GameRoles/DoctorRole.cs

@@ -0,0 +1,21 @@
+using System.Threading.Tasks;
+using MafiaTelegramBot.Controllers;
+using MafiaTelegramBot.Models;
+using MafiaTelegramBot.Resources;
+using Telegram.Bot.Types;
+using User = MafiaTelegramBot.DataBase.User;
+
+namespace MafiaTelegramBot.Game.GameRoles
+{
+    public class DotorRole : Role
+    {
+        protected override Roles RoleKey => Roles.Doctor;
+        
+        protected override async Task<Message> NightAction(User user)
+        {
+            var room = await RoomController.GetRoom(user.GetRoomKey());
+            //TODO this is what user can do in night phase
+            return await Bot.SendWithMarkdown2(user.ChatId, strings.unexpected_error);
+        }
+    }
+}

+ 21 - 0
MafiaTelegramBot/Game/GameRoles/DonRole.cs

@@ -0,0 +1,21 @@
+using System.Threading.Tasks;
+using MafiaTelegramBot.Controllers;
+using MafiaTelegramBot.Models;
+using MafiaTelegramBot.Resources;
+using Telegram.Bot.Types;
+using User = MafiaTelegramBot.DataBase.User;
+
+namespace MafiaTelegramBot.Game.GameRoles
+{
+    public class DonRole : Role
+    {
+        protected override Roles RoleKey => Roles.Don;
+        
+        protected override async Task<Message> NightAction(User user)
+        {
+            var room = await RoomController.GetRoom(user.GetRoomKey());
+            //TODO this is what user can do in night phase
+            return await Bot.SendWithMarkdown2(user.ChatId, strings.unexpected_error);
+        }
+    }
+}

+ 21 - 0
MafiaTelegramBot/Game/GameRoles/HookerRole.cs

@@ -0,0 +1,21 @@
+using System.Threading.Tasks;
+using MafiaTelegramBot.Controllers;
+using MafiaTelegramBot.Models;
+using MafiaTelegramBot.Resources;
+using Telegram.Bot.Types;
+using User = MafiaTelegramBot.DataBase.User;
+
+namespace MafiaTelegramBot.Game.GameRoles
+{
+    public class HookerRole : Role
+    {
+        protected override Roles RoleKey => Roles.Hooker;
+        
+        protected override async Task<Message> NightAction(User user)
+        {
+            var room = await RoomController.GetRoom(user.GetRoomKey());
+            //TODO this is what user can do in night phase
+            return await Bot.SendWithMarkdown2(user.ChatId, strings.unexpected_error);
+        }
+    }
+}

+ 21 - 0
MafiaTelegramBot/Game/GameRoles/MafiaRole.cs

@@ -0,0 +1,21 @@
+using System.Threading.Tasks;
+using MafiaTelegramBot.Controllers;
+using MafiaTelegramBot.Models;
+using MafiaTelegramBot.Resources;
+using Telegram.Bot.Types;
+using User = MafiaTelegramBot.DataBase.User;
+
+namespace MafiaTelegramBot.Game.GameRoles
+{
+    public class MafiaRole : Role
+    {
+        protected override Roles RoleKey => Roles.Mafia;
+        
+        protected override async Task<Message> NightAction(User user)
+        {
+            var room = await RoomController.GetRoom(user.GetRoomKey());
+            //TODO this is what user can do in night phase
+            return await Bot.SendWithMarkdown2(user.ChatId, strings.unexpected_error);
+        }
+    }
+}

+ 18 - 2
MafiaTelegramBot/Game/GameRoles/Role.cs

@@ -1,7 +1,23 @@
-namespace MafiaTelegramBot.Game.Roles
+using System.Threading.Tasks;
+using MafiaTelegramBot.Controllers;
+using MafiaTelegramBot.Models;
+using MafiaTelegramBot.Resources;
+using Telegram.Bot.Types;
+using User = MafiaTelegramBot.DataBase.User;
+
+namespace MafiaTelegramBot.Game.GameRoles
 {
     public abstract class Role
     {
-        protected abstract Resources.Roles RoleKey { get; }
+        protected abstract Roles RoleKey { get; }
+
+        protected async Task<Message> DayAction(User user)
+        {
+            var room = await RoomController.GetRoom(user.GetRoomKey());
+            //TODO user telling anything in one minute and vote
+            return await Bot.SendWithMarkdown2(user.ChatId, strings.unexpected_error);
+        }
+
+        protected abstract Task<Message> NightAction(User user);
     }
 }

+ 21 - 0
MafiaTelegramBot/Game/GameRoles/VillagerRole.cs

@@ -0,0 +1,21 @@
+using System.Threading.Tasks;
+using MafiaTelegramBot.Controllers;
+using MafiaTelegramBot.Models;
+using MafiaTelegramBot.Resources;
+using Telegram.Bot.Types;
+using User = MafiaTelegramBot.DataBase.User;
+
+namespace MafiaTelegramBot.Game.GameRoles
+{
+    public class VillagerRole : Role
+    {
+        protected override Roles RoleKey => Roles.Villager;
+        
+        protected override async Task<Message> NightAction(User user)
+        {
+            var room = await RoomController.GetRoom(user.GetRoomKey());
+            //TODO this is what user can do in night phase
+            return await Bot.SendWithMarkdown2(user.ChatId, strings.unexpected_error);
+        }
+    }
+}

+ 1 - 0
MafiaTelegramBot/Game/GameRoom.cs

@@ -17,6 +17,7 @@ namespace MafiaTelegramBot.Game
         public bool IsExtended { get; init; } = false;
         public string RoomName { get; init; } = "NoNameRoom";
         public User Creator { get; init; } = new();
+        
         public readonly Dictionary<long, User> Players = new();
         public readonly Dictionary<string, string> Settings = new();
 

+ 1 - 0
MafiaTelegramBot/Resources/Roles.cs

@@ -8,5 +8,6 @@ namespace MafiaTelegramBot.Resources
         Cop, //Комиссар
         Villager, //Мирный житель
         Hooker, //Проститутка
+        None
     }
 }