Esempio n. 1
0
        internal override async Task ExecuteCommand(SocketMessage message, GuildConfig guild)
        {
            EmbedBuilder embedBuilder = new EmbedBuilder();
            Match        m            = Regex.Match(message.Content, "(\\d+) (\\d+) (\\d+) (\\d+)");

            if (m.Success)
            {
                List <DicePool> pools = new List <DicePool>();
                pools.Add(new DicePool($"{m.Groups[1].ToString()}d6", "Discipline"));
                pools.Add(new DicePool($"{m.Groups[2].ToString()}d6", "Exhaustion"));
                pools.Add(new DicePool($"{m.Groups[3].ToString()}d6", "Madness"));
                DicePool painPool = new DicePool($"{m.Groups[4].ToString()}d6", "Pain");

                int      playerSuccess = 0;
                DicePool dominantPool  = pools[0];

                foreach (DicePool entry in pools)
                {
                    int success = entry.CountAtOrBelow(3);
                    playerSuccess += success;
                    if (dominantPool.HighestValue() < entry.HighestValue())
                    {
                        dominantPool = entry;
                    }
                    embedBuilder.AddField($"{entry.Label}", $"{entry.SummarizePoolRoll(0)} = {success}");
                }
                embedBuilder.AddField($"{painPool.Label}", $"{painPool.SummarizePoolRoll(0)} = {painPool.CountAtOrBelow(3)}");

                if (painPool.HighestValue() > dominantPool.HighestValue())
                {
                    dominantPool = painPool;
                }
                string winString   = (playerSuccess >= painPool.CountAtOrBelow(3)) ? "wins" : "loses";
                string successNoun = (playerSuccess == 1) ? "success" : "successes";
                embedBuilder.Description = $"**The player {winString}** the conflict with {playerSuccess} {successNoun} versus {painPool.CountAtOrBelow(3)}. **{dominantPool.Label} dominates** with a {dominantPool.HighestValue()}.";
                await message.Channel.SendMessageAsync($"{message.Author.Mention}:", false, embedBuilder);
            }
            else
            {
                await message.Channel.SendMessageAsync($"{message.Author.Mention}: Dice syntax is `{guild.commandPrefix}dryh [Discipline] [Exhaustion] [Madness] [Pain]`.");
            }
        }
Esempio n. 2
0
        internal override async Task ExecuteCommand(SocketMessage message, GuildConfig guild)
        {
            EmbedBuilder embedBuilder = new EmbedBuilder();
            int          mod          = 0;
            Match        m            = Regex.Match(message.Content, "([-+])(\\d+)");

            if (m.Success)
            {
                mod = Convert.ToInt32(m.Groups[2].ToString());
                if (m.Groups[1].ToString().Equals("-"))
                {
                    mod = -(mod);
                }
            }

            DicePool dice        = new DicePool($"4d3", "FATE");
            int      resultValue = (dice.CountAtOrAbove(3) - dice.CountAtOrBelow(1)) + mod;
            string   modString   = (resultValue >= 0) ? $"+{mod}" : $"{mod}";
            string   descriptiveResult;

            if (resultValue > 7)
            {
                descriptiveResult = $"+{resultValue}, Legendary!";
            }
            else if (resultValue < -2)
            {
                descriptiveResult = $"{resultValue}, Abysmal...";
            }
            else
            {
                string resultKey = (resultValue < 0) ? $"{resultValue}" : $"+{resultValue}";
                descriptiveResult = $"{resultKey}, {fateTiers[resultKey]}";
            }

            embedBuilder.Description = descriptiveResult;
            embedBuilder.AddField("Rolled", $"{dice.SummarizePoolRoll(-2)} ({modString})");
            await Program.SendReply(message, embedBuilder);
        }