|
@@ -1,7 +1,7 @@
|
|
|
+using System.Linq;
|
|
|
using System.Threading.Tasks;
|
|
|
using MafiaTelegramBot.Game.GameRooms;
|
|
|
using MafiaTelegramBot.Resources;
|
|
|
-using Telegram.Bot.Types;
|
|
|
|
|
|
namespace MafiaTelegramBot.Game.GameRoles
|
|
|
{
|
|
@@ -9,9 +9,50 @@ namespace MafiaTelegramBot.Game.GameRoles
|
|
|
{
|
|
|
public override Roles RoleKey => Roles.Werewolf;
|
|
|
public bool IsMafia = false;
|
|
|
- public override Task NightAction() { return Task.CompletedTask; }
|
|
|
- public override Task ApplyNightActionResult() { return Task.CompletedTask; }
|
|
|
- public override Task SetNightTarget(long userId) { return new (()=>new Message()); }
|
|
|
+ public override async Task NightAction()
|
|
|
+ {
|
|
|
+ if (IsMafia)
|
|
|
+ {
|
|
|
+ Player.IsSpeaker = true;
|
|
|
+ var targets = Room.Players.Values.Where(p => p.IsAlive).ToList();
|
|
|
+ var message = await Room.PlayersCh.SendTo(Player.ChatId, strings.choose_player_to_kill,
|
|
|
+ Keyboard.NightMafiaTargetKeyboard(targets, Player.Id));
|
|
|
+ MafiaMessageId = message.MessageId;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public override async Task ApplyNightActionResult()
|
|
|
+ {
|
|
|
+ if (IsMafia)
|
|
|
+ {
|
|
|
+ Player.IsSpeaker = false;
|
|
|
+ if (MafiaTargetId != -2)
|
|
|
+ {
|
|
|
+ if (MafiaTargetId == -1)
|
|
|
+ await Room.PlayersCh.EditTo(Player.Id, MafiaMessageId, strings.you_have_not_choosen_target);
|
|
|
+ else MafiaTargetId = -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public override async Task SetMafiaTarget(long userId)
|
|
|
+ {
|
|
|
+ if (IsMafia)
|
|
|
+ {
|
|
|
+ if (userId == -1) await Room.PlayersCh.EditTo(Player.Id, MafiaMessageId, strings.you_skip_vote);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (!Room.Players.ContainsKey(userId))
|
|
|
+ await Room.PlayersCh.SendTo(Player.Id, strings.this_player_left_from_game);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MafiaTargetId = userId;
|
|
|
+ await Room.PlayersCh.EditTo(Player.Id, MafiaMessageId,
|
|
|
+ $"{strings.you_choose_target} {Room.Players[userId].NickName}");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
public WerewolfRole(GameRoom room, Player player) : base(room, player) { }
|
|
|
}
|
|
|
}
|