blob: 205b3a70ccca3aad74956ab4de7a28ce856d85b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
using System;
using System.Linq;
using System.Text;
namespace DiscoBot.Auxiliary
{
public static class RandomMisc
{
public static string Roll(string input)
{
var output = new StringBuilder();
var strings = input.Split('w', 'd').ToList();
var count = Convert.ToInt32(strings[0]);
strings = strings[1].Split(' ').ToList();
var d = Convert.ToInt32(strings[0]);
if (strings.Count > 0)
{
}
var sum = 0;
for (var i = 0; i < count; i++)
{
var roll = Dice.Roll(d);
sum += roll;
output.Append("[" + roll + "] ");
}
if (strings.Count <= 1) return output.ToString();
sum += Convert.ToInt32(strings[1]);
output.Append("sum: " + sum);
return output.ToString();
}
}
}
|