Ejemplo n.º 1
0
        public async Task MultipleRoll(params string[] s)
        {
            string expr = string.Join("", s).Replace("!", "");

            var values = expr.Split('d', '+');

            int.TryParse(values[0], out int number);
            int.TryParse(values[1], out int size);
            int bonus = 0;

            if (values.Count() > 2)
            {
                int.TryParse(values[2], out bonus);
            }

            List <int> results = new List <int>();

            for (int i = 0; i < number; i++)
            {
                results.Add(DiceHelper.SimpleRoll(size));
            }
            string msg = Context.User.Mention + $" ({expr}) : " + string.Join(" + ", results);

            if (values.Count() > 2)
            {
                msg += " + " + bonus;
            }
            msg += " = " + (results.Sum() + bonus);
            await Context.Message.DeleteAsync();

            await Context.Channel.SendMessageAsync(msg);
        }
Ejemplo n.º 2
0
        public static string Roll(int whiteDiceNum, int blackDiceNum)
        {
            string whiteDiceResult = "";

            for (int i = 0; i < whiteDiceNum; i++)
            {
                int roll = DiceHelper.SimpleRoll(12);
                whiteDiceResult += $"<:{L5RDiceHelper.WhiteDiceMapping[roll]}:{GuildEmotes.FirstOrDefault(x => x.Name == L5RDiceHelper.WhiteDiceMapping[roll])?.Id}>";
            }
            string blackDiceResult = "";

            for (int i = 0; i < blackDiceNum; i++)
            {
                int roll = DiceHelper.SimpleRoll(6);
                blackDiceResult += $"<:{L5RDiceHelper.BlackDiceMapping[roll]}:{GuildEmotes.FirstOrDefault(x => x.Name == L5RDiceHelper.BlackDiceMapping[roll])?.Id}>";
            }

            return(whiteDiceResult + blackDiceResult);
        }
Ejemplo n.º 3
0
        public async Task Roll([Summary("Taille du Dé")] int dieSize, [Summary("Bonus à ajouter")] int bonus = 0)
        {
            await Context.Message.DeleteAsync();

            await Context.Channel.SendMessageAsync(Context.User.Mention + " rolled : " + DiceHelper.SimpleRoll(dieSize, bonus).ResultText);
        }
Ejemplo n.º 4
0
        public override DiceResult FailRoll(int score)
        {
            List <int> temp = new List <int> ();

            if (this.Group == "Champs principal")
            {
                if (this.Name == "Initiative")
                {
                    temp.Add(this.Value);
                    switch (score)
                    {
                    case 1:
                        return(new DiceResult(temp, -125));

                    case 2:
                        return(new DiceResult(temp, -100));

                    // default is for 3 and more as fail result
                    default:
                        return(new DiceResult(temp, -75));
                    }
                }
                else if (this.Name == "Attaque")
                {
                    switch (score)
                    {
                    case 1:
                        temp.Add(DiceHelper.SimpleRoll(100));
                        return(new DiceResult(temp, +15));

                    case 2:
                        temp.Add(DiceHelper.SimpleRoll(100));
                        return(new DiceResult(temp, 0));

                    // default is for 3 and more as fail result
                    default:
                        temp.Add(DiceHelper.SimpleRoll(100));
                        return(new DiceResult(temp, -15));
                    }
                }
                else
                {
                    temp.Add(this.Value);
                    switch (score)
                    {
                    case 1:
                        temp.Add(-DiceHelper.SimpleRoll(100));
                        return(new DiceResult(temp, -15));

                    case 2:
                        temp.Add(-DiceHelper.SimpleRoll(100));
                        return(new DiceResult(temp, 0));

                    // default is for 3 and more as fail result
                    default:
                        temp.Add(-DiceHelper.SimpleRoll(100));
                        return(new DiceResult(temp, +15));
                    }
                }
            }
            else if (this.Group == "Champs secondaire")
            {
                // all secondary stat are done the same way
                switch (score)
                {
                case 1:
                    temp.Add(DiceHelper.SimpleRoll(100));
                    return(new DiceResult(temp, +15));

                case 2:
                    temp.Add(DiceHelper.SimpleRoll(100));
                    return(new DiceResult(temp, 0));

                default:
                    temp.Add(DiceHelper.SimpleRoll(100));
                    return(new DiceResult(temp, -15));
                }
            }

            throw new Exception("Should not happen");
        }
Ejemplo n.º 5
0
 public override DiceResult Roll(int temporaryBonus, bool destinFuneste)
 {
     return(DiceHelper.SimpleRoll(100, Value, temporaryBonus));
 }