示例#1
0
        /// <summary>Default string content of a multiplayer game message. Displays flavor text in AI matches.</summary>
        public override string GetContent(bool showHelp = true)
        {
            if (State != State.Cancelled && UserId.Count(id => id == client.CurrentUser.Id) == 1)
            {
                if (Message == "")
                {
                    Message = Bot.Random.Choose(StartTexts);
                }
                else if (Time > 1 && Winner == Player.None && (!AllBots || Time % 2 == 0))
                {
                    Message = Bot.Random.Choose(GameTexts);
                }
                else if (Winner != Player.None)
                {
                    if (Winner != Player.Tie && UserId[Winner] == client.CurrentUser.Id)
                    {
                        Message = Bot.Random.Choose(WinTexts);
                    }
                    else
                    {
                        Message = Bot.Random.Choose(NotWinTexts);
                    }
                }

                return(Message);
            }

            if (State == State.Active)
            {
                if (UserId[0] == UserId[1] && !UserId.Contains(client.CurrentUser.Id))
                {
                    return("Feeling lonely, or just testing the bot?");
                }
                if (Time == 0 && showHelp && UserId.Length > 1 && UserId[0] != UserId[1])
                {
                    return($"{User(0).Mention} You were invited to play {GameName}.\nChoose an action below, " +
                           $"or type `{storage.GetPrefix(Channel)}cancel` if you don't want to play");
                }
            }

            return("");
        }
示例#2
0
        /// <summary>Default string content of a multiplayer game message. Displays flavor text in AI matches.</summary>
        public override async ValueTask <string> GetContentAsync(bool showHelp = true)
        {
            if (State != GameState.Cancelled && UserId.Count(id => id == ShardedClient.CurrentUser.Id) == 1)
            {
                var texts = new[] { Message };

                if (Message == "")
                {
                    texts = Content.gameStartTexts;
                }
                else if (Time > 1 && Winner == Player.None)
                {
                    texts = Content.gamePlayingTexts;
                }
                else if (Winner != Player.None)
                {
                    texts = Winner != Player.Tie && UserId[Winner] == ShardedClient.CurrentUser.Id
                        ? Content.gameWinTexts
                        : Content.gameNotWinTexts;
                }

                return(Message = Program.Random.Choose(texts));
            }

            if (State == GameState.Active)
            {
                if (UserId[0] == UserId[1] && !UserId.Contains(ShardedClient.CurrentUser.Id))
                {
                    return("Feeling lonely, or just testing the bot?");
                }
                if (Time == 0 && showHelp && UserId.Length > 1 && UserId[0] != UserId[1])
                {
                    return($"{(await GetUserAsync(0)).Mention} You were invited to play {GameName}.\nChoose an action below, " +
                           $"or type `{Storage.GetPrefix(Channel)}cancel` if you don't want to play");
                }
            }

            return("");
        }