Esempio n. 1
0
        public async Task RollDiceGame()
        {
            if (Context.IsPrivate == true)
            {
                return;
            }
            int TossOne     = DiceGame.Roll();
            int TossTwo     = DiceGame.Roll();
            int Total       = TossOne + TossTwo;
            var gameChannel = Global.Client.GetGuild(Config.bot.guildID).GetTextChannel(ChannelIds.channels.miniGameID);
            var embed       = new EmbedBuilder();

            if (Global.PlayerOneRoll == 0 || Global.PlayerTwoRoll == 0)
            {
                if (Global.PlayerOneRoll == 0)
                {
                    embed.WithTitle($"Dice have been Rolled!")
                    .AddField("The dice are:", $"Dice one: {TossOne}! Dice two: {TossTwo}!")
                    .AddField($"{Context.User} has rolled:", Total);
                    await gameChannel.SendMessageAsync("", false, embed.Build());

                    Global.PlayerOneId   = Context.User as SocketGuildUser;
                    Global.PlayerOneRoll = Total;
                }
                else if (Global.PlayerTwoRoll == 0)
                {
                    embed.WithTitle($"Dice have been Rolled!")
                    .AddField("The dice are:", $"Dice one: {TossOne}! Dice two: {TossTwo}!")
                    .AddField($"{Context.User} has rolled:", Total);
                    await gameChannel.SendMessageAsync("", false, embed.Build());

                    Global.PlayerTwoId   = Context.User as SocketGuildUser;
                    Global.PlayerTwoRoll = Total;
                }
            }
            if (Global.PlayerOneRoll != 0 && Global.PlayerTwoRoll != 0)
            {
                await DiceGameFinish();
            }
        }