예제 #1
0
        public async Task RockPaperScissorsAsync([Remainder] RpsEnum choice)
        {
            string[] emotesPlayer = { "🤜", "🖐️", "✌️" };
            string[] emotesCPU    = { "🤛", "🖐️", "✌️" };

            var     avatar    = UserAccounts.GetAccount(Context.User);
            RpsEnum cpuChoice = (RpsEnum)((new Random()).Next(0, 1000) % 3);
            string  result    = "";

            switch ((int)choice - (int)cpuChoice)
            {
            case 1:
            case -2:
                result = "You read me like an open book! You win!";
                await ServerGames.UserWonRPS((SocketGuildUser)Context.User, (SocketTextChannel)Context.Channel);

                break;

            case 0:
                ServerGames.UserDidNotWinRPS((SocketGuildUser)Context.User);
                result = "I may not have the gift of Psynergy, but I can still match your strength!";
                break;

            case -1:
            case 2:
                ServerGames.UserDidNotWinRPS((SocketGuildUser)Context.User);
                result = "Ahah! I may forever remember the day I beat an Adept in a fair game!";
                break;
            }

            var embed = new EmbedBuilder();

            embed.WithColor(Colors.Get("Iodem"));
            embed.WithDescription($"{emotesPlayer[(int)choice]} vs {emotesCPU[(int)cpuChoice]}");
            embed.AddField("Result:", result);

            await Context.Channel.SendMessageAsync("", false, embed.Build());
        }