示例#1
0
        public void SomeResult(ParseMessage pm, DND cube)
        {
            //extremly bad practice should think about it
            if (cube is D4)
            {
                cube.SetCubeResult();
            }
            else if (cube is D8)
            {
                cube.SetCubeResult();
            }
            else if (cube is D10)
            {
                cube.SetCubeResult();
            }
            else if (cube is D12)
            {
                cube.SetCubeResult();
            }
            else if (cube is D20)
            {
                cube.SetCubeResult();
            }
            else if (cube is D100)
            {
                cube.SetCubeResult();
            }
            //TODO think about the message huh?
            if (pm.HasArgument && !pm.HasMessage)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("Кидаю d" + $"{cube.CubeType}" + " " + $"{pm.Argument} раз");
                TextMessage = sb.ToString();
            }

            if (pm.HasMessage && !pm.HasArgument)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("Кидаю d" + $"{cube.CubeType}" + " " + $"с надеждой, что {pm.MessageText}");
                TextMessage = sb.ToString();
            }

            if (!pm.HasMessage && !pm.HasArgument)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("Кидаю d" + $"{cube.CubeType}");
                TextMessage = sb.ToString();
            }

            if (pm.HasMessage && pm.HasArgument)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("Кидаю d" + $"{cube.CubeType}" + " " + $"{pm.Argument} раз " + $"c надеждой что {pm.MessageText}");
                TextMessage = sb.ToString();
            }
        }
示例#2
0
        public static List <int> GetValues(DND dnd, int count)
        {
            if (count >= 1)
            {
                var valList = new List <int>(count - 1);
                for (int i = 0; i < count; i++)
                {
                    dnd.SetCubeResult();
                    valList.Add(dnd.CubeResult);
                }

                return(valList);
            }

            throw new Exception();
        }