123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System.Linq;
- using System.Threading.Tasks;
- using MafiaTelegramBot.Game.GameRooms;
- using MafiaTelegramBot.Models;
- using MafiaTelegramBot.Resources;
- using Telegram.Bot.Types;
- namespace MafiaTelegramBot.Game.GameRoles
- {
- public class DoctorRole : GameRoom.Role
- {
- public override Roles RoleKey => Roles.Doctor;
- public override async Task NightAction()
- {
- var targets = Room.Players.Values.Where(p => p.IsAlive).ToList();
- var message = await Bot.SendWithMarkdown2(Player.ChatId, strings.choose_player_to_heal,
- Keyboard.NightChooseTargetKeyboard(targets, Player.Id));
- MessageId = message.MessageId;
- }
- public override async Task ApplyNightActionResult()
- {
- if (NightTargetId == -1)
- await Bot.Get().EditMessageTextAsync(Player.ChatId, MessageId, strings.you_have_not_choosen_target);
- else
- {
- var user = Room.Players[NightTargetId];
- var isTargetSaved = true; //TODO when doctor heals mafia target
- if(isTargetSaved)
- await Bot.Get().EditMessageTextAsync(Player.ChatId, MessageId, $"{strings.you_save_the_target} {user.NickName}");
- }
- }
- public override Task CancelNightActionResult(string message)
- {
- //TODO why action canceled
- return Task.CompletedTask;
- }
- public override Task<Message> SetNightTarget(long userId)
- {
- var canHeal = true; //TODO why doctor cant heal
- if (canHeal)
- {
- NightTargetId = userId;
- return Bot.Get().EditMessageTextAsync(Player.ChatId, MessageId, $"{strings.you_choose_target} {Room.Players[userId].NickName}");
- }
- return Bot.SendWithMarkdown2(Player.ChatId, strings.you_cant_heal_this_target);
- }
- public DoctorRole(GameRoom room, Player player) : base(room, player) { }
- }
- }
|