Пример #1
0
        public async Task RockPaperScissorsAsync([Remainder] RpsEnum choice)
        {
            string[] emotesPlayer = { "🤜", ":hand_splayed:", ":v:" };
            string[] emotesCpu    = { "🤛", ":hand_splayed:", ":v:" };

            var cpuChoice = Enum.GetValues <RpsEnum>().Random();
            var result    = "";

            switch ((int)choice - (int)cpuChoice)
            {
            case 1:
            case -2:
                result = "You read me like an open book! You win!";
                _      = 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);

            _ = Context.Channel.SendMessageAsync("", false, embed.Build());
            await Task.CompletedTask;
        }