Esempio n. 1
0
        public async Task StartVisionPhase()
        {
            var seer = ActiveGame.Investigator;
            await DayChannel.SendMessageAsync(GameElement.PhasePhrase(PhaseType.Investigation));

            if (seer.Active || seer.User.Id == Phases.Last().Target.Id)
            {
                await seer.User.SendMessageAsync(GameElement.PhaseInstruction(PhaseType.Investigation));
                await SendInvestigationPoll(seer);
            }
            else
            {
                await Task.Delay(TimeSpan.FromSeconds(10));

                await CommandChannel.SendMessageAsync(GetCommandByPhaseType(PhaseType.Investigation));
            }
        }
Esempio n. 2
0
        // circular: night -> visions -> day -> night

        public async Task StartGame()
        {
            await ChargeCostOfEntry();

            RemoveMonitors();
            await Task.WhenAll(ActiveGame.Players.Select(p =>
            {
                return(p.User.SendMessageAsync(GameElement.InitialRoleReveal(p.Role)));
            }));

            await DayChannel.SendMessageAsync(GameElement.PhasePhrase(PhaseType.Night));

            await NightChannel.SendMessageAsync(GameElement.PhaseInstruction(PhaseType.Night));

            await UnlockChannelForUsers(NightChannel, ActiveGame.Informed.Select(p => p.User));
            await LockChannelForUsers(DayChannel, ActiveGame.Players.Select(p => p.User));
        }
Esempio n. 3
0
        public async Task StartNightPhase()
        {
            var userToRemove = Phases.LastOrDefault(p => p.Phase == PhaseType.Day)?.Target;

            if (UninformedGroupWins(ActiveGame))
            {
                await EndGameWithWinner(GroupType.Uninformed);
            }
            else if (InformedGroupWins(ActiveGame))
            {
                await EndGameWithWinner(GroupType.Informed);
            }
            else
            {
                await DayChannel.SendMessageAsync(GameElement.PhasePhrase(PhaseType.Night));

                await NightChannel.SendMessageAsync(GameElement.PhaseInstruction(PhaseType.Night));
                await UnlockChannelForUsers(NightChannel, ActiveGame.Informed.Where(p => p.Active).Select(p => p.User));
            }
        }
Esempio n. 4
0
        public async Task StartDayPhase()
        {
            var lastNightVictim = Phases.LastOrDefault(p => p.Phase == PhaseType.Night)?.Target;
            await DayChannel.SendMessageAsync(GameElement.PhasePhrase(PhaseType.Day));

            string dayMessage = lastNightVictim != null
                    ? GameElement.MurderScene(lastNightVictim.Username)
                    : GameElement.NoMurder();

            await DayChannel.SendMessageAsync(dayMessage);

            if (InformedGroupWins(ActiveGame))
            {
                await EndGameWithWinner(GroupType.Informed);
            }
            else
            {
                await DayChannel.SendMessageAsync(GameElement.PhaseInstruction(PhaseType.Day));
                await UnlockChannelForUsers(DayChannel, ActiveGame.Players.Where(p => p.Active).Select(p => p.User));
            }
        }